esx_kasharacter
Guide how to edit rcore_identity to fit esx_kascharacter
esx_kasharacter/server/main.lua When user will try to create new character start rcore_identity
RegisterServerEvent("kashactersS:CharacterChosen")
AddEventHandler('kashactersS:CharacterChosen', function(charid, ischar)
local src = source
local new = true
local spawn = {}
SetLastCharacter(src, tonumber(charid))
SetCharToIdentifier(GetRockstarID(src), tonumber(charid))
if ischar == "true" then
new = false
spawn = GetSpawnPos(src)
--Spawn only when a character is created
TriggerClientEvent("kashactersC:SpawnCharacter", src, spawn, new)
else
--start rcore_identity register
TriggerClientEvent('rcore_identity:startRegistration', src)
--Old code
--TriggerClientEvent('skinchanger:loadDefaultModel', src, true, cb)
--spawn = { x = 195.55, y = -933.36, z = 29.90 } -- DEFAULT SPAWN POSITION
end
end)
rcore_identity/server/main.lua Comment sending startRegistration
AddEventHandler(Config.ESX['esx:playerLoaded'], function(_source)
local xPlayer = ESX.GetPlayerFromId(_source)
getUser(xPlayer, function(user)
if user ~= nil then
if #Config.FieldsEmpty == 0 then
dbg.critical('Register cannot start cause you have empty Config.FiedlsEmpty field!')
end
local allFields = true
for _, field in pairs(Config.FieldsEmpty) do
local data = user[field];
if nullOrEmpty(data) then
allFields = false
break
end
end
if allFields == false then
sendCustomDiscordMessage(SConfig.DiscordWebhook, 'User register', string.format('Player %s is now register!', xPlayer.getName()), 0x00FF00, 'rcore_identity')
--TriggerClientEvent(triggerName('startRegistration'), _source)
else
sendDiscordMessage(SConfig.DiscordWebhook, 'User login', string.format('Player %s is now logged in!', xPlayer.getName()), 0x00FFFF, 'rcore_identity')
updateXPlayer(xPlayer, user) -- Update xPlayer values
TriggerClientEvent(triggerName('loadCharacter'), _source, json.decode(user.skin))
end
else
dbg.critical('Trying to open registration even that users row does not exists yet!')
sendCustomDiscordMessage(SConfig.DiscordWebhook, 'User register', string.format('Player %s is now register!', xPlayer.getName()), 0x00FF00, 'rcore_identity')
--TriggerClientEvent(triggerName('startRegistration'), _source)
end
end)
end)
Last updated