Difference between revisions of "Lua:player killed"
From Fortress Forever Wiki
Jump to navigationJump to searchLine 1: | Line 1: | ||
{{Infobox manual/Header}} | {{Infobox manual/Header}} | ||
− | This function is called whenever a player dies | + | ==player_killed(player_id, damageinfo)== |
+ | This function is called whenever a player dies. | ||
− | Here's an example if you wanted to give your team a point when you killed someone not on your team: | + | ===Inputs=== |
+ | *player_id(CFFPlayer) The player who is being damaged | ||
+ | *damageinfo(CTakeDamageInfo) An info packet about the damage being dealt. See [[Damageinfo_functions]]. If the player suicides by typing ''kill'', or by switching team or class, no damageinfo will be created. | ||
+ | |||
+ | ===Example=== | ||
+ | Here's an example if you wanted to give your team a point when you killed someone not on your team: The global variable "killer" will be set, which contains the player that killed this player. | ||
<pre> | <pre> | ||
function player_killed( player_id ) | function player_killed( player_id ) |
Revision as of 11:06, 12 May 2009
player_killed(player_id, damageinfo)This function is called whenever a player dies. Inputs
ExampleHere's an example if you wanted to give your team a point when you killed someone not on your team: The global variable "killer" will be set, which contains the player that killed this player. 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 |