Count 1/2 players
#5

Ok, so I decided to do jihost's thing
so I foudn this stock:
pawn Код:
{
    new bool:connected[MAX_PLAYERS] = false, amount = 0;
    for(new i = 0; i < MAX_PLAYERS; i++)
      if(IsPlayerConnected(i))
      {
        connected[i] = true;
        amount++;
      }
    if(amount = 0) return -1;
    new rand = random(amount), done = 0;
    for(new i = 0; i < MAX_PLAYERS; i++)
      if(connected[i])
      {
        if(done == rand) return i;
        done++;
        }
    return -1;
}
and added it in my GM (on the end)
then I made a test command:
pawn Код:
if (strcmp("/test", cmdtext, true) == 0)
    {
        format(string,sizeof(string),"Test id:%d",GetRandomID());
        SendClientMessage(playerid,COLOR_RED,string);
        return 1;
    }
but I get this warning:
Код:
C:\Users\William\Documents\Famous' World\Famous' World\gamemodes\Famous.pwn(8436) : warning 211: possibly unintended assignment
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
error line:
pawn Код:
if(amount = 0) return -1;
its in the stock thing
Reply


Messages In This Thread
Count 1/2 players - by knackworst - 17.09.2011, 22:04
Re: Count 1/2 players - by StuffBoy - 17.09.2011, 22:07
Re: Count 1/2 players - by JiHost - 17.09.2011, 22:09
Respuesta: Count 1/2 players - by Xyrex - 17.09.2011, 22:11
Re: Count 1/2 players - by knackworst - 17.09.2011, 22:41
Re: Count 1/2 players - by Xyrex - 17.09.2011, 23:08
Re: Count 1/2 players - by Ricop522 - 17.09.2011, 23:15
Re: Count 1/2 players - by knackworst - 18.09.2011, 10:10

Forum Jump:


Users browsing this thread: 1 Guest(s)