Help with points per kill

on my server i want it so when someone kills a prop they get 10 points per kill. This is what i have but i cant seen to get it to work. Can someone help me out?

[lua]
hook.Add(“PlayerDeath”, “PointShop_PlayerDeath”, function(victim, inflictor, attacker)
if attacker:IsPlayer() and attacker:IsValid() and not victim == attacker then
if attacker:Team() == ROLE_HUNTER and victim:Team() == ROLE_PROP ) then
attacker:PS_GivePoints(10, "killed " … victim:Nick())
attacker:PS_Notify(“You’ve been given ‘10’ points for killing a prop”);
end
end
end)
[/lua]

Are you sure those team names are correct

should they be something else? like just hunters and props?

hhh

Check shared.lua for the gamemode, or possibly sh_init.lua since some copies of Prop Hunt are awkward for no reason

It should tell you the team names there

I just checked it, it should be TEAM_HUNTERS and TEAM_PROPS instead of ROLE_HUNTERS and ROLE_PROPS. thank you for the help

[editline]4th November 2014[/editline]

I dont understand for some reason its still not working

Ive changed it this. and its still not working for some reason
[lua]
hook.Add(“PlayerDeath”, “PointShop_PlayerDeath”, function(victim, inflictor, attacker)
if attacker:IsPlayer() and attacker:IsValid() and not victim == attacker then
if attacker:Team() == TEAM_HUNTERS and victim:Team() == TEAM_PROPS ) then
attacker:PS_GivePoints(10, "killed " … victim:Nick())
attacker:PS_Notify(“You’ve been given ‘10’ points for killing a prop”);
end
end
end)
[/lua]

Try changing



attacker:PS_GivePoints(10, "killed " .. victim:Nick())


to just



attacker:PS_GivePoints(10)


As Niandra said, PS_GivePoints doesn’t have a second argument, only has the #.

I changed it to this and still nothing.

[lua]
hook.Add(“PlayerDeath”, “PointShop_PlayerDeath”, function(victim, inflictor, attacker)
if attacker:IsPlayer() and attacker:IsValid() and not victim == attacker then
if attacker:Team() == TEAM_HUNTERS and victim:Team() == TEAM_PROPS ) then
attacker:PS_GivePoints(10)
attacker:PS_Notify(“You’ve been given ‘10’ points for killing a prop”);
end
end
end)
[/lua]

Ive even tried this.
[lua]
hook.Add( “PlayerDeath”, “PointShop_PlayerDeath”, function( victim, weapon, killer)
if( IsValid( killer ) and IsValid( victim ) ) then
if( killer:IsPlayer() and victim:IsPlayer() ) then
if ( killer:Team() == TEAM_HUNTERS and victim:Team() == TEAM_PROPS ) then
killer:PS_GivePoints( 10 );
killer:PS_Notify(“You’ve been given 10 points for killing a prop!”);
end
end
end
end )
[/lua]

I feel like it cant find the hunters and props team properly.

Try removing the line about teams if you think that’s the issue

Another thing might be to test it on another gamemode, since the whole ‘being a prop’ thing could be causing issues?

Make sure the hook isn’t being overwritten ( does PointShop_PlayerDeath exist in the current addon as a hook? )

Add print-statements and see if it prints out. See where the print statements stop. Try using a more unique hook-name.

I took out the part about props and hunters and I changed PointShop_PlayerDeath to MegaKill and i still cant get it to work.

where would i add the print-statements in the hook?

[lua]
hook.Add( “PlayerDeath”, “MegaKill”, function( victim, weapon, killer)
if( IsValid( killer ) and IsValid( victim ) ) then
if( killer:IsPlayer() and victim:IsPlayer() ) then
if ( killer:Team() == TEAM_HUNTERS and victim:Team() == TEAM_PROPS ) then
killer:PS_GivePoints( 10 );
killer:PS_Notify(“You’ve been given 10 points for killing a prop!”);
end
end
end
end )
[/lua]



hook.Add( "DoPlayerDeath", "GivePoints", function( vict, att, dmginfo )

	if not (IsValid(att) and att:IsPlayer() and att:Team() != vict:Team()) then return end

	att:PS_GivePoints( 5, "You got 5 points for killing a player!" )

end )

Thank you for your help Aternal, still nothing. I tried to see if it would work with an NPC and it did. it looks like this:
[lua]
hook.Add(“OnNPCKilled”, “PointShop_OnNPCKilled”, function(ent, attacker, inflictor)
if attacker:IsPlayer() and attacker:IsValid() then
attacker:PS_GivePoints(10, "killed " … ent:GetClass())
attacker:PS_Notify(“You’ve been given ‘10’ points for killing a prop”);
end
end)
[/lua]

I did something similar for props and hunters and nothing. I dont know whats going on, but thanx anyone for their help.

Isn’t the hook just “PlayerDeath” no Do.
You should also change those ands to ors.

I already have

I just changed it and its still not working. I swear I am doing everything right.
[lua]
hook.Add(“PlayerDeath”, “KillPoints”, function(victim, inflictor, attacker)
if attacker:IsPlayer() and attacker:IsValid() and not victim == attacker then
if attacker:Team() == TEAM_HUNTERS and victim:Team() == TEAM_PROPS ) then
attacker:PS_GivePoints(10)
attacker:PS_Notify(“You’ve been given ‘10’ points for killing a prop”);
end
end
end)
[/lua]



hook.Add("PlayerDeath", "Attacker gets points every kill", function( victim, inflictor, attacker ) 
	local AttackerPoints, InflictorPoints = 10, 5;

	if( attacker:IsPlayer() and attacker:IsAlive() ) then
			if ( attacker:Team() == TEAM_HUNTERS ) then
					attacker:PS_GivePoints(AttackerPoints);
					attacker:PS_Notify( "You have been given 10 points for killing a prop" );
			else

			if ( inflictor:IsPlayer() and inflictor:IsAlive() ) then
					inflictor:PS_GivePoints(InflictorPoints);
					inflictor:PS_Notify( "You have been given 5 points because of a assist" );
			end
		end
	end
end)



try that I haven’t tested it it may or may not work and I added a little extra because I was bored.

This is wrong.
[lua]
not victim == attacker
[/lua]

It’s supposed to be:
[lua]
victim ~= attacker
[/lua]

what does ~ mean again and shouldnt it be?



victim != attacker