• Question about hook.Add("PlayerDeath"
    7 replies, posted
Hey guys, so I found this PointShop mod and was taking a look at the files, but the thing is to use it in my serv I need to convert it to TTT structure. My question actolly is, Could someone explain me this function: [lua] hook.Add("PlayerDeath", "PointShop_PlayerDeath", function(victim, inflictor, attacker) if attacker:IsPlayer() and attacker:IsValid() and not victim == attacker then attacker:PS_GivePoints(10, "killed " .. victim:Nick()) end end) [/lua] Above is original I wanted to do it like this: [lua] hook.Add("PlayerDeath", "PointShop_PlayerDeath", function(victim, inflictor, attacker) if attacker:IsPlayer() and attacker:IsValid() and attacker:IsActiveTraitor() and victim == IsActiveDetective() then attacker:PS_GivePoints(30, "killed Detective " .. victim:Nick()) end end) [/lua] Thanks :D
When the player dies if the player is valid(in the server) and if it isnt suicide then give the player 10 points. Is this what you wanted?
[QUOTE=zzaacckk;29032409]When the player dies if the player is valid(in the server) and if it isnt suicide then give the player 10 points. Is this what you wanted?[/QUOTE] No what i want is that if the attacker (person who shoots another guy) is a traitor and the guy who dies is a detective then the traitor gets 30 shop points to buy stuff
Ive never looked at TTT but its probably set to the players team.
Hmm I think we can do it with this hook too, I only dont know the Arguments or whatever its called for the function, thats why I asked it here, But I think its actolly possible I just dont know how, Like this [lua] hook.Add("PlayerDeath", "PointShop_PlayerDeath", function(victim, inflictor, attacker) if attacker:IsPlayer() and attacker:IsValid() and attacker:IsActiveTraitor() and victim == IsActiveDetective() then attacker:PS_GivePoints(30, "killed Detective " .. victim:Nick()) end end) [/lua] (Posted this before too) And no I dont think its with players team
Any suggestions?
Its victim:IsActiveDetective()
[QUOTE=cis.joshb;29063139]Its victim:IsActiveDetective()[/QUOTE] Well dint tested this, but the hats and stuff from the pointshop mod doesnt fit with the player's character, little bug. So basicly never mind this all. Thanks for helping me anyways :D
Sorry, you need to Log In to post a reply to this thread.