• Points for team kill
    3 replies, posted
[CODE]function GM:PlayerDeath( victim, inflictor, attacker ) if attacker:Team() == Team_Two or victim:!Team() == Team_Two then PS_GivePoints(100, "You killed Team One's Player!") elseif attacker:Team() == TeamOne then PS_GivePoints(50, "You killed Team Two's Player") end end end[/CODE] Yeah thats pretty much what I have gives a player on team two 100 points for killing team ones player etc. Couldnt I use a for loop? Or use the hook instead of over riding the function? Want to practice keeping code neat.
Taken from one of my hooks. I commented my [INFO] function, just un comment it if you think it would be useful for ya. [lua] hook.Add("DoPlayerDeath", "Leaderboards", function(ply, killer, dmginfo) if !IsValid(killer) or !killer:IsPlayer() or !IsValid(ply) or !ply:IsPlayer() or ply == killer then return end if (killer:Team() == TEAM_TWO) and ply:Team() == TEAM_ONE then -- code here elseif (killer:Team() == TEAM_ONE) and ply:Team() == TEAM_TWO then -- code here end --PrintMessage( HUD_PRINTCONSOLE, "[INFO] ".. killer:Nick() .." (".. killer:SteamID() ..") killed ".. ply:Nick() .." (".. ply:SteamID() ..") !") end) [/lua]
[QUOTE=Lolm4te;45604925]Taken from one of my hooks. I commented my [INFO] function, just un comment it if you think it would be useful for ya. [lua] hook.Add("DoPlayerDeath", "Leaderboards", function(ply, killer, dmginfo) if !IsValid(killer) or !killer:IsPlayer() or !IsValid(ply) or !ply:IsPlayer() or ply == killer then return end if (killer:Team() == TEAM_TWO) and ply:Team() == TEAM_ONE then -- code here elseif (killer:Team() == TEAM_ONE) and ply:Team() == TEAM_TWO then -- code here end --PrintMessage( HUD_PRINTCONSOLE, "[INFO] ".. killer:Nick() .." (".. killer:SteamID() ..") killed ".. ply:Nick() .." (".. ply:SteamID() ..") !") end) [/lua][/QUOTE] Your missing a few ends there.... :L thanks anyway
[QUOTE=Skate;45604989]Your missing a few ends there.... :L thanks anyway[/QUOTE] No I'm not? This works, I have it running on my server right now.
Sorry, you need to Log In to post a reply to this thread.