SetVehicleGunsEnabled: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
{{Server client function}}
{{Server client function}}
{{Needs_Checking|This is not a valid function (tested in 1.0.5) server side and client side --Qais}}
__NOTOC__
__NOTOC__
This function enables or disables the weapons on a vehicle
This function enables or disables the weapons on a vehicle

Revision as of 06:17, 30 July 2011

Dialog-information.png This article needs checking.

Reason(s): This is not a valid function (tested in 1.0.5) server side and client side --Qais

This function enables or disables the weapons on a vehicle

Syntax

bool setVehicleGunsEnabled ( vehicle theVehicle, bool gunsEnabled )

Required Arguments

  • theVehicle: The element representing the vehicle whose guns you want to toggle.
  • gunsEnabled: A bool representing whether guns are enabled or disabled. false will disable them, true will enable them.

Returns

Returns true if the guns were toggled succesfully, false if arguments passed were invalid.

Example

Click to collapse [-]
Example 1

This function will disables the ability to fire rockets on a hydra.

function disableFireForHydra ( theVehicle, seat, jacked )
    if ( getElementModel ( theVehicle ) == 520 ) then -- if they entered a hydra
        setVehicleGunsEnabled ( theVehicle, false ) -- disable their guns
    else -- if they entered another vehicle
        setVehicleGunsEnabled ( theVehicle, true ) -- enable their guns
    end
end
addEventHandler ( "onPlayerVehicleEnter", getRootElement(), disableFireForHydra )
Click to expand [+]
Example 2

See Also