SetControlState: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
JonChappell (talk | contribs) mNo edit summary |
||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
Sets a state of a specified player's control, as if they pressed or | Sets a state of a specified player's control, as if they pressed or released it themselves. | ||
==Syntax== | ==Syntax== |
Revision as of 18:39, 7 July 2006
Sets a state of a specified player's control, as if they pressed or released it themselves.
Syntax
bool setControlState ( player thePlayer, string control, bool state )
Required Arguments
- thePlayer: The player you wish to set the control state of.
- control: The control that you want to set the state of.
- state: A boolean value representing whether or not the key will be set to pressed or not.
Example
This example will disable the use of the accelerate, brake/reverse and handbrake keys, then force the accelerate on for any player who enters a vehicle.
addEventHandler ( "onPlayerEnterVehicle", root, "onPlayerEnterVehicle" ) function onPlayerEnterVehicle ( theVehicle, seat, jacked ) toggleControl ( source, "accelerate", false ) -- disable the accelerate key toggleControl ( source, "brake_reverse", false ) -- disable the brake_reverse key toggleControl ( source, "handbrake", false ) -- disable the handbrake key setControlState ( source, "accelerate", true ) -- force the accelerate key on end
See Also
- addCommandHandler
- bindKey
- executeCommandHandler
- getCommandHandlers
- getFunctionsBoundToKey
- getKeyBoundToFunction
- isControlEnabled
- removeCommandHandler
- toggleAllControls
- toggleControl
- unbindKey