---
title: "OnVehicleRespray | open.mp"
description: "This callback is called when a player exits a mod shop, even if the colors weren't changed."
canonical: https://open.mp/docs/scripting/callbacks/OnVehicleRespray
language: en
---

# OnVehicleRespray

## 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.

| Name | Description |
| --- | --- |
| 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. |

## Returns

Returning **0** in this callback will deny the colour change. Returning **1** will allow it.

It is always called first in gamemode so returning 0 there also blocks other filterscripts from processing it.

## Examples

```c
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;
}
```

## Notes

note

This callback is not called by ChangeVehicleColor. Misleadingly, this callback is not called for pay 'n' spray (only modshops).

Fix here: [https://pastebin.com/G81da7N1](https://pastebin.com/G81da7N1)

warning

**Known Bug(s):** Previewing a component inside a mod shop might call this callback.

## Related Callbacks

The following callbacks might be useful, as they're related to this callback in one way or another.

-   [OnVehiclePaintjob](https://open.mp/docs/scripting/callbacks/OnVehiclePaintjob): This callback is called when a vehicle's paintjob is changed.
-   [OnVehicleMod](https://open.mp/docs/scripting/callbacks/OnVehicleMod): This callback is called when a vehicle is modded.
-   [OnEnterExitModShop](https://open.mp/docs/scripting/callbacks/OnEnterExitModShop): This callback is called when a vehicle enters or exits a mod shop.

## Related Functions

The following functions might be useful, as they're related to this callback in one way or another.

-   [ChangeVehicleColor](https://open.mp/docs/scripting/functions/ChangeVehicleColor): Set the color of a vehicle.
-   [ChangeVehiclePaintjob](https://open.mp/docs/scripting/functions/ChangeVehiclePaintjob): Change the paintjob on a vehicle.
