OnClientPlayerTarget: 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__
__NOTOC__
{{Server event}}
This event is triggerd every time a player is aiming (requiers a gun)
This event is triggered whenever the local player targets an element.


==Syntax==  
==Parameters==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
void onClientPlayerTarget ( element target )
element target
</syntaxhighlight>  
</syntaxhighlight>  
*'''target:''' The element the player targetted.


===Required Arguments===  
==Source==
*'''target:''' The element the player is currently targeting.  
The [[event system#Event source|source]] of this event is the [[player]] that targeted the element.


==Example==  
==Example==  
Line 15: Line 17:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function targetingActivated ( target )
function targetingActivated ( target )
if ( target ) then
if ( target ) then
outputChatBox(tostring(getElementType(source)))
outputChatBox(tostring(getElementType(source)))
end
end
end
end
addEventHandler ( "onClientPlayerTarget", getRootElement(), targetingActivated )
addEventHandler ( "onClientPlayerTarget", getRootElement(), targetingActivated )
</syntaxhighlight>
</syntaxhighlight>
==See Also==
{{Event_functions}}

Revision as of 13:33, 22 October 2007

This event is triggered whenever the local player targets an element.

Parameters

element target
  • target: The element the player targetted.

Source

The source of this event is the player that targeted the element.

Example

This example outputs the type of the target the client is aiming at

function targetingActivated ( target )
	if ( target ) then
		outputChatBox(tostring(getElementType(source)))
	end
end
addEventHandler ( "onClientPlayerTarget", getRootElement(), targetingActivated )

See Also

Shared