[Release] esx_wasted 0.7

Hi!

I would like to introduce you my first coded abomination! :smiley:

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!

Discord: MoravianLion#8518

Inspiration from:

Thank you, @Mikeeh

3 Likes

For not refreshing bank money you could do

local BankAccount = xPlayer.getAccount('bank').money
--xPlayer.setBankBalance
xPlayer.removeAccountMoney('bank', BankAccount)
xPlayer.removeBank(BankAccount)

maybe would fix that bug
i know that removeaccount money refreshs the ui.

Unfortunately this:


Any idea?

Ye ‘BankAccount’

s
s
sssssss

Could you be more specific, please?

Ye remove ‘’ only bankaccount

as i wrote up there sss

That… Doesn’t really help, you know.

it works for me so
local BankAccount = xPlayer.getAccount(‘bank’).money
–xPlayer.setBankBalance
xPlayer.removeAccountMoney(‘bank’, BankAccount)

1 Like

Thx, now it works! :slight_smile:

does this have a timer, or does it automatically respawn you at hospital?

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. :slight_smile:

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.

Were you able to make it so you spawn at the nearest hospital?

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.

That was loophole I wasn’t aware of, really. So, definitely go for https://github.com/ESX-Org/esx_ambulancejob and be sure, that you will update https://github.com/ESX-Org/es_extended (and with that definitely even https://github.com/ESX-Org/esx_vehicleshop any garage script you’re using, since latest vehicleshop is using different procedure to save cars to database!)

Good luck! It worth the while and effort, trust me :wink:

Thank you I was planning on getting the ambulancejob.

Nice script mate. But If you get revived before the timer is over. You will later get teleported back to the hospital even tho you are revived

hey buddy nice script. I have one doubt can I do like respawning of the player at same location?