Money drop when die


-- deathfee - the amount of money someone drops when dead.
GM.Config.deathfee                      = 30

How can drop all the money when someone die ?

Put it on ridiculously high number (1mil, or whatever), it will drop no more than player has, anyways.
Or use paid version of ARCBank, it has a feature where you can set the % of money player drops, and loses.

not an efficient way to do it :stuck_out_tongue:

Try this:



hook.Add('PlayerDeath', 'dropurMoneyBITCHBOI', function(pl)	-- This hooks is called every time a player dies. The arguement "pl" is the player that died
	if pl:getDarkRPVar 'money' > 0 then				-- Check if they have money to drop
		local money = pl:getDarkRPVar 'money'		-- Store the amount of money they have in this variable
		local pos = pl:GetPos() + Vector(0, 0, 50) 	-- Store the players position, and add Vector(0, 0, 50) to it to have the money spawn above the player

		pl:addMoney(money * -1)					-- Set the players money to 0 (take the money variable and multiply by negative one)
		DarkRP.createMoneyBag(pos, money)			-- Create the money bag with the premade darkrp function "DarkRP.createMoneyBag", first param being the pos, and second the amount to drop
	end
end)


untested but should work

Thanks, It works <3