ToggleAllControls

From Multi Theft Auto: Wiki
Revision as of 20:01, 6 July 2006 by MrJax (talk | contribs)
Jump to navigation Jump to search

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 ( player, time )
  toggleAllControls ( player, false ) -- disable this players controls
  setTimer ( "toggleAllControls", time, 1, player, true ) -- enable this players controls after the specified time
end

addEventHandler ( "onPlayerEnterVehicle", root, "onPlayerEnterVehicle" )
function onPlayerEnterVehicle ( vehicle, seat, jacked )
  freezeThisDude ( source, 5000 ) -- 'freeze' him for 5000ms/5secs
end

See Also