fixes(multichar): Spawn improvements; fix nil value;

This commit is contained in:
Linden
2021-06-29 21:29:27 +10:00
parent f3369b6660
commit ab21737644
3 changed files with 17 additions and 30 deletions
+1 -11
View File
@@ -3,18 +3,8 @@ Config.Locale = 'en'
-- [Config.EnableCommands]
-- Enables Commands Such As /char and /chardel
Config.EnableCommands = true
Config.EnableCommands = false
-- [Config.UseSteamID]
-- Changes the identifiers from Rockstar License To Steam. In order to use this, you will have to have
-- made edits to your ESX in order to use Steam identifiers all around, because new ESX uses Rockstar
-- license. I just made it easier for people that convert to steam identifiers.
-- [Config.UseDeferrals]
-- EXPERIMENTAL Character Registration Method. This will allow players to create identities in deferrals
-- before they ever join the server. This still needs time of testing to see what issues that we have
-- in linux servers and windows servers, and which artifacts it will work on, and which artifacts it
-- will not work on. If you don't know a lot about this, I would suggest to set it false for now.
Config.UseDeferrals = false -- EXPERIMENTAL Character Registration Method.
@@ -57,6 +57,7 @@ if ESX.GetConfig().Multichar then
HideHudComponentThisFrame(11)
HideHudComponentThisFrame(12)
HideHudComponentThisFrame(21)
HideHudAndRadarThisFrame()
Citizen.Wait(3)
local vehicles = GetGamePool('CVehicle')
for i=1, #vehicles do
@@ -108,13 +109,10 @@ if ESX.GetConfig().Multichar then
end
TriggerEvent('skinchanger:loadSkin', skin)
end
DoScreenFadeIn(400)
while IsScreenFadedOut() do Citizen.Wait(100) end
end)
DoScreenFadeIn(400)
while IsScreenFadedOut() do Citizen.Wait(100) end
SendNUIMessage({
action = "openui",
character = Characters[index]
})
elseif Characters[index] and Characters[index].skin then
if Characters[Spawned] and Characters[Spawned].model then
RequestModel(Characters[index].model)
@@ -127,15 +125,15 @@ if ESX.GetConfig().Multichar then
end
TriggerEvent('skinchanger:loadSkin', Characters[index].skin)
end
FreezeEntityPosition(PlayerPedId(), true)
Spawned = index
SendNUIMessage({
action = "openui",
character = Characters[index]
})
local playerPed = PlayerPedId()
FreezeEntityPosition(PlayerPedId(), true)
SetPedAoBlobRendering(playerPed, true)
SetEntityAlpha(playerPed, 255)
SendNUIMessage({
action = "openui",
character = Characters[Spawned]
})
end
RegisterNetEvent('esx_multicharacter:SetupUI')
@@ -52,15 +52,14 @@ elseif ESX.GetConfig().Multichar == true then
print(('[^2INFO^7] Player [%s] %s has deleted a character (%s)'):format(GetPlayerName(playerId), playerId, identifier))
end
Citizen.CreateThread(function()
MySQL.ready(function ()
local result = MySQL.Sync.fetchAll('SELECT `TABLE_NAME`, `COLUMN_NAME`, `CHARACTER_MAXIMUM_LENGTH` FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = ? AND (COLUMN_NAME = ? OR COLUMN_NAME = ?) ', {
Config.Database, 'identifier', 'owner'
})
MySQL.ready(function()
MySQL.Async.fetchAll('SELECT `TABLE_NAME`, `COLUMN_NAME`, `CHARACTER_MAXIMUM_LENGTH` FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = ? AND (COLUMN_NAME = ? OR COLUMN_NAME = ?) ', {
Config.Database, 'identifier', 'owner'
}, function(result)
if result then
local varchar, varsize = {}, 0
for k, v in pairs(result) do
if v.CHARACTER_MAXIMUM_LENGTH < 60 then varchar[v.TABLE_NAME] = v.COLUMN_NAME varsize = varsize+1 end
if v.CHARACTER_MAXIMUM_LENGTH and v.CHARACTER_MAXIMUM_LENGTH >= 40 and v.CHARACTER_MAXIMUM_LENGTH < 60 then varchar[v.TABLE_NAME] = v.COLUMN_NAME varsize = varsize+1 end
table.insert(IdentifierTables, {table = v.TABLE_NAME, column = v.COLUMN_NAME})
end
if next(varchar) then
@@ -69,9 +68,9 @@ elseif ESX.GetConfig().Multichar == true then
end
print(('[^2INFO^7] Attempted to update ^5%s^7 columns to use VARCHAR(60)'):format(varsize))
end
if not next(ESX.Jobs) then ESX.Jobs = GetJobs() end
Fetch = MySQL.Sync.store("SELECT `identifier`, `accounts`, `job`, `job_grade`, `firstname`, `lastname`, `dateofbirth`, `sex`, `skin` FROM `users` WHERE identifier LIKE ? LIMIT ?")
end
if not next(ESX.Jobs) then ESX.Jobs = GetJobs() end
Fetch = MySQL.Sync.store("SELECT `identifier`, `accounts`, `job`, `job_grade`, `firstname`, `lastname`, `dateofbirth`, `sex`, `skin` FROM `users` WHERE identifier LIKE ? LIMIT ?")
end)
end)