cowardtv
Silver Elite
- Jul 1, 2021
- 44
- 13
- 156
soo when ever i use this code below in a cyber multicharacter system that shows the ped like any qb server.
my character wont load at all soo if i use this in the functions i dont see the ped at all and no error
[ model = model ~= nil and tonumber(model) or false ] but when i do this [ model = tonumber(model) ]its loading only the ped it self and still no clothes on it.. i cant figure how to make the ped with the currect clothes and not just a ped with default skin
Client Side
if needed this is server side for fetching the skin data from SQL
my character wont load at all soo if i use this in the functions i dont see the ped at all and no error
[ model = model ~= nil and tonumber(model) or false ] but when i do this [ model = tonumber(model) ]its loading only the ped it self and still no clothes on it.. i cant figure how to make the ped with the currect clothes and not just a ped with default skin
Client Side
Code:
RegisterNUICallback("SelectChars", function(data, cb)
DoScreenFadeOut(500)
while not IsScreenFadedOut() do
Citizen.Wait(10)
end
Citizen.Wait(500)
if LastSelectedChar ~= data.charid and DoesEntityExist(charPed) then
SetEntityAsMissionEntity(charPed, true, true)
DeleteEntity(charPed)
end
if LastSelectedChar ~= data.charid then
Citizen.Wait(150)
local randommodels = {
"mp_m_freemode_01",
"mp_f_freemode_01",
}
if data.ischar == "true" then
ESX.TriggerServerCallback('kashactersS:getPlayerSkin', function(model, data)
model = model ~= nil and tonumber(model) or false
if model ~= nil then
Citizen.CreateThread(function()
RequestModel(model)
while not HasModelLoaded(model) do
Citizen.Wait(0)
end
charPed = CreatePed(2, model, Config.charids.x, Config.charids.y, Config.charids.z, Config.charids.h, false, true)
SetPedComponentVariation(charPed, 0, 0, 0, 2)
FreezeEntityPosition(charPed, false)
SetEntityInvincible(charPed, true)
PlaceObjectOnGroundProperly(charPed)
SetBlockingOfNonTemporaryEvents(charPed, true)
data = json.decode(data)
TriggerEvent('qb-clothing:client:loadPlayerClothing', data, charPed)
end)
if needed this is server side for fetching the skin data from SQL
Code:
ESX.RegisterServerCallback('kashactersS:getPlayerSkin', function(source, cb, charidp)
local src = source
local result = MySQLAsyncExecute('SELECT * FROM playerskins WHERE [email protected] AND [email protected]', {['@identifier'] = 'Char'..charidp..GetPlayerIdentifiers(source)[1], ['@active'] = 1})
if result[1] ~= nil then
cb(result[1].model, result[1].skin)
else
cb(nil)
end
end)