SA-MP Forums Archive
what's the ... - 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: what's the ... (/showthread.php?tid=188762)



what's the ... - marinov - 08.11.2010

what's the command to choose a random player ?


Re: what's the ... - Miguel - 09.11.2010

There's no command to "choose a random player", you have to make it yourself.


Re: what's the ... - marinov - 09.11.2010

I know I meant to say what's the variable/param (I forgot the name)


Re: what's the ... - Hiitch - 09.11.2010

Do you mean Random(); ?


Re: what's the ... - marinov - 09.11.2010

yeah, but is there something like RandomPlayer or something ? (my pawno doesn't show those things I dunno why)


Re: what's the ... - Miguel - 09.11.2010

pawn Код:
stock GetRandomPlayer()
{
    new
        playerid,
        max_players = GetMaxPlayers;

    do {playerid = random(max_players);}
    while(!IsPlayerConnected(playerid));
    return playerid;
}



Re: what's the ... - marinov - 09.11.2010

Thanks, can you also help me make a command like (/bance) and then it gets a random player and put it on this team:

Код:
	if(team[playerid] == 2) //Zombies
	{
		SetPlayerColor(playerid,ZRED);
		SetPlayerTeam(playerid, 2);
		SetPlayerHealth(playerid, 200);
		GameTextForPlayer(playerid,"~r~Zombie: ~b~/hide",10000,1);
	}