---
title: "ChangeVehicleColor | open.mp"
description: "Change a vehicle's primary and secondary colors."
canonical: https://omp.itsneufox.com/th/docs/scripting/functions/ChangeVehicleColor
language: th
---

# ChangeVehicleColor

## คำอธิบาย

Change a vehicle's primary and secondary colors.

| Name | Description |
| --- | --- |
| vehicleid | The ID of the vehicle to change the colors of. |
| color1 | The new vehicle's primary color ID. |
| color2 | The new vehicle's secondary color ID. |

## ส่งคืน

1: The function executed successfully. The vehicle's color was successfully changed.

0: The function failed to execute. The vehicle does not exist.

## ตัวอย่าง

```c
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    // Change the primary color to black and the secondary color to white
    ChangeVehicleColor(vehicleid, 0, 1);
    return 1;
}
```

## บันทึก

หมายเหตุ

Some vehicles have only a primary color and some can not have the color changed at all. A few (cement, squallo) have 4 colors, of which 2 can not be changed in SA:MP

## ฟังก์ชั่นที่เกี่ยวข้องกัน

-   [ChangeVehiclePaintjob](https://omp.itsneufox.com/th/docs/scripting/functions/ChangeVehiclePaintjob): Change the paintjob on a vehicle.
-   [OnVehicleRespray](https://omp.itsneufox.com/th/docs/scripting/callbacks/OnVehicleRespray): Called when a vehicle is resprayed.
