AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to change the team of all players. (https://forums.alliedmods.net/showthread.php?t=213974)

FromTheFuture 04-21-2013 12:00

How to change the team of all players.
 
I try to use this code, but server was crashed.
PHP Code:

ChangeTeam()
{

    new 
iTeam;
    
    for( new 
id 1id <= 32id++ )
    {
        if(!
is_user_connected(id)) continue;
        
iTeam get_user_team(id);
        
        
cs_set_user_team(idiTeam == CS_TEAM_CT iTeam == CS_TEAM_T CS_TEAM_SPECTATOR)
    }
    
    
server_cmd("sv_restartround 3");
    
set_task(4.5"Announce")




Unkolix 04-21-2013 12:07

Re: How to change the team of all players.
 
PHP Code:

new iPlayers32 ], iNumiPlayer
get_players
iPlayersiNum )
    
for ( new 
0iNuma++ )
{
    
iPlayer iPlayers];

    switch ( 
cs_get_user_teamiPlayer ) )
    {
        case 
CS_TEAM_Tcs_set_user_teamiPlayerCS_TEAM_CT )
        case 
CS_TEAM_CTcs_set_user_teamiPlayerCS_TEAM_T )
    }



FromTheFuture 04-21-2013 12:20

Re: How to change the team of all players.
 
Code is right, but server channel will be overload if players more than 10.

FromTheFuture 04-21-2013 12:21

Re: How to change the team of all players.
 
I think I must change the team of player when he die.

Backstabnoob 04-21-2013 12:27

Re: How to change the team of all players.
 
Add a delay, don't change all teams at once.

lazarev 04-22-2013 02:59

Re: How to change the team of all players.
 
Quote:

Originally Posted by FromTheFuture (Post 1937084)
Code is right, but server channel will be overload if players more than 10.

you can try using this module and see if your sever still overloads http://forums.alliedmods.net/showthread.php?t=163555

FromTheFuture 04-22-2013 08:00

Re: How to change the team of all players.
 
Quote:

Originally Posted by lazarev (Post 1937502)
you can try using this module and see if your sever still overloads http://forums.alliedmods.net/showthread.php?t=163555

Thank You, but what will be better - using module or change team when player die?

Backstabnoob 04-22-2013 08:14

Re: How to change the team of all players.
 
Use the module

FromTheFuture 04-22-2013 15:50

Re: How to change the team of all players.
 
When I used this module I get this error:
FATA ERROR (shutting down): Tried to create a message with a bogus message type ( 0 )


All times are GMT -4. The time now is 10:54.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.