OnVehicleRespray
From SA-MP Wiki
(Difference between revisions)
Revision as of 11:50, 19 October 2017 RIDE2DAY (Talk | contribs) ← Previous diff |
Revision as of 11:57, 20 October 2017 RIDE2DAY (Talk | contribs) Next diff → |
||
Line 16: | Line 16: | ||
{{note| | {{note| | ||
* This callback is not called by [[ChangeVehicleColor]]. | * This callback is not called by [[ChangeVehicleColor]]. | ||
- | * You might enable this callback for Pay 'n' Spray shops using [https://goo.gl/GnA1j5 vSync by RIDE2DAY].}} | + | * You might enable this callback for Pay 'n' Spray shops and avoid the previous bug using [https://goo.gl/GnA1j5 vSync].}} |
{{Example}} | {{Example}} |
Revision as of 11:57, 20 October 2017
Description:
This callback is called when a player exits a mod shop, even if the colors weren't changed. Watch out, the name is ambiguous, Pay 'n' Spray shops don't call this callback.
(playerid, vehicleid, color1, color2)
playerid | The ID of the player that is driving the vehicle. |
vehicleid | The ID of the vehicle that was resprayed. |
color1 | The color that the vehicle's primary color was changed to. |
color2 | The color that the vehicle's secondary color was changed to. |
Return Values:
Returning 0 in this callback will deny the colour change. Returning 1 will allow it. This can be used to prevent hackers from changing vehicle colours using cheats.
- It is always called first in gamemode so returning 0 there also blocks other filterscripts from seeing it.
![]() Note |
|
Example Usage:
public OnVehicleRespray(playerid, vehicleid, color1, color2) { new string[48]; format(string, sizeof(string), "You resprayed vehicle %d to colors %d and %d!", vehicleid, color1, color2); SendClientMessage(playerid, COLOR_GREEN, string); return 1; }
Related Functions
The following functions might be useful, as they're related to this callback in one way or another.
- ChangeVehicleColor: Set the color of a vehicle.
- ChangeVehiclePaintjob: Change the paintjob on a vehicle.
Related Callbacks
The following callbacks might be useful as well, as they are related to this callback in one way or another.
- OnVehiclePaintjob: Called when a vehicle's paintjob is changed.
- OnVehicleMod: Called when a vehicle is modded.
- OnEnterExitModShop: Called when a vehicle enters or exits a mod shop.