GetVehicleComponentType
Description:
Function GetVehicleComponentType find out what type of component a certain ID is.
Function GetVehicleComponentType was added in 0.3a and will not work in earlier versions! |
Parameters:
(component)
int | component | The component ID to check. |
Return Values:
The component slot ID of the specified component or -1 if the component is invalid.
Examples:
public OnVehicleMod(playerid, vehicleid, componentid) { new componentType = GetVehicleComponentType(componentid); if(componentType != -1) { new clientMessage[41]; format(clientMessage, sizeof(clientMessage), "You have modified your vehicle on slot %i", componentType); SendClientMessage(playerid, 0xFFFFFFFF, clientMessage); } else { SendClientMessage(playerid, 0xFF0000FF, "The component is invalid."); } return 1; }
Related Functions
The following functions may be useful, as they are related to this function in one way or another.
- AddVehicleComponent: Add a component to a vehicle.
- RemoveVehicleComponent: Remove a component from a vehicle.
- GetVehicleComponentInSlot: Check what components a vehicle has.
Related Callbacks
The following callbacks might be useful as well, as they are related to this callback in one way or another.
- OnVehicleMod: Called when a vehicle is modded.
- OnEnterExitModShop: Called when a vehicle enters or exits a mod shop.