SetControlState: Difference between revisions
Jump to navigation
Jump to search
(→Syntax) |
|||
Line 38: | Line 38: | ||
function onClientPlayerEnterVehicle ( theVehicle, seat, jacked ) | function onClientPlayerEnterVehicle ( theVehicle, seat, jacked ) | ||
toggleControl ( | toggleControl ( "accelerate", false ) -- disable the accelerate key | ||
toggleControl ( | toggleControl ( "brake_reverse", false ) -- disable the brake_reverse key | ||
toggleControl ( | toggleControl ( "handbrake", false ) -- disable the handbrake key | ||
setControlState ( | setControlState ( "accelerate", true ) -- force the accelerate key on | ||
end | end | ||
addEventHandler ( "onClientPlayerVehicleEnter", getRootElement(), onClientPlayerEnterVehicle ) | addEventHandler ( "onClientPlayerVehicleEnter", getRootElement(), onClientPlayerEnterVehicle ) |
Revision as of 11:37, 11 August 2007
Sets a state of a specified player's control, as if they pressed or released it.
Syntax
Click to collapse [-]
Serverbool setControlState ( player thePlayer, string control, bool state )
Click to collapse [-]
Clientbool setControlState ( 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. See control names for a list of possible controls.
- state: A boolean value representing whether or not the key will be set to pressed or not.
Returns
Returns 'true' if the control state was successfully set, 'false' otherwise.
Click to expand [+]
ServerClick to expand [+]
ClientSee Also
- addCommandHandler
- bindKey
- executeCommandHandler
- getCommandHandlers
- getFunctionsBoundToKey
- getKeyBoundToFunction
- isControlEnabled
- removeCommandHandler
- toggleAllControls
- toggleControl
- unbindKey