SA-MP Forums Archive
random car colours - 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: random car colours (/showthread.php?tid=30750)



random car colours - winker2k6 - 19.03.2008

hi
i wanted to make my cars spawn with random hidden colours from this list
and i wanted to know if there was any way of doing this
couldn't find anything from search


Re: random car colours - Pixels^ - 19.03.2008

Use an array;
pawn Код:
#define tColors 2  //Number of colors
new vColor[tColors][1] = {
{1}, //color1
{2} //color2
};



Re: random car colours - winker2k6 - 19.03.2008

then what do i put on addstaticvehicle


Re: random car colours - winker2k6 - 19.03.2008

can you give a full command list with an example


Re: random car colours - Pixels^ - 19.03.2008

Your just like all other noobs, won't bother to read pawn-lang.pdf.
pawn Код:
new rColor = random(sizeof(vColor));
AddStaticVehicle(451,1000,1000,15,280,vColor[rColor][0],vColor[rColor][0]);
pawn Код:
//above main()
#define tColors 2  //Number of colors
new vColor[tColors][1] = {
{1}, //color1
{2} //color2
};



Re: random car colours - wafffllesss - 20.03.2008

Quote:
Originally Posted by Winker2k6
hi
i wanted to make my cars spawn with random hidden colours from this list
and i wanted to know if there was any way of doing this
couldn't find anything from search
AddStaticVehicle(modelid, Floatpawn_x, Floatpawn_y,Floatpawn_z, Float:angle, -1, -1);


Re: random car colours - winker2k6 - 20.03.2008

Quote:
Originally Posted by wafffllesss
AddStaticVehicle(modelid, Floatpawn_x, Floatpawn_y,Floatpawn_z, Float:angle, -1, -1);
Ok, I Never explained fully what i wanted:
What i want to do is to be able to select these colors and insert them to the addstaticvehicles so For example, I Want this to give random colors when a player approaches or the server map changes, Because its a common stunt server and people like it, many people have requested it.

Thanks for any help.

PS. Currently I Currently Get a major application error when compiling, As soon as i add this, with the other its ok, but soon as this hits the pwn file, its errors. Can you check if its ok, I Noticed "tColor" shouldnt that be rColor?
pawn Код:
#define tColors 2
pawn Код:
new vColor[tColors][1] = {
pawn Код:
new rColor = random(sizeof(vColor));
AddStaticVehicle(451,1000,1000,15,280,vColor[rColor][0],vColor[rColor][0]);
The error i get
Код:
---------------------------
pawncc.exe - Application Error
---------------------------
The instruction at "0x100119ec" referenced memory at "0x00000044". The memory could not be "read".



Re: random car colours - winker2k6 - 20.03.2008

sorry for the double post but will anyone be able to help me


Re: random car colours - [BrOoklYn_bEasT] - 16.09.2009

ok man....try saving and compiling all your code into a different directory,like i sometimes get this very same error also,i open my script that wont compile,i do select all - copy - then i hit the new button,when the new fresh script is shown i again, select all and paste my code over the bare code...then after that the error is gone.hope this helps you out other than the freakin people callin ya a noob.