RemoveVehicleUpgrade: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
m (normalize page to match others)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
__NOTOC__
{{Server client function}}
{{Server client function}}
__NOTOC__
==Description==
This function removes an already existing upgrade from the specified vehicle, eg: nos, hydraulics. Defined in San Andreas\data\maps\veh_mods\veh_mods.ide.
This function removes an already existing upgrade from the specified vehicle, eg: nos, hydraulics. Defined in San Andreas\data\maps\veh_mods\veh_mods.ide.


Line 22: Line 21:
     if ( theVehicle ) then
     if ( theVehicle ) then
         addVehicleUpgrade ( theVehicle, 1010 )    -- NOS 10x
         addVehicleUpgrade ( theVehicle, 1010 )    -- NOS 10x
        removeVehicleUpgrade ( theVehicle, 1010 )
     end
     end
end
end
Line 43: Line 41:
     if ( theVehicle ) then
     if ( theVehicle ) then
         addVehicleUpgrade ( theVehicle, 1010 )    -- NOS 10x
         addVehicleUpgrade ( theVehicle, 1010 )    -- NOS 10x
        removeVehicleUpgrade ( theVehicle, 1010 )
     end
     end
end
end

Latest revision as of 08:03, 5 August 2021

This function removes an already existing upgrade from the specified vehicle, eg: nos, hydraulics. Defined in San Andreas\data\maps\veh_mods\veh_mods.ide.

Syntax

bool removeVehicleUpgrade ( vehicle theVehicle, int upgrade )

Required Arguments

  • theVehicle: The element representing the vehicle you wish to remove the upgrade from
  • upgrade: The ID of the upgrade you wish to remove.

Returns

Returns true if the upgrade was successfully removed from the vehicle, otherwise false.

Example

Click to collapse [-]
Server

This script defines a 'nos' console command that adds a NOS upgrade to the vehicle that the player who executes the command is sitting in. It also adds a 'removenos' command which allows removal of a player's nos.

function addNOS ( sourcePlayer, command )
    theVehicle = getPlayerOccupiedVehicle ( sourcePlayer )
    if ( theVehicle ) then
        addVehicleUpgrade ( theVehicle, 1010 )     -- NOS 10x
    end
end
addCommandHandler ( "nos", addNOS )

function remNOS ( sourcePlayer, command )
    theVehicle = getPlayerOccupiedVehicle ( sourcePlayer )
    if ( theVehicle ) then
        removeVehicleUpgrade ( theVehicle, 1010 )
    end
end
addCommandHandler ( "removenos", remNOS )
Click to expand [+]
Client

See Also