• Custom Money Drop (DarkRP)
    4 replies, posted
[U]So, I wanted not to just have a specific amount of cash that players drop when they die.[/U] That´s why I tried to code it. Here is the code: [lua] if not SERVER then return end local function NewDropDosh( ply, wep, killer ) local wallet = ply:getDarkRPVar( "money" ) local amount = wallet * 0.02 amount = math.Round(amount) if amount > 0 then ply:addMoney(-amount) DarkRP.createMoneyBag(ply:GetPos(), amount) end end hook.Add("PlayerDeath", "DoshDoshDoshDosh", NewDropDosh)[/lua] [B]The problem is that when I pick up the droped money, I don´t get the money.[/B] How could I fix this? Thanks for any help! :)
[code]function Death_DropCash(victim, inflictor, attacker) local wallet = victim:getDarkRPVar("money") local amount = math.Round(wallet * 0.02) if (amount > 0) then victim:addMoney(-amount) DarkRP.createMoneyBag((victim:GetPos()+Vector(0, 0, 10)), amount) -- feel as though money would glitch through map at some points, so spawn it higher end end hook.Add("PlayerDeath", "Death_DropCash", Death_DropCash)[/code] Both yours and mine work properly. I'm afraid the problem lies in your gamemode, and that I cannot help with if there are no errors being produced anywhere.
Hmm, do I need to activate this and set it to 0? [IMG]https://image.prntscr.com/image/AeoRBAsVRfyL3Mi2yL5tsQ.png[/IMG] and [IMG]https://image.prntscr.com/image/vYh8CDXcQeepyaa-uYhfQA.png[/IMG]
[QUOTE=LaserX;52398685]Hmm, do I need to activate this and set it to 0? [IMG]https://image.prntscr.com/image/AeoRBAsVRfyL3Mi2yL5tsQ.png[/IMG] and [IMG]https://image.prntscr.com/image/vYh8CDXcQeepyaa-uYhfQA.png[/IMG][/QUOTE] Mine is set to false and I can still pickup the money properly. That config option has nothing to do with whether you're allowed to drop/pickup money on death. [code] if GAMEMODE.Config.dropmoneyondeath then local amount = GAMEMODE.Config.deathfee if not ply:canAfford(GAMEMODE.Config.deathfee) then amount = ply:getDarkRPVar("money") end if amount > 0 then ply:addMoney(-amount) DarkRP.createMoneyBag(ply:GetPos(), amount) end end[/code] Something else is causing a problem. [editline]25th June 2017[/editline] Also, are you allowed to /dropmoney and pick it up with no problems?
[QUOTE=Chisler;52398752]Mine is set to false and I can still pickup the money properly. That config option has nothing to do with whether you're allowed to drop/pickup money on death. [code] if GAMEMODE.Config.dropmoneyondeath then local amount = GAMEMODE.Config.deathfee if not ply:canAfford(GAMEMODE.Config.deathfee) then amount = ply:getDarkRPVar("money") end if amount > 0 then ply:addMoney(-amount) DarkRP.createMoneyBag(ply:GetPos(), amount) end end[/code] Something else is causing a problem. [editline]25th June 2017[/editline] Also, are you allowed to /dropmoney and pick it up with no problems?[/QUOTE] [B]I just used your code and it worked, after this I put my code back in and it worked also. I dont know where the problem was but thanks![/B] [B]Any ways have a good day :)[/B]
Sorry, you need to Log In to post a reply to this thread.