View Single Post
notahacker
Member
Join Date: Jan 2015
Old 03-11-2017 , 07:08   Re: Half Rounds Auto Swap Teams
Reply With Quote #33

Quote:
Originally Posted by alan_el_more View Post
To fulfill the role that has said, would have to be something like that:
PHP Code:
#include <amxmodx>
#include <cstrike>

new enablehalf_roundsrounds_count

public plugin_init() 
{
    
register_plugin("Auto Swap Teams""0.1""#Kz.Tw | nobody")
    
half_rounds register_cvar("amx_half_rounds","8")
    
enable register_cvar("swap_teams""1")
    
register_event("HLTV""event_round_start""a""1=0""2=0")
    
register_event("TextMsg""Event_TextMsg""a""2&#Game_C")
}

public 
event_round_start()
{
    if(
get_pcvar_num(enable))
    {
        
rounds_count++
        if(
rounds_count == get_pcvar_num(half_rounds))
            
swap_teams()
    }
}

public 
Event_TextMsg()
    
rounds_count 0

public swap_teams()
{
    new 
CT[32],T[32]
    new 
chCTchT
    
new tround
    
    client_print
(0,print_chat,"* [AST] Switching Teams ")
    
tround get_pcvar_num(half_rounds)*2
    set_cvar_num
("mp_maxrounds"tround)    
    
get_players(CT,chCT,"e","CT")
    
get_players(T,chT,"e","TERRORIST")

    for(new 
0chCTi++)
    {
        
cs_set_user_team(CT[i], CS_TEAM_T)

        
client_print(CT[i],print_chat,"* [AST] You're Team is CT now")
    }

    for(new 
0chTi++)
    {
        
cs_set_user_team(T[i], CS_TEAM_CT)
        
        
client_print(T[i], print_chat"* [AST] You're Team is T now")
    }



Hi. With this plugin, after the team has been swapped, they have to play the number of amx_half_rounds again.

what edit should i do to the script to add the following:
for example, i set amx_half_rounds to 15. After 15 rounds the plugin swaps the teams ( terro 5 : CT 10)
after the team swap and restart round, i want the plugin to continue the team scores till the TOTAL score of ONE team is 16. The first one to reach total score of 16 will win (including the score before the swap). ie, if after the swap, the new terros wins 6 rounds. they win as their total round will be 16.

probably add something like "amx_maxteam_rounds = 16"
after a team reaches the amx_maxteam_rounds, it says Match has ended.


a bit like what Auto-Mix (Pug) - By: p1Mp did using g_iScore[0], g_iScore[1] after the swap to show the scores..
notahacker is offline