DarkRP money on kill [not dropped]

Hi Guys,

I’m trying to make a gamemode with a darkrp base and I have very little knowledge in GLua so I’m using this as a learning experienced.

I’m trying to make it so a player will receive money on killing another player, straight to their wallet rather than dropped on the floor.

Is this hard to make?


You can use this parameter: darkrpmodification/settings.lua at 829a67824d0b323ca77a1946b367df532fd72f02 · FPtje/darkrpmodification · GitHub, allow dead players to drop money. It won’t be direct but it’s an easier way for your level.

Thank you, does this method require players to have money already? I want my players to start with 0 in their wallet

Yes, the money is deducted from the dead player to be put on the ground. So if the player has nothing, then nothing will be dropped.

How can I make it so they can receive money on player vs player killing even if both of them have 0 money?

Using the PlayerDeath event, here is what you can do:

hook.Add( "PlayerDeath", "A_Unique_Name", function( victim, inflictor, attacker )
    if victim ~= attacker and victim:IsPlayer() and attacker:IsPlayer() then
        attacker:addMoney(50) -- The attacker receives 50 dollars.
end )

Thank you very much :stuck_out_tongue: This seems to work but if I ‘kill’ in console it will give me money… is there a way to block if the player kills themself it wont give money?

I just edited my solution by adding victim ~= attacker.