diff --git a/README.md b/README.md index b11c0c1..6c2e817 100644 --- a/README.md +++ b/README.md @@ -23,5 +23,7 @@ List of people that have contributed in a period of longer time: - NewEdit ## How to run it? -Figure it on your own, or just use its parts. This will need some work to get it all working together, as some partsw are missing. -There is no support for this, so please do **not contact us**. +~~Figure it on your own, or just use its parts. This will need some work to get it all working together, as some parts are missing. +There is no support for this, so please do **not contact us**.~~ + +Everything is explained in the [Setup Guide](docs/HOWTO.md) diff --git a/assets/connection_error.png b/assets/connection_error.png new file mode 100644 index 0000000..745e7e1 Binary files /dev/null and b/assets/connection_error.png differ diff --git a/assets/create_char.png b/assets/create_char.png new file mode 100644 index 0000000..31fc26e Binary files /dev/null and b/assets/create_char.png differ diff --git a/assets/folder.png b/assets/folder.png new file mode 100644 index 0000000..8b80597 Binary files /dev/null and b/assets/folder.png differ diff --git a/assets/github-download.png b/assets/github-download.png new file mode 100644 index 0000000..9040954 Binary files /dev/null and b/assets/github-download.png differ diff --git a/assets/path.png b/assets/path.png new file mode 100644 index 0000000..9807b08 Binary files /dev/null and b/assets/path.png differ diff --git a/assets/phone_errors.png b/assets/phone_errors.png new file mode 100644 index 0000000..15891a3 Binary files /dev/null and b/assets/phone_errors.png differ diff --git a/assets/phpmyadmin.png b/assets/phpmyadmin.png new file mode 100644 index 0000000..061643a Binary files /dev/null and b/assets/phpmyadmin.png differ diff --git a/assets/serverdata.png b/assets/serverdata.png new file mode 100644 index 0000000..8dd3749 Binary files /dev/null and b/assets/serverdata.png differ diff --git a/assets/servername.png b/assets/servername.png new file mode 100644 index 0000000..92eeb4a Binary files /dev/null and b/assets/servername.png differ diff --git a/assets/start.png b/assets/start.png new file mode 100644 index 0000000..8d7fd1c Binary files /dev/null and b/assets/start.png differ diff --git a/assets/txadminsetup.png b/assets/txadminsetup.png new file mode 100644 index 0000000..3dcf37d Binary files /dev/null and b/assets/txadminsetup.png differ diff --git a/database-fix.sql b/database-fix.sql new file mode 100644 index 0000000..d05450f --- /dev/null +++ b/database-fix.sql @@ -0,0 +1,82 @@ +DROP TABLE `phone_adverts` +DROP TABLE `player_mails` +DROP TABLE `mail_accounts` +DROP TABLE `phone_services` +DROP TABLE `simcard` +DROP TABLE `phone_racing` +DROP TABLE `phone_messages` + +CREATE TABLE IF NOT EXISTS `phone_adverts` ( + `id` int(11) NOT NULL, + `owner` varchar(255) DEFAULT NULL, + `job` varchar(50) DEFAULT 'default', + `author` varchar(255) DEFAULT NULL, + `title` varchar(50) DEFAULT NULL, + `content` varchar(512) DEFAULT NULL, + `data` varchar(255) DEFAULT NULL, + `image` varchar(255) NOT NULL DEFAULT '', + `expired` varchar(255) NOT NULL DEFAULT 'false', + `time` bigint(20) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +CREATE TABLE IF NOT EXISTS `player_mails` ( + `id` int(11) NOT NULL, + `mailID` int(11) DEFAULT NULL, + `emailID` int(10) NOT NULL, + `reciever` varchar(50) NOT NULL, + `sender` varchar(50) DEFAULT NULL, + `subject` longtext DEFAULT NULL, + `message` text DEFAULT NULL, + `data` longtext DEFAULT NULL, + `read` tinyint(1) DEFAULT 0, + `sender_deleted` tinyint(1) DEFAULT 0, + `reciever_deleted` tinyint(1) DEFAULT NULL, + `date` text DEFAULT NULL, + `button` longtext DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +CREATE TABLE IF NOT EXISTS `mail_accounts` ( + `emailID` int(11) NOT NULL, + `name` varchar(56) DEFAULT NULL, + `password` varchar(56) DEFAULT NULL, + `telephone` varchar(56) DEFAULT NULL, + `data` longtext DEFAULT '[]', + `last_logged` longtext DEFAULT '[]', + `blocked` tinyint(1) DEFAULT 0 +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + + +CREATE TABLE IF NOT EXISTS `phone_services` ( + `id` INT (11) NOT NULL AUTO_INCREMENT, + `name` VARCHAR(200) COLLATE utf8mb4_unicode_ci NOT NULL, + `messages` TEXT NOT NULL, + `created` TIMESTAMP NOT NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`) +) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci; + +CREATE TABLE `simcard` ( + `id` INT (11) NOT NULL AUTO_INCREMENT, + `simid` VARCHAR(200) COLLATE utf8mb4_unicode_ci NOT NULL, + `telephoneNumber` VARCHAR(20) COLLATE utf8mb4_unicode_ci NOT NULL, + `ip` VARCHAR(20) COLLATE utf8mb4_unicode_ci NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `unique_simid` (`simid`), + UNIQUE KEY `unique_telephoneNumber` (`telephoneNumber`), + UNIQUE KEY `unique_ip` (`ip`) +) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci; + +CREATE TABLE `phone_racing` ( + `charid` INT (11) NOT NULL, + `races` TEXT COLLATE utf8mb4_unicode_ci NOT NULL, + `routes` TEXT COLLATE utf8mb4_unicode_ci NOT NULL, + PRIMARY KEY (`charid`) +) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci; + +CREATE TABLE IF NOT EXISTS `phone_messages` ( + `simid` INT(11) NOT NULL, + `number` VARCHAR(255) NOT NULL, + `target` VARCHAR(255) NOT NULL, + `messages` TEXT NOT NULL, + `time` BIGINT(20) DEFAULT NULL, + PRIMARY KEY (`simid`, `number`, `target`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; \ No newline at end of file diff --git a/docs/HOWTO.md b/docs/HOWTO.md new file mode 100644 index 0000000..58c3309 --- /dev/null +++ b/docs/HOWTO.md @@ -0,0 +1,109 @@ +# Installation + +### 1. Download the repository + +**Using git** +```sh +git clone https://github.com/Trsak/CoolFivemFramework +cd CoolFivemFramework +``` + +**Downloading Manually** + +![GitHub](../assets/github-download.png) + +### 2. Import the SQL + +**Using phpMyAdmin** + +- Create a new database +- Select "SQL" tab +- Select the `database.sql` file provided + +Make sure to **disable** "Enable foreign key checks" +![phpMyAdmin](../assets/phpmyadmin.png) + +### 3. Setting up the server +**Using [txAdmin](https://github.com/tabarra/txAdmin/)** +* Create a new txAdmin profile +* Start the FXServer +* Go to http://localhost:30120 (or whatever port you use for txAdmin) +* Start the server setup + +![txAdmin](../assets/txadminsetup.png) + +* Name your server + +![Server Name](../assets/servername.png) + +* As the deployment type, select "Existing Server Data" + +![Server Data](../assets/serverdata.png) + +* Configure the "Base Folder" path (repo folder), the folder should look like this: +![Folder](../assets/folder.png) + +![Server Path](../assets/path.png) + +* Save everything and start the server + +![Starting](../assets/start.png) + +### 4. Starting the server +Upon starting your server, you will encounter some database errors, mostly with the `phone` resource. These errors look like this: + +![Phone Errors](../assets/phone_errors.png) + +To fix them, import the `database-fix.sql` into your database and restart your server. +After restarting, you should see no errors, except those like + +`"Couldn't find resource XXX"` - Most likely a paid resource, that couldn't be included in this framework + +`"Couldn't not find XXX.lua"` + +You can ignore these errors and join the server. + +### 5. Final Touches + +Upon trying to join, you will encounter this error + +![Connection Error](../assets/connection_error.png) + +- Go to `resources/[base]/connect/server/main.lua` +- Comment lines `251 - 264` +- `ensure connect` + +Before trying to join again, you will need to edit one more thing. + +- Go to `resources/[base]/connect/server/main.lua` +- Replace lines `275 - 291` with the following snippet: +```lua + local newUserAdded = exports.data:newConnectedUser( + _source, + { + identifier = playerSteam, + discord = playerDiscord, + nickname = name, + inAnim = false, + source = _source, + status = nil, + admin = false, -- Set this to true if you want every new player to be admin + settings = {}, + character = nil, + chars_left = 2, -- Edit this number if you want more/less character slots for new players + connectionTime = 0, + whitelisted = true + } + ) +``` + +**Updating fivem-appearance** +- Download [this version](https://github.com/pedr0fontoura/fivem-appearance/releases/download/v1.3.1/fivem-appearance.rar) +- Delete the old one in `resource/[ui]/fivem-appearance` and replace it with the one you just downloaded +- Restart the server + +### Joining the server +![Character Creation](../assets/create_char.png) +You can now join the server and create a character(s), but please keep in mind that a few resources will not work. As the original author(s) stated: + +*There will be no future updates, the source code is given *as is*.* diff --git a/server.cfg b/server.cfg new file mode 100644 index 0000000..10700b6 --- /dev/null +++ b/server.cfg @@ -0,0 +1,33 @@ +# Server Configuration for CoolFivemFramework + +endpoint_add_tcp "0.0.0.0:30120" +endpoint_add_udp "0.0.0.0:30120" + +set mysql_connection_string "mysql://root@localhost/yourdatabase?charset=utf8mb4" + +sv_scriptHookAllowed 0 + +sets tags "CoolFivemFramework" + +sets locale "en-US" + +sv_hostname "FXServer with CoolFivemFramework" +sets sv_projectName "CoolFivemFramework Server" +sets sv_projectDesc "github.com/Trsak/CoolFivemFramework" +sv_enforceGameBuild 2189 + +exec resources.cfg + +# Add system admins +add_ace group.admin command allow # allow all commands +add_ace group.admin command.quit deny # but don't allow quit +add_principal identifier.fivem:1 group.admin # add the admin to the group + +sv_maxclients 48 + +# Steam Web API key, if you want to use Steam authentication (https://steamcommunity.com/dev/apikey) +# -> replace "" with the key +set steam_webApiKey "" + +# License key for your server (https://keymaster.fivem.net) +sv_licenseKey your_key \ No newline at end of file