06.09.2018, 17:36
Hello, I do not know if you ever tried to get the primary and secondary color of a vehicle, there is an include for this but it is not necessary, here I give you a very quick way of doing this.
Step 1
Step 2
Replace all CreateVehicle to CreateVehicleEx and add this function
The parameters of CreateVehicle and CreateVehicleEx are the same.
Example of use
Step 1
Code:
new Color[MAX_VEHICLES][2];
Replace all CreateVehicle to CreateVehicleEx and add this function
Code:
CreateVehicleEx(vehicletype, Float:x, Float:y, Float:z, Float:rotation, color1, color2, respawn_delay, bool:addsiren = false)
{
new vehiclespawned = INVALID_VEHICLE_ID;
vehiclespawned = CreateVehicle(vehicletype, Float:x, Float:y, Float:z, Float:rotation, color1, color2, respawn_delay, addsiren);
Color[vehiclespawned][0] = color1;
Color[vehiclespawned][1] = color2;
printf("Vehicled spawned > Model: %d / C1: %d / C2: %d.", vehicletype, Color[vehiclespawned][0], Color[vehiclespawned][1]);
return vehiclespawned;
}
Example of use
Code:
CMD:obtenercolor(playerid, params[])
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) // If you are a driver of any vehicle.
{
new autito = GetPlayerVehicleID(playerid);
SendClientMessage(playerid, -1, "Hello, the colors of your vehicle are:");
new str[32];
format(str, sizeof(str), "Primary: %d / Secondary: %d", Color[autito][0], Color[autito][1]);
SendClientMessage(playerid, -1, str);
}
return 1;
}

