ToggleAllControls: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 12: | Line 12: | ||
This function will disable the use of all controls for a freeze function, which will be used everytime someone enters a vehicle. | This function will disable the use of all controls for a freeze function, which will be used everytime someone enters a vehicle. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function freezeThisDude ( | function freezeThisDude ( thePlayer, time ) | ||
toggleAllControls ( | toggleAllControls ( thePlayer, false ) -- disable this players controls | ||
setTimer ( "toggleAllControls", time, 1, | setTimer ( "toggleAllControls", time, 1, thePlayer, true ) -- enable this players controls after the specified time | ||
end | end | ||
addEventHandler ( "onPlayerEnterVehicle", root, "onPlayerEnterVehicle" ) | addEventHandler ( "onPlayerEnterVehicle", root, "onPlayerEnterVehicle" ) | ||
function onPlayerEnterVehicle ( | function onPlayerEnterVehicle ( theVehicle, seat, jacked ) | ||
freezeThisDude ( source, 5000 ) -- 'freeze' him for 5000ms/5secs | freezeThisDude ( source, 5000 ) -- 'freeze' him for 5000ms/5secs | ||
end | end |
Revision as of 20:43, 6 July 2006
Enables or disables the use of a all gta controls for a specified player.
Syntax
bool toggleAllControls ( player thePlayer, bool enabled )
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 for a freeze function, which will be used everytime someone enters a vehicle.
function freezeThisDude ( thePlayer, time ) toggleAllControls ( thePlayer, false ) -- disable this players controls setTimer ( "toggleAllControls", time, 1, thePlayer, true ) -- enable this players controls after the specified time end addEventHandler ( "onPlayerEnterVehicle", root, "onPlayerEnterVehicle" ) function onPlayerEnterVehicle ( theVehicle, seat, jacked ) freezeThisDude ( source, 5000 ) -- 'freeze' him for 5000ms/5secs end
See Also
- addCommandHandler
- bindKey
- executeCommandHandler
- getCommandHandlers
- getFunctionsBoundToKey
- getKeyBoundToFunction
- isControlEnabled
- removeCommandHandler
- toggleAllControls
- toggleControl
- unbindKey