YOOOO I really can’t understand why on other scripts this works but it doesn’t in mine ones:

RegisterServerEvent('NR_PedsScript:save')

AddEventHandler('NR_PedsScript:save', function(source)

    local xPlayer = ESX.GetPlayerFromId(source)

    print(xPlayer)

    MySQL.Async.execute('UPDATE users SET ped_custom = @ped WHERE identifier = @identifier', {

        ['@ped'] = ped,

        ['@identifier'] = xPlayer.identifier

    })

end)

I get xPlayer as nil, by searching on the forum i found the

if xPlayer ~= nil then

stuff but then I can’t save stuff in the db, how can I solve it?

This is about #server-development:essentialmode

Place your topic in the right category next time.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.