OnPlayerClick: Difference between revisions
Jump to navigation
Jump to search
(Added an example.) |
m (→Parameters) |
||
Line 11: | Line 11: | ||
*'''buttonState''': A string representing the button state. Value can be ''up'' or ''down''. | *'''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. | *'''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 X position in the world the player clicked on. | ||
*'''worldPosY''': The Y position in the world the player clicked on | *'''worldPosY''': The Y position in the world the player clicked on. | ||
*'''worldPosZ''': The Z position in the world the player clicked on | *'''worldPosZ''': The Z position in the world the player clicked on. | ||
*'''screenPosX''': The X position on the screen 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 | *'''screenPosY''': The Y position on the screen the player clicked on. | ||
==Source== | ==Source== |
Revision as of 21:27, 2 April 2018
This event is triggered when a player clicks using the mouse cursor.
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.
- worldPosY: The Y position in the world the player clicked on.
- worldPosZ: 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 outputs the state of the button they just pressed.
function outputClick(mouseButton,buttonState) outputChatBox("Your "..mouseButton.." mouse button is now "..buttonState,source,255,255,0) -- output the state of the button they just pressed. end addEventHandler("onPlayerClick",getRootElement(),outputClick) -- When a player clicks trigger the outputClick function
See Also
Player events
- onPlayerACInfo
- onPlayerBan
- onPlayerChangeNick
- onPlayerChat
- onPlayerClick
- onPlayerCommand
- onPlayerConnect
- onPlayerContact
- onPlayerDamage
- onPlayerJoin
- onPlayerLogin
- onPlayerLogout
- onPlayerMarkerHit
- onPlayerMarkerLeave
- onPlayerModInfo
- onPlayerMute
- onPlayerNetworkStatus
- onPlayerPickupHit
- onPlayerPickupLeave
- onPlayerPickupUse
- onPlayerPrivateMessage
- onPlayerQuit
- onPlayerScreenShot
- onPlayerSpawn
- onPlayerStealthKill
- onPlayerTarget
- onPlayerUnmute
- onPlayerVehicleEnter
- onPlayerVehicleExit
- onPlayerVoiceStart
- onPlayerVoiceStop
- onPlayerWasted
- onPlayerWeaponFire
- onPlayerWeaponSwitch
Event functions
- addEvent
- addEventHandler
- cancelEvent
- cancelLatentEvent
- getEventHandlers
- getLatentEventHandles
- getLatentEventStatus
- removeEventHandler
- triggerEvent
- wasEventCancelled