SA-MP Forums Archive
Team 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: Team players (/showthread.php?tid=312980)



Team players - MSI - 23.01.2012

I want to show the ammount of players in a team in the team selection dialog. Example: (team) United States Of Amererica Players: [ammount of players]

Someone?


Re: Team players - Konstantinos - 23.01.2012

pawn Код:
CMD:example( playerid, params[ ] )
{
    new
        Txt[ 128 ], count = 0;

    for( new i = 0; i < MAX_PLAYERS; i ++ )
    {
        if( IsPlayerConnected( i ) )
        {
            if(/* your_variable */[ i ][ /* Team */ ] >= 1 )
            {
                count ++;
                format( string, 128, "%d", count );
                ShowPlayerDialog( playerid, 9680, DIALOG_STYLE_MSGBOX, "Team", Txt, "Close", "" );
               
            }
        }
    }
    if( count == 0 )
    SendClientMessage( playerid, -1, "No one in that Team!" );
    return 1;
}



Re: Team players - Snowman12 - 23.01.2012

Quote:
Originally Posted by Dwane
Посмотреть сообщение
pawn Код:
CMD:example( playerid, params[ ] )
{
    new
        Txt[ 128 ], count = 0;

    for( new i = 0; i < MAX_PLAYERS; i ++ )
    {
        if( IsPlayerConnected( i ) )
        {
            if(/* your_variable */[ i ][ /* Team */ ] >= 1 )
            {
                count ++;
                format( string, 128, "%d", count ); // hehe format "string" XD
                ShowPlayerDialog( playerid, 9680, DIALOG_STYLE_MSGBOX, "Team", Txt, "Close", "" );
               
            }
        }
    }
    if( count == 0 )
    SendClientMessage( playerid, -1, "No one in that Team!" );
    return 1;
}
lmfao :P


Re: Team players - Konstantinos - 23.01.2012

Whoops! My bad. Now I read it better in the team selection dialog

pawn Код:
// An example:
public OnPlayerRequestClass( playerid, classid )
{
    if( classid == 0 || classid == 1 || classid == 2 || classid == 3 )
    {
        gTeam[ playerid ] = TEAM_1;
        new
            Txt[ 128 ], count = 0;

        for( new i = 0; i < MAX_PLAYERS; i ++ )
        {
            if( IsPlayerConnected( i ) )
            {
                if( gTeam[ i ] == TEAM_1 )
                {
                    count ++;
                    format( string, 128, "%d", count ); // hehe format "string" XD
                    ShowPlayerDialog( playerid, 9680, DIALOG_STYLE_MSGBOX, "Team", Txt, "Close", "" );
                }
            }
        }
        if( count == 0 )
        SendClientMessage( playerid, -1, "No one in that Team!" );
        return 1;
    }
    return 1;
}