ToggleAllControls: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
mNo edit summary |
||
Line 13: | Line 13: | ||
This function will disable the use of all controls in order to freeze a player, which will be used every time someone enters a vehicle. | This function will disable the use of all controls in order to freeze a player, which will be used every time someone enters a vehicle. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function freezeThisDude ( thePlayer, | function freezeThisDude ( thePlayer, freezeTime ) | ||
toggleAllControls ( thePlayer, false ) -- disable this | toggleAllControls ( thePlayer, false ) -- disable this player's controls | ||
setTimer ( toggleAllControls, | setTimer ( toggleAllControls, freezeTime, 1, thePlayer, true ) -- enable this player's controls after the specified time | ||
end | end | ||
function onPlayerEnterVehicle ( theVehicle, seat, jacked ) | function onPlayerEnterVehicle ( theVehicle, seat, jacked ) | ||
freezeThisDude ( source, 5000 ) -- 'freeze' him for 5000ms | freezeThisDude ( source, 5000 ) -- 'freeze' him for 5000ms = 5 seconds | ||
end | end | ||
addEventHandler ( "onPlayerEnterVehicle", root, onPlayerEnterVehicle ) | addEventHandler ( "onPlayerEnterVehicle", root, onPlayerEnterVehicle ) |
Revision as of 18:03, 21 August 2007
Enables or disables the use of all GTA controls for a specified player.
Syntax
bool toggleAllControls ( player thePlayer, bool enabled, [bool gtaContols=true, bool mtaControls=true] )
Required Arguments
- thePlayer: The player you wish to toggle the control ability of.
- enable: A boolean value representing whether or not the controls will be usable or not.
Example
This function will disable the use of all controls in order to freeze a player, which will be used every time someone enters a vehicle.
function freezeThisDude ( thePlayer, freezeTime ) toggleAllControls ( thePlayer, false ) -- disable this player's controls setTimer ( toggleAllControls, freezeTime, 1, thePlayer, true ) -- enable this player's controls after the specified time end function onPlayerEnterVehicle ( theVehicle, seat, jacked ) freezeThisDude ( source, 5000 ) -- 'freeze' him for 5000ms = 5 seconds end addEventHandler ( "onPlayerEnterVehicle", root, onPlayerEnterVehicle )
See Also
- addCommandHandler
- bindKey
- executeCommandHandler
- getCommandHandlers
- getFunctionsBoundToKey
- getKeyBoundToFunction
- isControlEnabled
- removeCommandHandler
- toggleAllControls
- toggleControl
- unbindKey