[help] Loose money at death for essensial


#1

Hello, i try to make a script for loose money at death for essensial mod can you help me for this ? :smiley: thanks you !


#2

You could either get into Lua or C# as a start. There are several usefull links scattered around on the forums

We have a Wiki you could take a look at also take a look at NativeDB for usefull natives.

Be sure to take a look at our Releases section on the forums aswell, since there are some great
examples on it.

If you have any more questions be sure to post back!

:snail:


#3

Hi, I just did the script for my server, it’s quite easy.
You need to set a clientside script that check if your player is dead.
Then you add a server script that uses the essentialmoney command : user:setMoney ((0))
When your player die, the clientside refers to the serverside script and it sets your money to 0


#4

Could you release it please ? :slight_smile:


#5

No work for me, you can send my an exemple ?


#6

I went on this post : Respawn hopital after death

where you can see a guy who posted this :

Citizen.CreateThread(function()
    while true do
        Wait(500)
		local ped = GetPlayerPed(-1)
		local yourplace = x,y,z
        if IsEntityDead(ped) then
            NetworkResurrectLocalPlayer(yourplace, true, true, false)
			ClearPedTasks(ped)
		end
	end
end)

Basically it detects when a player dies and it changes his spawnplace to the x,y,z coordinates you want. I just took this code and added under “NetworkResurrect…” a line to set his money to 0. It’s like user:setMoney ((0)) or sth like that in essentialmode.