OnClientPlayerWasted: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 1: Line 1:
[[Category:Incomplete Event]]
__NOTOC__
{{Client event}}
This event is triggered whenever a player, including those remote, dies.


__NOTOC__
==Parameters==
This event is blahblah and is used for blahblah.
 
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
void onClientPlayerWasted ( void )
element killer, int weapon, int bodypart
</syntaxhighlight>  
</syntaxhighlight>  
*'''killer''': A [[player]] [[element]] representing the killer.
*'''weapon''': An integer representing the weapon ID the killer used
*'''bodypart''': An integer representing the bodypart the player was damaged
{{BodyParts}}
==Source==
The [[event system#Event source|source]] of this event is the [[player]] that died.


==Example==  
==Example==  
This example does...
This example outputs a mocking message when the local player dies.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--This line does...
messages = {
blabhalbalhb --abababa
"Better luck next time",
--This line does this...
"Don't think you're so cool now, do you?",
mooo
"Nice one, pal",
"Your opinion is void"
}
 
function wastedMessage ( killer, weapon, bodypart )
local randomID = math.random ( 1, #messages ) --get a random ID from the table
local randomMessage = messages[randomID] --use that to retrieve a message
outputChatBox ( randomMessage, 255, 0, 0 ) --output the message
end
addEventHandler ( "onClientPlayerWasted", getLocalPlayer(), wastedMessage ) --add an event for the local player only
</syntaxhighlight>
</syntaxhighlight>
==See Also==
{{Event_functions}}

Revision as of 13:53, 22 October 2007

This event is triggered whenever a player, including those remote, dies.

Parameters

element killer, int weapon, int bodypart
  • killer: A player element representing the killer.
  • weapon: An integer representing the weapon ID the killer used
  • bodypart: An integer representing the bodypart the player was damaged
  • 3: Torso
  • 4: Ass
  • 5: Left Arm
  • 6: Right Arm
  • 7: Left Leg
  • 8: Right Leg
  • 9: Head

Source

The source of this event is the player that died.

Example

This example outputs a mocking message when the local player dies.

messages = { 
"Better luck next time",
"Don't think you're so cool now, do you?",
"Nice one, pal",
"Your opinion is void" 
}

function wastedMessage ( killer, weapon, bodypart )
	local randomID = math.random ( 1, #messages ) --get a random ID from the table
	local randomMessage = messages[randomID] --use that to retrieve a message
	outputChatBox ( randomMessage, 255, 0, 0 ) --output the message
end
addEventHandler ( "onClientPlayerWasted", getLocalPlayer(), wastedMessage ) --add an event for the local player only

See Also

Shared