Thread: Randomize Teams
View Single Post
raizo11
BANNED
Join Date: Dec 2013
Location: https://t.me/pump_upp
Old 02-10-2021 , 05:35   Re: Randomize Teams
Reply With Quote #2

Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <cstrike>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "My Computer"

new One_Time = 1;

public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	register_clcmd( "say /random","Command_Random" );
}


public Command_Random(id)
{
    new flags = get_user_flags(id)
    
    if(!(flags & ADMIN_KICK))
    {
        client_print(id,print_chat,"You have no access to this command")
        return PLUGIN_HANDLED
    }
    
    if(One_Time == 1)
    {
	
        new num, players[32]
	
        get_players(players,num)
	
        for(new i=0;i<=num;i++)
        {
            if(cs_get_user_team(players[i])==CS_TEAM_SPECTATOR) 
	       continue
		
            new rannum = random_num(1,2)
	    
            if(rannum==1) 
            {
                cs_set_user_team(players[i],CS_TEAM_T)
            }
            else 
            {
                cs_set_user_team(players[i],CS_TEAM_CT)
            }
        }
        client_print(id,print_chat,"You have changed successfully the teams!")
    }
    else
    {
    	client_print(id,print_chat,"Only one time per map")
    }
    One_Time = 0
    
    return PLUGIN_HANDLED
}

Last edited by raizo11; 02-10-2021 at 20:02.
raizo11 is offline
Send a message via ICQ to raizo11 Send a message via AIM to raizo11 Send a message via MSN to raizo11 Send a message via Yahoo to raizo11 Send a message via Skype™ to raizo11