SA-MP Forums Archive
please help with team auto select - 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: please help with team auto select (/showthread.php?tid=164501)



please help with team auto select - lSCARl - 31.07.2010

well my game mode is hide n kill so of course no one wants to be the killer so how can i make it so 1 person gets randomly selected to be the kiler


Re: please help with team auto select - PotH3Ad - 31.07.2010

Try this code, not sure if it works. You will have to edit it a bit...

pawn Код:
public StartGame()
{
    for(new x=0; x<MAX_PLAYERS; x++)
    {
        if(IsPlayerConnected(x))
        {
            new rand = random(2);
            if(rand == 1)
            {
                SetPVarInt(x, "IsKiller", 1);

                new str[85];
                format(str, sizeof(str), "%s has been randomly chosen as the killer!", pName(x));
                SendClientMessageToAll(0xFFFAFFF, str);
                break;
            }
            else continue;
        }
    }
    return 1;
}