Raised This Month: $ Target: $400
 0% 

How to change the team of all players.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
FromTheFuture
Senior Member
Join Date: Jan 2013
Old 04-21-2013 , 12:00   How to change the team of all players.
Reply With Quote #1

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")


FromTheFuture is offline
Unkolix
Veteran Member
Join Date: Sep 2012
Old 04-21-2013 , 12:07   Re: How to change the team of all players.
Reply With Quote #2

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 )
    }

Unkolix is offline
FromTheFuture
Senior Member
Join Date: Jan 2013
Old 04-21-2013 , 12:20   Re: How to change the team of all players.
Reply With Quote #3

Code is right, but server channel will be overload if players more than 10.
FromTheFuture is offline
lazarev
Veteran Member
Join Date: Sep 2008
Old 04-22-2013 , 02:59   Re: How to change the team of all players.
Reply With Quote #4

Quote:
Originally Posted by FromTheFuture View Post
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

Last edited by lazarev; 04-22-2013 at 03:00.
lazarev is offline
FromTheFuture
Senior Member
Join Date: Jan 2013
Old 04-22-2013 , 08:00   Re: How to change the team of all players.
Reply With Quote #5

Quote:
Originally Posted by lazarev View Post
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?
FromTheFuture is offline
FromTheFuture
Senior Member
Join Date: Jan 2013
Old 04-21-2013 , 12:21   Re: How to change the team of all players.
Reply With Quote #6

I think I must change the team of player when he die.
FromTheFuture is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 04-21-2013 , 12:27   Re: How to change the team of all players.
Reply With Quote #7

Add a delay, don't change all teams at once.
Backstabnoob is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 04-22-2013 , 08:14   Re: How to change the team of all players.
Reply With Quote #8

Use the module
Backstabnoob is offline
FromTheFuture
Senior Member
Join Date: Jan 2013
Old 04-22-2013 , 15:50   Re: How to change the team of all players.
Reply With Quote #9

When I used this module I get this error:
FATA ERROR (shutting down): Tried to create a message with a bogus message type ( 0 )
FromTheFuture is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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