I would like to introduce you my first coded abomination!
I am not very proud of the result, but so far, it gets it’s job done. I’ve been in desperate need of any RP death script working for my ESX server, which would have:
1) wasted screen of some sort
2) respawn on hospital
3) money loss in SQL for ESX servers as prevention against random idiots who would shoot anybody on sight, “because they can”
as a result of above, it should force players to rather try to play cool or go dirty and risk jail (in case of my server - temp ban). But the risk of getting shot should be the last option, as with current script set up, the player will loose almost all money both in cash and bank account.
v0.7 - added dirty money removal (+ recommendation of replacing line 255 in “spawnmanager” to – TriggerEvent(‘skinchanger:loadSkin’, skin) – Hopefully, there will be more elegant workaround in future)
v0.6 - added UI refresh for bank account
Known bugs:
I can’t turn off the autorespawn after deathscreen, script instead in few milliseconds will spawn the player at the exact spot and then to hospital (again)
bank account in player UI is not refreshing after death SOLVED
To do:
get percentage money loss, both for cash and for bank acc
respawn to nearest hospital, instead of one or random
I will be more then happy, if anyone will come up with better code for this script! I am not a tech person and have million other things to do. I will appreciate any help I can get!
For now, it’s just spawning instantaneously after death screen. I don’t know how to successfully implement timer yet. But I probably will and then I will post an update.
I’m only guessing here, but because in regular GTA / GTAO you respawn automatically after the death screen. It’s likely that somehow the death screen itself triggers the respawn. Again, it’s just a guess.
Well, there is some code which would easily tell the game not to autorespawn in case of death, but I just couldn’d find the working one. The ones I’ve tried are obsolete, as I see it. They might worked in past or are still working, just under the different frameworks/servers.
I could do it, but instead we have migrated to latest esx_ambulancejob, as we are expanding our RP portfolio. It’s much better to have it as we had a problem with players being killed in shootout and respawning immediately and going loco again. That’s wouldn’t be such a problem on it’s own, but when criminal was shot by LEO, he respawned again and LEO was unable to jail him properly.