Hey there guys.
So, i pick this structure up, and i am trying to edit it, but keep it simple, because i'm learning how to script in Pawn and C, and i want to be able to fully understand the source code and what's the function of every piece.
So, this piece of code is supposed to make teams play 15 rounds (in total : for example CT: 8 and T: 7) and then swap them.
But, what's happening is that the values don't change. So, if i play for the Counter-Terrorist team in the first half, and i win 14 rounds and the Terrorists team only 1, what happens is that when teams swap i am in disavantadge, because the score don't swap to. So, i'm looking in the cstrike func wiki, and can't find a way to swap the scores when teams swap places.
PHP Code:
#include <amxmodx>
#include <cstrike>
new enable, half_rounds, rounds_count
public plugin_init()
{
register_plugin("Auto Swap Teams", "0.1", "#Kz.Tw | nobody")
half_rounds = register_cvar("amx_half_rounds","15")
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 chCT, chT
new tround
client_print(0,print_chat,"* [AST] Switching Teams ")
get_players(CT,chCT,"e","CT")
get_players(T,chT,"e","TERRORIST")
for(new i = 0; i < chCT; i++)
{
cs_set_user_team(CT[i], CS_TEAM_T)
client_print(CT[i],print_chat,"* [AST] You're Team is CT now")
}
for(new i = 0; i < chT; i++)
{
cs_set_user_team(T[i], CS_TEAM_CT)
client_print(T[i], print_chat, "* [AST] You're Team is T now")
}
}
What i did was to put in my server.cfg win_limit 16 . So, if i reset rounds when teams swap instead of swaping the scores too, the scores stay stored? Meaning:
I am terrorist and i win the first half: 14 - 1;
When teams are swaped, scores are resetted to : 0 - 0;
When i am in CT (the second half), would it take only two rounds to win?
Sorry if this is confusing, and thanks for your help in advance.
</span></span>