SA-MP Forums Archive
Simple help me please - 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: Simple help me please (/showthread.php?tid=273555)



Simple help me please - Davz*|*Criss - 02.08.2011

Hey guys i am creating a function like.

Onvehiclespawn

it sets its color to

ChangeVehicleColor(vehicleid, 151, 117);

or
ChangeVehicleColor(vehicleid, 144, 146);
or
ChangeVehicleColor(vehicleid, 6, 7);

I mean like else setthiscolor else setthiscolor

Like different colors

Because in my GM all AddStaticVehicle colors are white.

So i am trying this.

Please help me.


Re: Simple help me please - Sascha - 02.08.2011

you could actually just use "-1, -1" as color id for all vehicles.. that's a (more or less) random color...
else just try this code (under OnVehicleSpawn)...
pawn Код:
new ran = random(3);
if(ran == 0) ChangeVehicleColor(vehicleid, 151, 117);
else if(ran == 1) ChangeVehicleColor(vehicleid, 144, 146);
else if(ran == 2) ChangeVehicleColor(vehicleid, 6, 7);
return 1;
(there are other ways to do it but this is the simpliest code to understand I guess)...
however remember that this function won't be called when the server loads and all vehicles spawn...
OnVehicleSpawn gets just called when a vehicle actually respawns..


Re: Simple help me please - Davz*|*Criss - 02.08.2011

Thanks very much Sascha I HIT THE STAR. Good luck