[RELEASE][ESX] Persistent Death

I’ve seen a few requests for this. This is a simple script that will save a player’s death status to the database. If the player ALT+F4’s to avoid dying, they will just spawn dead again.

This is compatible with esx_ambulancejob. esx_ambulancejob added their own implementation to the resource in this commit. Feel free to keep using this resource, or update ambulancejob if you don’t want an extra resource. :man_shrugging:

Requires: Base Events, EssentialMode Extended and MySQL Async.

Instructions: Download folder, modify database, start the resource.

Database modification:

ALTER TABLE `users` ADD `isDead` INT NOT NULL DEFAULT '0' AFTER `name`;

Download: https://github.com/CoreyMcCown13/salty_death

I’ll try to provide limited support if you provide adequate information. Feel free to fork and modify it to meet your needs.

14 Likes

Could u just screenshot how it should be typed in database would be lot easier and thanks for this mod :smiley:

thanks but it does not work for me

2 Likes

What do you mean? You just have to add a isDead column to your users table. It needs to be an integer, with 0 as the default. This just acts as a boolean of if the user is dead or not.

1 Like

Give me more details and I’ll be happy to help.

Please could u just screenshot man I am new to this plzzz would mean the world to me

1 Like

I have but somehow it does not work.
if I die a 1 is set but as soon as I hit alt + f4, it’s at 0

I’m sorry for my bad english

Then another mod is causing the player’s health to go above 0 for some reason.

When I spawn in I am dead… When I wasnt dead before the logout

do i have the database right?

1 Like

I do not mean life in the game.
I mean in the database the 1 and the 0.
if I die is 1.
and if I make alt + f4 is 0

it works but i got this error when i die and alt f4

Error running call reference function for resource FRP-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
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

1 Like

so im guessing it isnt working all the way

That’s not an issue with my resource. That’s for FRP-Death. Looks like it’s not using es_extended properly, what’s your server.cfg resource start order?

It looks like your database is correct, yes. I’m not sure what would cause the value to be reset when you alt+f4 aside from some other script that is adjusting your health somehow. My script only checks for health value, and if it goes above 0 then I will update the database.

oh i probably cant use then i use esx and i dont have any scripts to mess with health

You should use _source instead of source server side
It’s better and prevent messagebytes errors

I absolutely love the name of this resource!

Lol seems to be worded quite wrong

Can you help me

[ 139078] 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’)
[ 139078] stack traceback:
[ 139078] server.lua:24: in upvalue ‘ref’
[ 139078] citizen:/scripting/lua/scheduler.lua:337: in function citizen:/scripting/lua/scheduler.lua:336
[ 139078] [C]: in function ‘xpcall’
[ 139078] citizen:/scripting/lua/scheduler.lua:336: in function citizen:/scripting/lua/scheduler.lua:335
[ 139078] stack traceback:
[ 139078] [C]: in function ‘error’
[ 139078] citizen:/scripting/lua/scheduler.lua:351: in function citizen:/scripting/lua/scheduler.lua:322
[ 139219] 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
[ 139219] stack traceback:
[ 139219] [C]: in function ‘error’
[ 139219] citizen:/scripting/lua/MessagePack.lua:830: in method ‘underflow’
[ 139219] citizen:/scripting/lua/MessagePack.lua:465: in field ‘any’
[ 139219] citizen:/scripting/lua/MessagePack.lua:860: in field ‘unpack’
[ 139219] citizen:/scripting/lua/scheduler.lua:563: in field ‘?’
[ 139219] server/functions.lua:60: in field ‘TriggerServerCallback’
[ 139219] server/common.lua:74: in upvalue ‘handler’
[ 139219] citizen:/scripting/lua/scheduler.lua:175: in function citizen:/scripting/lua/scheduler.lua:174
[ 139219] stack traceback:
[ 139219] [C]: in function ‘error’
[ 139219] citizen:/scripting/lua/scheduler.lua:41: in field ‘CreateThreadNow’
[ 139219] citizen:/scripting/lua/scheduler.lua:174: in function citizen:/scripting/lua/scheduler.lua:138