AddVehicleComponent
From SA-MP Wiki
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.
(vehicleid, componentid)
| vehicleid | The ID of the vehicle, not the modelid. |
| componentid | The 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.
- RemoveVehicleComponent: Remove a component from a vehicle.
- GetVehicleComponentInSlot: Check what components a vehicle has.
- GetVehicleComponentType: Check the type of component via the ID.
Related Callbacks
The following callbacks might be useful, as they're related to this function in one way or another.
- OnVehicleMod: Called when a vehicle is modded.
- OnEnterExitModShop: Called when a vehicle enter or exit mod shop.
