OnPlayerClick: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
{{Needs_Checking|Lua and MTA do not like 2DposX and 2DposY stored varibles by the event}}
__NOTOC__
{{Server event}}
This event is triggered when a player clicks on an element.


[[Category:Incomplete Event]]
==Parameters==
<syntaxhighlight lang="lua">
string mouseButton, string buttonState, element clickedElement, float worldPosX, float worldPosY, float worldPosZ, float screenPosX, float screenPosY
</syntaxhighlight>


__NOTOC__
*'''mouseButton''': A string representing the mousebutton that was pressed. Value can be ''left'', ''middle'' or ''right''.
This event is triggered when a player clicks an element with the mouse cursor.
*'''buttonState''': A string representing the button state. Value can be ''up'' or ''down''.
*'''clickedElement''': The element the player clicked on. This value is ''nil'' if none.
*'''worldPosX''': The X position in the world the player clicked on
*'''worldPosX''': The Y position in the world the player clicked on
*'''worldPosX''': The Z position in the world the player clicked on
*'''screenPosX''': The X position on the screen the player clicked on
*'''screenPosY''': The Y position on the screen the player clicked on


==Syntax==  
<!-- Add the event's source in the section below -->
<syntaxhighlight lang="lua">
==Source==
void onPlayerClick ( string button, string state, element clickedElement, float posX, float posY, float posZ, float 2DposX, float 2DposY )
The [[event system#Event source|source]] of this event is the [[player]] that clicked.
</syntaxhighlight>


==Example==  
==Example==  
<!-- Explain what the example is in a single sentance -->
This example does...
This example does...
<!-- Add the code below, an emphasis should be on making it clear, not optimized. You could provide two versions if you wish, one clear and well commented, the other optimized -->
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--This line does...
--This line does...
blabhalbalhb --abababa
blah()
--This line does this...
--This line does this...
mooo
mooo
</syntaxhighlight>
</syntaxhighlight>
==See Also==
{{Event_functions}}
[[Category:Needs Example]]

Revision as of 05:45, 30 December 2007

This event is triggered when a player clicks on an element.

Parameters

string mouseButton, string buttonState, element clickedElement, float worldPosX, float worldPosY, float worldPosZ, float screenPosX, float screenPosY
  • mouseButton: A string representing the mousebutton that was pressed. Value can be left, middle or right.
  • buttonState: A string representing the button state. Value can be up or down.
  • clickedElement: The element the player clicked on. This value is nil if none.
  • worldPosX: The X position in the world the player clicked on
  • worldPosX: The Y position in the world the player clicked on
  • worldPosX: The Z position in the world the player clicked on
  • screenPosX: The X position on the screen the player clicked on
  • screenPosY: The Y position on the screen the player clicked on

Source

The source of this event is the player that clicked.

Example

This example does...

--This line does...
blah()
--This line does this...
mooo

See Also