12.09.2009, 12:04
I'm sorry if this has been covered before, but is it possible to find a cars colour in a script, for example GetVehicleColour()
thanks.
thanks.
Originally Posted by x-unit
Use this it can help you : http://forum.sa-mp.com/index.php?action=search
|
static Colors[MAX_VEHICLES][2];
stock CreateVehicleX(model, Float:x, Float:y, Float:z, Float:a, color1, color2, respawn) {
new v;
v = CreateVehicle(model, x, y, z, a, color1, color2, respawn);
Colors[v][0] = color1;
Colors[v][1] = color2;
return v;
}
new carcolor[MAX_VEHICLES][2]
stock SetVehicleColor(vehicleid, color1, color2)
{
ChangeVehicleColor(vehicleid, color1, color2);
carcolor[vehicleid][0] = color1;
carcolor[vehicleid][1] = color2;
}
stock GetVehicleColor(vehicleid, bool:primary) return primary?carcolor[vehicleid][0]:carcolor[1][vehicleid];
/*if the second parameter is true, it will return the primary color, else secondary*/
Originally Posted by TimmehBoy
No, you have to make your own function(s).
|
new CarColour[256]; ..... public OnGameModeInit() { ColourAddStaticVehicle(476,-1657.362061,-155.683640,15.318590, 270,1,1); ColourAddStaticVehicle(476,-1647.219849,-165.189056,15.318590, 270,1,1); return 1; } ..... stock FindCarColour(playerid) { if (!IsPlayerConnected(playerid) || !IsPlayerInAnyVehicle(playerid)) return 0; return CarColour[GetPlayerVehicleID(playerid)]; } stock ColourAddStaticVehicle(ModelID,Float:spawn_X,Float:spawn_Y,Float:spawn_Z, Float:zangle, C1,C2) { new carID; carID = AddStaticVehicle(ModelID,spawn_X,spawn_Y,spawn_Z,zangle,C1,C2); CarColour[carID] = C1; return carID; }