SA-MP Forums Archive
How to get half and half of players? - 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)
+--- Thread: How to get half and half of players? (/showthread.php?tid=293258)



How to get half and half of players? - Super_Panda - 27.10.2011

Like if there are 5 persons in the server

put 3 in pos x,y,z

and put the other 2 in the pos x,y,z


Re: How to get half and half of players? - Kingunit - 27.10.2011

What? Explain more, I don't understand your post.


Respuesta: How to get half and half of players? - Super_Panda - 27.10.2011

Like it'll say New Fight!
and it'll set half of the players of the server on certain position
and the other half of players in the other certain position.


Re : How to get half and half of players? - Naruto_Emilio - 27.10.2011

Oh, like getting each team..... contact me via pm and tell me what are your teams.. :P


Re: How to get half and half of players? - FUNExtreme - 27.10.2011

Try foreach

pawn Код:
Iter_Count(Player) //For the amount of players
Divide the count by 2, round up. Then do a foreach loop (only players).

Should be fairly easy to guess what comes next


Re: How to get half and half of players? - Kingunit - 27.10.2011

Like my LastManStanding event script? You can use that one and edit it with teams.


Re : How to get half and half of players? - Naruto_Emilio - 27.10.2011

pawn Код:
CMD:getblue(playerid, params[])
{
    new Float:x, Float:y, Float:z;
    for(new i = 0; i <= MAX_PLAYERS; i++)
    {
    if(gTeam[i] == TEAM_BLUE)
    {
        GetPlayerPos(playerid, x ,y ,z);
        SetPlayerPos(i, x, y, z);
    }
    }
}

CMD:getred(playerid, params[])
{
    new Float:x, Float:y, Float:z;
    for(new i = 0; i <= MAX_PLAYERS; i++)
    {
    if(gTeam[i] == TEAM_GREEN)
    {
        GetPlayerPos(playerid, x ,y ,z);
        SetPlayerPos(i, x, y, z);
    }
    }
}