Lua:player killed

From Fortress Forever Wiki
Revision as of 21:13, 12 December 2007 by Stevenm64-10860 (talk | contribs) (New page: This function is called whenever a player dies. The global variable "killer" will be set, which contains the player that killed this player. Here's an example if you wanted to give your ...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

This function is called whenever a player dies. The global variable "killer" will be set, which contains the player that killed this player.

Here's an example if you wanted to give your team a point when you killed someone not on your team:

function player_killed( player_id )
	-- If you kill someone, give your team a point
	if GetPlayerTeam( killer ) then
		if not ( GetPlayerTeam( player_id ) == GetPlayerTeam( killer ) ) then
			AddTeamScore( GetPlayerTeam( killer ), 1 )
		end
	end
end