OnVehicleRespray

OnVehicleRespray

Description:
Callback OnVehicleRespray 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.
Known Bug(s): previewing a component inside a mod shop might call this callback.
  • Callback OnVehicleRespray is not called by ChangeVehicleColor.
  • Misleadingly, this callback is not called for pay 'n' spray (only modshops).
  • Fix here: http://pastebin.com/G81da7N1


Parameters:
(playerid, vehicleid, color1, color2)
int playerid The ID of the player that is driving the vehicle.
int vehicleid The ID of the vehicle that was resprayed.
int color1 The color that the vehicle's primary color was changed to.
int 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.


Examples:
{
    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 Callbacks
The following callbacks might be useful as well, as they are related to this callback in one way or another.


Related Functions
The following functions may be useful, as they are related to this function in one way or another.