Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Create documentation for setting up the framework #3

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Binary file added assets/connection_error.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/create_char.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/folder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/github-download.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/path.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/phone_errors.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/phpmyadmin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/serverdata.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/servername.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/start.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/txadminsetup.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
82 changes: 82 additions & 0 deletions database-fix.sql
Original file line number Diff line number Diff line change
@@ -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;
109 changes: 109 additions & 0 deletions docs/HOWTO.md
Original file line number Diff line number Diff line change
@@ -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*.*
33 changes: 33 additions & 0 deletions server.cfg
Original file line number Diff line number Diff line change
@@ -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