SA-MP Forums Archive
How to get Vehicles Color? - 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: How to get Vehicles Color? (/showthread.php?tid=149584)



How to get Vehicles Color? - NewTorran - 22.05.2010

Hello,
How would i get the vehicles color?
Lets say, I made a command /myvehcolor
And my vehicle color was 1, 15
And when i typed that command it said 1, 15
If i set it to 50, 12,
And then typed command it would say that,
So how do i get the vehicles color? I cant find a GetVehicleColor function or anything


Re: How to get Vehicles Color? - ViruZZzZ_ChiLLL - 22.05.2010

nvm... sorry..


Re: How to get Vehicles Color? - dice7 - 22.05.2010

pawn Код:
new VehColors[MAX_VEHICLES][2];

 public OnGameModeInit()
 {
    for (new i = 1; i <= MAX_VEHICLES; i++)
    {
        new
            col1 = random(128),
            col2 = random(128);
        SetVehicleColor(i, col1, col2);
        VehColors[i][0] = col1;
        VehColors[i][1] = col2;
    }
    return 0;
 }

 GetVehicleColor(vehicleid, &color1, &color2)
 {
    color1 = VehColors[vehicleid][0];
    color2 = VehColors[vehicleid][1];
 }



Re: How to get Vehicles Color? - NewTorran - 22.05.2010

Quote:
Originally Posted by dice7
pawn Код:
new VehColors[MAX_VEHICLES][2];

 public OnGameModeInit()
 {
    for (new i = 1; i <= MAX_VEHICLES; i++)
    {
        new
            col1 = random(128),
            col2 = random(128);
        SetVehicleColor(i, col1, col2);
        VehColors[i][0] = col1;
        VehColors[i][1] = col2;
    }
    return 0;
 }

 GetVehicleColor(vehicleid, &color1, &color2)
 {
    color1 = VehColors[vehicleid][0];
    color2 = VehColors[vehicleid][1];
 }
Thanks


Re: How to get Vehicles Color? - W00Z - 22.05.2010

It also include fulfilling the same function


Re: How to get Vehicles Color? - dice7 - 22.05.2010

Note that this wont work if you use ChangeVehicleColor. Just create a custom function which changes the vehicles color and updates the vehicle color array at the same time


Re: How to get Vehicles Color? - Joe_ - 22.05.2010

Yes however it doesn't save it into an array or there isn't any GetPlayerColor, that's why this is a good alternative, if all of your cars spawn with random colours.

(not good for factions/jobcars etc that require all one colour)


Re: How to get Vehicles Color? - NewTorran - 22.05.2010

Well im using it for like a vehicle ownership thing,
So the vehicles colour saves to a file