SA-MP Forums Archive
Retrieve a vehicles colour ids? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Retrieve a vehicles colour ids? (/showthread.php?tid=110961)



Retrieve a vehicles colour ids? - CHC - 29.11.2009

I am searching for a function which retrieves a vehicles colour id, but I cannot find any, does anyone know one?


Re: Retrieve a vehicles colour ids? - GTA_Rules - 29.11.2009

I don't think there's a native.


Re: Retrieve a vehicles colour ids? - MJ! - 29.11.2009

You can use OnVehicleRespray ...
pawn Код:
// Top of script
new V_Colors[2][MAX_VEHICLES];

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
  V_Colors[0][vehicleid] = color1;
  V_Colors[1][vehicleid] = color2;
  return 1;
}

//OnPlayerCommandText
if(!strcmp(cmdtext,"/vehiclecolor",true))
{
  format(string,sizeof string,"First Color - %d | 2nd Color - %d",V_Colors[0][GetPlayerVehicleID(playerid)],V_Colors[1][GetPlayerVehicleID(playerid)]);
  SendClientMessage(playerid,0xCCAABBDD,string);
}
When you go to change your car color , change it , then type /vehiclecolor , copy the hexa code and in script do this

pawn Код:
//OnPlayerCommandText
if(!strcmp(cmdtext,"/vehiclecolor",true))
{
  if(V_Colors[0][GetPlayerVehicleID(playerid)] == 0x_YOUR_CODE_FROM_PAINTJOB)
  {
     format(string,sizeof string,"First color - %s","red/or what color it is");
     return SendClientMessage(playerid,0xFFFFFFFF,string);
  }
  format(string,sizeof string,"First Color - %d | 2nd Color - %d",V_Colors[0][GetPlayerVehicleID(playerid)],V_Colors[1][GetPlayerVehicleID(playerid)]);
  SendClientMessage(playerid,0xCCAABBDD,string);
}