Setup Guide
How to set up SW Multicharacter across different FiveM frameworks
SW Multicharacter Setup Guide
This section will guide you through setting up SW Multicharacter on different FiveM frameworks. Detailed steps and notes are provided for each framework.
Note:
Make sure you're using the latest version before starting the installation. You can get the latest version from our Discord server.
General Installation Steps
These basic installation steps are common across all frameworks:
- Place the
sw-multicharacterfolder in your server'sresourcesdirectory - Add the following line to your
server.cfgfile:
ensure sw-multicharacter
-
Follow the setup instructions for your specific framework:
-
Restart your server
Framework Selection
Before starting the installation, you need to specify the correct framework in the config.lua file:
-- Framework selection: "esx", "qbcore", or "qbox"
Config.Framework = "esx"
For ESX Framework
ESX Legacy and ESX 1.2+ versions are supported. For detailed information about the installation, visit the ESX Setup Page.
Config.Framework = "esx"
Database Setup
SW Multicharacter creates SQL tables automatically, but in some cases, you may need to install them manually. Here's the SQL schema:
CREATE TABLE IF NOT EXISTS `sw_characters` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`identifier` varchar(60) NOT NULL,
`charid` int(11) NOT NULL,
`firstname` varchar(50) NOT NULL,
`lastname` varchar(50) NOT NULL,
`gender` varchar(10) NOT NULL,
`dob` varchar(50) NOT NULL,
`last_location` longtext NOT NULL,
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
`last_played` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp(),
PRIMARY KEY (`id`),
UNIQUE KEY `identifier_charid` (`identifier`,`charid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
Dependencies
SW Multicharacter doesn't depend on any scripts other than the framework. However, for some optional features, it may require the following resources:
- oxmysql or mysql-async: For database connection
- mythic_notify or pNotify (optional): For notifications
- screenshot-basic (optional): For taking screenshots in character screens
Integration
To integrate SW Multicharacter with other scripts, you can use the following export function to get your character's ID:
local characterId = exports["sw-multicharacter"]:GetActiveCharacter()
For example, to handle a character change:
AddEventHandler('sw-multicharacter:characterChanged', function(characterId)
print("Active character changed! New character ID: " .. characterId)
-- Load character-specific data
end)
Troubleshooting
Common installation issues include:
-
SQL errors
- Make sure MySQL-Async or oxmysql is installed correctly
- Try creating the SQL table manually
-
Resource not found errors
- Make sure the file names and paths are correct
- Verify the folder is in the
resourcesdirectory
-
Framework integration errors
- Make sure your framework version is supported
- Check the
Config.Frameworkvalue in config.lua
For more detailed information about the installation process, please visit the setup page for your chosen framework: