AddVehicleComponent

From SA-MP Wiki

Jump to: navigation, search

AddVehicleComponent


When using this function your able to add components (parts) to your vehicle created with AddStaticVehicle, AddStaticVehicleEx or CreateVehicle. ComponentID's can be found here.


Parameters:
(vehicleid, componentid)
vehicleidThe ID of the vehicle, not the modelid.
componentidThe componentid that needs to be added to the vehicle.


Important Note: Using a invalid componentid crashes the game.


This function does not return a specific value.


new vehicle;
 
public OnGameModeInit( )
{
    vehicle = AddStaticVehicle(420,-2482.4937,2242.3936,4.6225,179.3656,6,1); // Taxi
    return 1;
}
 
public OnPlayerEnterVehicle (playerid, vehicleid)
{
    if (vehicleid == vehicle)
    {
        AddVehicleComponent(vehicle, 1010); // Nitro
        SendClientMessage(playerid, 0xFFFFFFAA, "Nitro added to the Taxi.");
    }
    return 1;
}

Related Functions

The following functions might be useful as well, as they're related to this function in one way or another.


Related Callbacks

The following callbacks might be useful, as they're related to this function in one way or another.

Personal tools
In other languages