How to get Vehicles Color?
#1

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
Reply
#2

nvm... sorry..
Reply
#3

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];
 }
Reply
#4

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
Reply
#5

It also include fulfilling the same function
Reply
#6

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
Reply
#7

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)
Reply
#8

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


Forum Jump:


Users browsing this thread: 1 Guest(s)