On death, then team change

Alright, so my question today is if you are TEAM_HUMAN and you die and become TEAM_UNDEAD, how can I make it print in the chat after you only die from TEAM_HUMAN and not when you die all the time when you are already TEAM_UNDEAD. (I hope that’s not too confusing D:)

Hook into GM/PlayerDeath and run an if check to see if the victim is TEAM_HUMAN, and then run your code to print into chat

So that will effect only if he dies as a human and not as a zombie?

[DEL]If you do it properly yes. Try something like this
[lua]
hook.Add(“PlayerDeath”, “DeathPrint”, function(ply)
if ply:Team() == “TEAM_HUMAN” then – idk how your teams are called
ply:ChatPrint(“You dead as hell son”)
else return end
end
[/lua]

That’s as basic as it gets[/DEL]

woops, fucked up. You shouldn’t do that:) Just go read the wiki I’m tired. Use victim instead of ply

Alright, thanks I did read the wiki, I just didn’t think it would work. I’ll try it out. :slight_smile:



hook.Add( "PlayerDeath", "asdasd", function( victim, inflictor, attacker )

	if ( victim:Team() == TEAM_HUMAN ) then

		victim:PrintMessage( HUD_PRINTTALK, "You are now undead." )

	end

end )


untested