SA-MP Forums Archive
Get Player color and change vehicle color to the player 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)
+--- Thread: Get Player color and change vehicle color to the player color (/showthread.php?tid=580196)



Get Player color and change vehicle color to the player color - gurmani11 - 03.07.2015

Hi again!
I want to change the color of vehicle to the color of player when he enters a vehicle
i did a try but i failed, is there anyone who can help me making this?


pawn Code:
new x[50] = GetPlayerColor(playerid);  = error 008: must be a constant expression; assumed zero
    new color = strval(x);                        
    ChangeVehicleColor(vehicleid, color , color );



Re: Get Player color and change vehicle color to the player color - Rien - 03.07.2015

new color = GetPlayerColor(Playerid);
ChangeVehicleColor(vehicleid, color , color );

work?


Re: Get Player color and change vehicle color to the player color - gurmani11 - 03.07.2015

nope it did not i already checked it


Re: Get Player color and change vehicle color to the player color - Vince - 03.07.2015

It doesn't work like that. Car color ids do not relate to the color circle; they're just arbitrarily assigned by Rockstar Games. There are 16,777,216 different colors and yet only 256 car colors. Unless you use ONLY the colors defined at the bottom of this page, there is no way (or at least not an easy way) to map them back to a car color.


Re: Get Player color and change vehicle color to the player color - gurmani11 - 03.07.2015

Understood.
Thanks.