Raised This Month: $ Target: $400
 0% 

Switch all players plugin?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
imb
Zero Posts
Join Date: May 2012
Old 09-15-2012 , 14:33   Switch all players plugin?
Reply With Quote #1

Hi, is there a plugin that switches all players at once in CS 1.6?

For example: All CT players to TE then all TE players to CT, all at the same time. Just one command switches all.

The current amx_team command needs to select players one by one, I was wondering if there is a plugin that switches every player. Thanks.

Last edited by imb; 09-15-2012 at 14:44.
imb is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 09-15-2012 , 16:47   Re: Switch all players plugin?
Reply With Quote #2

Here you go. Use amx_swapteams to swap teams.
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>

#define PLUGIN "Swap Teams"
#define VERSION "1.0"
#define AUTHOR "Alka"

public plugin_init() {
    
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_concmd("amx_swapteams""concmd_SwapTeams"ADMIN_KICK);
}

public 
concmd_SwapTeams(idlevelcid)
{
    if(!
cmd_access(idlevelcid1))
        return 
PLUGIN_HANDLED;
        
    
SwapTeams();
    
server_cmd("sv_restart 1");
    
    return 
PLUGIN_HANDLED;
}

SwapTeams()
{
    static 
iMaxPlayers;
    if(!
iMaxPlayers)
        
iMaxPlayers get_maxplayers();
    
    for(new 
id id <= iMaxPlayers id++)
    {
        if(!
is_user_connected(id))
            continue;
        
        if(
get_user_team(id) < 3)
            
cs_set_user_team(id_:(get_user_team(id)));
    }

__________________
Still...lovin' . Connor noob! Hello

Last edited by Alka; 09-16-2012 at 11:54.
Alka is offline
imb
Zero Posts
Join Date: May 2012
Old 09-16-2012 , 07:52   Re: Switch all players plugin?
Reply With Quote #3

This works thank you!

BTW how can I automatically restart round when typing amx_swapteams?
imb is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 09-16-2012 , 11:55   Re: Switch all players plugin?
Reply With Quote #4

Updated the code above.
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
imb
Zero Posts
Join Date: May 2012
Old 09-16-2012 , 14:11   Re: Switch all players plugin?
Reply With Quote #5

Thank you very much! :-)
imb 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 02:46.


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