GetVehicleComponentInSlot
From SA-MP Wiki
(Difference between revisions)
Revision as of 02:45, 7 November 2017 RIDE2DAY (Talk | contribs) ← Previous diff |
Current revision Dugi (Talk | contribs) (revert) |
||
Line 1: | Line 1: | ||
{{Scripting}} | {{Scripting}} | ||
+ | |||
{{0.3Added|function|}} | {{0.3Added|function|}} | ||
Line 15: | Line 16: | ||
* Both rear bull bars and rear bumper components are saved in the ''CARMODTYPE_REAR_BUMPER'' slot. If a vehicle has both of them installed, this function will only return the one which was installed last. | * Both rear bull bars and rear bumper components are saved in the ''CARMODTYPE_REAR_BUMPER'' slot. If a vehicle has both of them installed, this function will only return the one which was installed last. | ||
* Both left side skirt and right side skirt are saved in the ''CARMODTYPE_SIDESKIRT'' slot. If a vehicle has both of them installed, this function will only return the one which was installed last.}} | * Both left side skirt and right side skirt are saved in the ''CARMODTYPE_SIDESKIRT'' slot. If a vehicle has both of them installed, this function will only return the one which was installed last.}} | ||
- | |||
- | {{tip|You might avoid the previous bugs using [https://goo.gl/GnA1j5 vSync].}} | ||
{{Example}} | {{Example}} |
Current revision
Description:
Retrieves the installed component ID (modshop mod(ification)) on a vehicle in a specific slot.
(vehicleid, slot)
vehicleid | The ID of the vehicle to check for the component. |
slot | The component slot to check for components. |
Return Values:
The ID of the component installed in the specified slot. Returns 0 if no component in specified vehicle's specified slot, or if vehicle doesn't exist.
Example Usage:
public OnPlayerCommandText(playerid, cmdtext[]) { if (!strcmp("/myspoiler", cmdtext) && IsPlayerInAnyVehicle(playerid)) { new component; component = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), CARMODTYPE_SPOILER); if (component == 1049) { SendClientMessage(playerid,0xFFFFFFFF,"You have an Alien spoiler installed in your Elegy!"); } } }
[edit]
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.
- GetVehicleComponentType: Check the type of component via the ID.
[edit]
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 enters or exits a mod shop.