Installation Guide
- First of all make sure all your identifier rows in all the tables are set to varchar 50 limit.
- Place the luke_multicharacter folder in your resources folder.
-
Execute my .sql file in your database, which should add new rows into the users table (firstname, lastname, dob, sex, height, weight).
- Go into es_extended/client/main.lua (it should be at line number 3) and find:
Citizen.CreateThread(function() while true do Citizen.Wait(0) if NetworkIsPlayerActive(PlayerId()) then TriggerServerEvent('esx:onPlayerJoined') break end end end)
- Comment it out, so it should loook like this:
--[[Citizen.CreateThread(function() while true do Citizen.Wait(0) if NetworkIsPlayerActive(PlayerId()) then TriggerServerEvent('esx:onPlayerJoined') break end end end)--]]
- Go to es_extended/server/main.lua (it should be at line number 6) and find:
RegisterNetEvent('esx:onPlayerJoined')
AddEventHandler('esx:onPlayerJoined', function()
if not ESX.Players[source] then
onPlayerJoined(source)
end
end)
function onPlayerJoined(playerId)
local identifier
for k,v in ipairs(GetPlayerIdentifiers(playerId)) do
if string.match(v, 'license:') then
identifier = string.sub(v, 9)
break
end
end
if identifier then
if ESX.GetPlayerFromIdentifier(identifier) then
DropPlayer(playerId, ('there was an error loading your character!\nError code: identifier-active-ingame\n\nThis error is caused by a player on this server who has the same identifier as you have. Make sure you are not playing on the same Rockstar account.\n\nYour Rockstar identifier: %s'):format(identifier))
else
MySQL.Async.fetchScalar('SELECT 1 FROM users WHERE identifier = @identifier', {
['@identifier'] = identifier
}, function(result)
if result then
loadESXPlayer(identifier, playerId)
else
local accounts = {}
for account,money in pairs(Config.StartingAccountMoney) do
accounts[account] = money
end
MySQL.Async.execute('INSERT INTO users (accounts, identifier) VALUES (@accounts, @identifier)', {
['@accounts'] = json.encode(accounts),
['@identifier'] = identifier
}, function(rowsChanged)
loadESXPlayer(identifier, playerId)
end)
end
end)
end
else
DropPlayer(playerId, 'there was an error loading your character!\nError code: identifier-missing-ingame\n\nThe cause of this error is not known, your identifier could not be found. Please come back later or report this problem to the server administration team.')
end
end
- And replace all of the code above from start to finish with this:
RegisterNetEvent('esx:onPlayerJoined')
AddEventHandler('esx:onPlayerJoined', function(characterId)
if not ESX.Players[source] then
onPlayerJoined(source, characterId)
end
end)
function onPlayerJoined(playerId, characterId)
local identifier
for k,v in ipairs(GetPlayerIdentifiers(playerId)) do
if string.match(v, 'license:') then
identifier = characterId..''..v:sub(9)
break
end
end
if identifier then
if ESX.GetPlayerFromIdentifier(identifier) then
DropPlayer(playerId, ('there was an error loading your character!\nError code: identifier-active-ingame\n\nThis error is caused by a player on this server who has the same identifier as you have. Make sure you are not playing on the same Rockstar account.\n\nYour Rockstar identifier: %s'):format(identifier))
else
MySQL.Async.fetchScalar('SELECT 1 FROM users WHERE identifier = @identifier', {
['@identifier'] = identifier
}, function(result)
if result then
loadESXPlayer(identifier, playerId)
else
local accounts = {}
for account,money in pairs(Config.StartingAccountMoney) do
accounts[account] = money
end
MySQL.Async.execute('INSERT INTO users (accounts, identifier) VALUES (@accounts, @identifier)', {
['@accounts'] = json.encode(accounts),
['@identifier'] = identifier
}, function(rowsChanged)
loadESXPlayer(identifier, playerId)
end)
end
end)
end
else
DropPlayer(playerId, 'there was an error loading your character!\nError code: identifier-missing-ingame\n\nThe cause of this error is not known, your identifier could not be found. Please come back later or report this problem to the server administration team.')
end
end
- Finally, go to your server.cfg and start the resource there.
- You should now be done, if you have any issues double check your edits.