SA-MP Forums Archive
Juqt a small question about random func - 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: Juqt a small question about random func (/showthread.php?tid=85807)



Juqt a small question about random func - Coicatak - 09.07.2009

When I compile my script I get this:

Код:
C:\Documents and Settings\Sйbastien\Mes documents\GTA\samp02Xserver.win32\gamemodes\BCL-RP.pwn(3146) : warning 204: symbol is assigned a value that is never used: "RandomFemaleSkin"
C:\Documents and Settings\Sйbastien\Mes documents\GTA\samp02Xserver.win32\gamemodes\BCL-RP.pwn(3140) : warning 204: symbol is assigned a value that is never used: "RandomMaleSkin"
But the code seems good and it works IG :/ What's wrong?
pawn Код:
stock RandomSkin(playerid)
{
    if(PlayerInfo[playerid][pSex] == 1)
    {
        new RandomMaleSkin[7][] = { {60}, {66}, {101}, {128}, {170}, {180}, {188} };
        new rand = random(sizeof(RandomMaleSkin));
        SetPlayerSkin(playerid, rand);
    }
    else if(PlayerInfo[playerid][pSex] == 2)
    {
        new RandomFemaleSkin[7][] = { {56}, {69}, {93}, {141}, {150}, {191}, {193} };
        new rand = random(sizeof(RandomFemaleSkin));
        SetPlayerSkin(playerid, rand);
    }
}
Thanks in advance


Re: Juqt a small question about random func - yom - 09.07.2009

I really doubt it's working in game. And why creating 2 dimensions if you only use one? Learning from GF? Bad idea.

Actually you never use RandomMaleSkin or the other (you only use it in sizeof which is evaluated when compiling), so it show these warnings.

pawn Код:
stock RandomSkin(playerid)
{
  if(PlayerInfo[playerid][pSex] == 1)
  {
    new RandomMaleSkin[] = { 60, 66, 101, 128, 170, 180, 188 };
    new rand = RandomMaleSkin[random(sizeof(RandomMaleSkin))];
    SetPlayerSkin(playerid, rand);
  }
  else
  {
    new RandomFemaleSkin[] = { 56, 69, 93, 141, 150, 191, 193 };
    new rand = RandomFemaleSkin[random(sizeof(RandomFemaleSkin))];
    SetPlayerSkin(playerid, rand);
  }
}



Re: Juqt a small question about random func - Coicatak - 09.07.2009

Thanks