OnClientPlayerTarget: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
(Undo revision 36276 by MOJRM-511 (talk))
 
(9 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Needs_Checking|Could not make work with
__NOTOC__
<pre>root = getRootElement ()
{{Client event}}
This event is triggered whenever the local player targets an element.


addEventHandler ( "onClientPlayerTarget", root, "targetingActivated" )
==Parameters==
function targetingActivated ( target )
outputChatBox ( "hi" )
end</pre>
and yes it was defined as a client script. --[[User:Ransom|Ransom]] 00:34, 12 April 2007 (CDT)}}
 
[[Category:Incomplete Event]]
 
__NOTOC__
This event is blahblah and is used for blahblah.
 
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
void onClientPlayerTarget ( element target )
element target
</syntaxhighlight>  
</syntaxhighlight>  
*'''target:''' The element the player targetted.
==Source==
The [[event system#Event source|source]] of this event is the [[player]] that targeted the element.


==Example==  
==Example==  
This example does...
This example outputs the type of the target the client is aiming at
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--This line does...
function targetingActivated ( target )
blabhalbalhb --abababa
if ( target ) then
--This line does this...
outputChatBox(tostring(getElementType(target)))
mooo
end
end
addEventHandler ( "onClientPlayerTarget", getRootElement(), targetingActivated )
</syntaxhighlight>
</syntaxhighlight>
==See Also==
===Client player events===
{{Client_player_events}}
===Client event functions===
{{Client_event_functions}}

Latest revision as of 00:06, 2 June 2013

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(target)))
	end
end
addEventHandler ( "onClientPlayerTarget", getRootElement(), targetingActivated )

See Also

Client player events


Client event functions

Shared