SA-MP Forums Archive
[Q] Array Problem Involving random skins - 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: [Q] Array Problem Involving random skins (/showthread.php?tid=87264)



[Q] Array Problem Involving random skins - [ERP]Snow - 19.07.2009

Code:
new Police[7][1] =
{
  {265},
  {266},
  {267},
  {141},
  {150},
  {280},
  {281}
};
Thats at the top of the script.

This is under /duty

Code:
new rand;
rand = random(sizeof(Police));
for(new i = 0; i <= sizeof(Police)-1; i++) {
SetPlayerSkin(playerid, Police[i][rand]);
}
It will say Unknown Command until the SFPD skin then it will work, Whats wrong?

- Cheers Winter


Re: [Q] Array Problem Involving random skins - Weirdosport - 19.07.2009

//top of script
pawn Code:
new rand;

new Police[] =
{
  265, 266, 267, 141, 150, 280, 281
};

//duty command
pawn Code:
rand = random(sizeof(Police));
SetPlayerSkin(playerid, Police[rand]);



Re: [Q] Array Problem Involving random skins - [ERP]Snow - 19.07.2009

How could i've been so stupid...

Thanks


Re: [Q] Array Problem Involving random skins - Weirdosport - 19.07.2009

Arrays can be tricky little things.