ESSENTIAL MODS
start essentialmode
start esplugin_mysql
start es_admin2
start salty_death
start es_extended
start es_camera
start essentialmode
start esplugin_mysql
start es_admin2
start salty_death
start es_extended
start es_camera
[ 7891] Error loading script server.lua in resource salty_death: server.lua:22: attempt to index a nil value (global ‘ESX’)
start salty_death after Base Events, EssentialMode Extended and MySQL Async
Thanks for the advice @KandaSorata - I’ll update the script shortly. I’ve seen some scripts that use _source and some that don’t, I’ve never had an issue either way. Is there something specific that this prevents? Asking just so I know for future scripts (and to update my currents).
I seem to also be getting the error upon joining the server similar to someone above, no changes to your script.
Error running call reference function for resource salty_death: citizen:/scripting/lua/scheduler.lua:351: server.lua:26: attempt to index a nil value (local 'xPlayer')
stack traceback:
server.lua:26: in upvalue 'ref'
citizen:/scripting/lua/scheduler.lua:337: in function <citizen:/scripting/lua/scheduler.lua:336>
[C]: in function 'xpcall'
citizen:/scripting/lua/scheduler.lua:336: in function <citizen:/scripting/lua/scheduler.lua:335>
stack traceback:
[C]: in function 'error'
citizen:/scripting/lua/scheduler.lua:351: in function <citizen:/scripting/lua/scheduler.lua:322>
Error running system event handling function for resource es_extended: citizen:/scripting/lua/scheduler.lua:41: Failed to execute thread: citizen:/scripting/lua/MessagePack.lua:830: missing bytes
stack traceback:
[C]: in function 'error'
citizen:/scripting/lua/MessagePack.lua:830: in method 'underflow'
citizen:/scripting/lua/MessagePack.lua:465: in field 'any'
citizen:/scripting/lua/MessagePack.lua:860: in field 'unpack'
citizen:/scripting/lua/scheduler.lua:563: in field '?'
server/functions.lua:60: in field 'TriggerServerCallback'
server/common.lua:74: in upvalue 'handler'
citizen:/scripting/lua/scheduler.lua:175: in function <citizen:/scripting/lua/scheduler.lua:174>
stack traceback:
[C]: in function 'error'
citizen:/scripting/lua/scheduler.lua:41: in field 'CreateThreadNow'
citizen:/scripting/lua/scheduler.lua:174: in function <citizen:/scripting/lua/scheduler.lua:138>
(edited)
EDIT: Nevermind, I fixed the code, thanks for the script!
This script will not work for me
Error running system event handling function for resource salty_death: citizen:/scripting/lua/scheduler.lua:41: Failed to execute thread: server.lua:9: attempt to index a nil value (global ‘ESX’)
If you’re getting an attempt to index a nil value (global ‘ESX’) error, you’re starting es_extended after salty_death.
I don’t know how to explain it in english, but seems using _source prevent messagebytes error when you have a lot of items in your db (more than 320 something like that).
It prevent loosing players informations too. Yeah some scripts don’t use _source because they probably don’t know that
We recently updated all ESX scripts like that for this reason. It’s something to know
Hi, can you share your fix ?
okay. i made it after es extendet. now i get the following errors.
Error running call reference function for resource salty_death: citizen:/scripting/lua/scheduler.lua:351: server.lua:24: attempt to index a nil value (local ‘xPlayer’)
stack traceback:
server.lua:24: in upvalue ‘ref’
citizen:/scripting/lua/scheduler.lua:337: in function citizen:/scripting/lua/scheduler.lua:336
[C]: in function ‘xpcall’
citizen:/scripting/lua/scheduler.lua:336: in function citizen:/scripting/lua/scheduler.lua:335
stack traceback:
[C]: in function ‘error’
citizen:/scripting/lua/scheduler.lua:351: in function citizen:/scripting/lua/scheduler.lua:322
Error running system event handling function for resource es_extended: citizen:/scripting/lua/scheduler.lua:41: Failed to execute thread: citizen:/scripting/lua/MessagePack.lua:830: missing bytes
stack traceback:
[C]: in function ‘error’
citizen:/scripting/lua/MessagePack.lua:830: in method ‘underflow’
citizen:/scripting/lua/MessagePack.lua:465: in field ‘any’
citizen:/scripting/lua/MessagePack.lua:860: in field ‘unpack’
citizen:/scripting/lua/scheduler.lua:563: in field ‘?’
server/functions.lua:60: in field ‘TriggerServerCallback’
server/common.lua:74: in upvalue ‘handler’
citizen:/scripting/lua/scheduler.lua:175: in function citizen:/scripting/lua/scheduler.lua:174
Would you mind sharing the fix you did to get this working
Edit: Nevermind, I modified the code to work, thanks anyways.
Pretty cool stuff bro! keep it up!
Updated the github to use _source and check for nil xPlayer to prevent some of the errors users are experiencing above.
Hey!
I have a issue that after combatlogging, and connecting i get to death cooldown timer, but i can still walk around and do everything.
Any idea how to fix?
Best Regards, Makkan.
You may have a script that is respawning the player ped, such as a skin addon, etc. In this case, you could add a Wait(XXX) on line 37 just after the if statement that makes the script wait a defined amount of time before checking the death. So you could make it was 5 seconds (Wait(5000)) to give it enough time for the character model to load or something like that.
This is just a guess as to what is happening.
Would you be kind and show the edited code?
I told you the exact edit to do…
AddEventHandler("playerSpawned", function()
if firstSpawn then
Wait(5000) -- 5000 is five seconds, change to your needs
ESX.TriggerServerCallback('salty_death:isDead', function(isDeadDB)
if isDeadDB then
killPlayer()
end
end)
firstSpawn = false
end
end)
Really, that’s a sloppy fix. Ideally you would make a client event that can be triggered from your clothing script after you respawn to check for death again. I do something similar on my server, but I’m using a very different version of this script and my own clothing script.
Tried it now, and it looks like it work!
Thanks for a good script!
i just try also and it work for me to i set to 10sec and it work but i had to set manualy isdead to 1
becouse like other guys says when you do alt f4 it change database to 0
i make some more tests and ALT + F4 does change to 0 but not always
yeap same problem when you get killed it sets to from 0 to 1 when you connect again it sets to 0