[CODE]function randomize()
bloodperk = math.random(10,100)
end
function BloodMoney(victim, attacker, dmginfo)
if victim != attacker and attacker:IsPlayer() and attacker:PS_HasItemEquipped("bloodmoney") then
randomize()
if not attacker:Team() == victim:Team() then
attacker:PS_GivePoints(bloodperk)
attacker:ChatPrint("You were given "..bloodperk.." points for killing "..victim:Nick().."!")
end
end
end
hook.Add("PlayerDeath", "BloodMoneyFunc", BloodMoney)[/CODE]
No errors or something.
Just not working?
Anybody know what i've done wrong?
Switch attacker and dmginfo around, the arguments for player death go Victim, Inflictor, Attacker.
[QUOTE=meharryp;49209193]Switch attacker and dmginfo around, the arguments for player death go Victim, Inflictor, Attacker.[/QUOTE]
I've just realized this is based off an addon/code I wrote ages ago - holy shit how did I fuck that up, this is so ugly omg
also why did you use an extra function just to call math.random on a global, instead of givin the result directly to PS_GivePoints?
[QUOTE=Tomelyr;49209345]also why did you use an extra function just to call math.random on a global, instead of givin the result directly to PS_GivePoints?[/QUOTE]
Because I'm a noob coder.
But what have I done wrong :P
[QUOTE=ThaDealerz;49209854]Because I'm a noob coder.
But what have I done wrong :P[/QUOTE]
Read Meharryp's post; your argument order is incorrect
Sorry, you need to Log In to post a reply to this thread.