Raised This Month: $32 Target: $400
 8% 

Pug War Scripting


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
allroundernaman
Member
Join Date: May 2020
Location: Somewhere Virtual
Old 05-18-2020 , 17:05   Pug War Scripting
Reply With Quote #1

Hi There!
I found many pug war plugins, but exactly can't find out the best plugin. So with some help of my teammates, I mixed up many different plugins into one that I want.
The code of my plugin -

PHP Code:


new MaxClients;
new 
NULL_STRING[1];
new 
Float:NULL_VECTOR[3];
new 
amx_warname;
new 
Float:g_fJoinedTeam[33] =
{
    -
1082130432, ...
};
new 
bool:g_bValid[33];
new 
CVAR_SPAWN[23] =
{
    
971021079598111109981161149711011510210111495115112971191100
};
new 
DEFAULT_SPAWN[2] =
{
    
550
};
new 
CVAR_TIME[22] =
{
    
9710210795981111099811611497110115102101114951161051091010
};
new 
DEFAULT_TIME[2] =
{
    
550
};
new 
g_pcvar_spawn;
new 
g_pcvar_time;
new 
TEAM[10] =
{
    
8469828279827383840
};
new 
WEAPON[10] =
{
    
119101971121111109599520
};
new 
bool:g_freezetime 1;
new 
bool:g_spawn;
new 
bool:g_planting;
new 
bool:g_restartedMatch;
new 
g_carrier;
new 
g_pos[33][3];
new 
g_time[33];
new 
g_maxplayers;
new 
g_TotalKills[33];
new 
g_TotalDeaths[33];
new 
g_BombPlants[33];
new 
g_BombDefusions[33];
new 
g_TotalLeaves;
new 
gMaxPlayers;
new 
msgToDisplay[456];
new 
gmsgScreenFade;
new 
g_iMaxPlayers;
new 
g_pCvarBlockChangeViewTime;
new 
g_pCvarKv3rdPerson;
new 
g_pCvarKvFade;
new 
CaptainChoosenID;
new 
WhoChoseThePlayer;
new 
g_pcvar_team;
new 
g_pcvar_class;
new 
g_pcvar_imm;
new 
bool:isFirstHalfStarted;
new 
bool:isSecondHalfStarted;
new 
gCptT;
new 
gCptCT;
new 
CaptainCount;
new 
bool:g_KnifeRound;
new 
bool:g_MatchInit;
new 
MatchStarterOwner;
new 
bool:CaptainSChosen;
new 
bool:g_MatchStarted;
new 
bool:is_secondHalf;
new 
ScoreFtrstTeam;
new 
ScoreScondteam;
new 
ShowMenuFirst;
new 
ShowMenuSecond;
new 
FirstCaptainTeamName;
new 
SecondCaptainTeamName;
new 
FirstCaptainName[52];
new 
SecondCaptainName[52];
new 
TempFirstCaptain[32];
new 
TempSecondCaptain[32];
new 
szMapname[32];
new 
RoundCounter;
abs(x)
{
    new 
var1;
    if (
0)
    {
        
var1 x;
    }
    else
    {
        
var1 = -x;
    }
    return 
var1;
}

bool:operator>(Float:,Float:)(Float:oper1Float:oper2)
{
    return 
floatcmp(oper1oper2) > 0;
}

replace_all(string[], lenwhat[], with[])
{
    new 
pos;
    if ((
pos contain(stringwhat)) == -1)
    {
        return 
0;
    }
    new 
total;
    new 
with_len strlen(with);
    new 
diff strlen(what) - with_len;
    new 
total_len strlen(string);
    new 
temp_pos;
    while (
replace(string[pos], len poswhatwith))
    {
        
total++;
        
pos with_len pos;
        
total_len -= diff;
        if (!(
pos >= total_len))
        {
            
temp_pos contain(string[pos], what);
            if (!(
temp_pos == -1))
            {
                
pos temp_pos pos;
            }
            return 
total;
        }
        return 
total;
    }
    return 
total;
}

user_silentkill(indexflag)
{
    static 
msgid;
    new 
msgblock;
    if (!
msgid)
    {
        
msgid get_user_msgid("DeathMsg");
    }
    
msgblock get_msg_block(msgid);
    
set_msg_block(msgid1);
    
user_kill(indexflag);
    
set_msg_block(msgidmsgblock);
    return 
1;
}

is_user_admin(id)
{
    new 
__flags get_user_flags(idMaxClients);
    new 
var1;
    return 
__flags && !__flags 33554432;
}

cmd_access(idlevelcidnumbool:accesssilent)
{
    new 
has_access;
    new 
var1;
    if (
is_dedicated_server())
    {
        
var1 0;
    }
    else
    {
        
var1 1;
    }
    if (
var1 == id)
    {
        
has_access 1;
    }
    else
    {
        if (
level == 16777216)
        {
            if (
is_user_admin(id))
            {
                
has_access 1;
            }
        }
        if (
level get_user_flags(idMaxClients))
        {
            
has_access 1;
        }
        if (!
level)
        {
            
has_access 1;
        }
    }
    if (
has_access)
    {
        if (
num read_argc())
        {
            new 
hcmd[32];
            new 
hinfo[128];
            new 
hflag;
            new 
bool:info_ml;
            
get_concmd(cidhcmd31hflaghinfo127level, -1info_ml);
            if (
info_ml)
            {
                
LookupLangKey(hinfo127hinfoid);
            }
            
console_print(id"%L:  %s %s"id"USAGE"hcmdhinfo);
            return 
0;
        }
        return 
1;
    }
    if (!
accesssilent)
    {
        
console_print(id"%L"id"NO_ACC_COM");
    }
    return 
0;
}

public 
__fatal_ham_error(Ham:idHamError:errreason[])
{
    new 
func get_func_id("HamFilter", -1);
    new 
bool:fail 1;
    new 
var1;
    if (
func != -&& callfunc_begin_i(func, -1) == 1)
    {
        
callfunc_push_int(id);
        
callfunc_push_int(err);
        
callfunc_push_str(reasonMaxClients);
        if (
callfunc_end() == 1)
        {
            
fail false;
        }
    }
    if (
fail)
    {
        
set_fail_state(reason);
    }
    return 
0;
}

public 
plugin_init()
{
    
register_plugin("NamVr PuB War""1.0""NamVr");
    
register_clcmd("amx_startmatch""ShowMenu"1"Get All The players", -1MaxClients);
    
gMaxPlayers get_maxplayers();
    
amx_warname register_cvar("amx_warname""-= WAR Not Started! =-"MaxClientsMaxClients);
    
register_forward(109"GameDesc"MaxClients);
    
g_pcvar_spawn register_cvar(CVAR_SPAWNDEFAULT_SPAWNMaxClientsMaxClients);
    
g_pcvar_time register_cvar(CVAR_TIMEDEFAULT_TIMEMaxClientsMaxClients);
    if (!
engfunc(12, -1"classname""func_bomb_target"))
    {
        return 
0;
    }
    
register_event("WeapPickup""event_got_bomb""be""1=6");
    
register_event("BarTime""event_bar_time""be"5536);
    
register_event("TextMsg""event_bomb_drop""bc""2=#Game_bomb_drop");
    
register_event("TextMsg""event_bomb_drop"5816"2=#Bomb_Planted");
    
register_event("HLTV""event_new_round"5972"1=0""2=0");
    
register_logevent("logevent_round_start_bomb"2"1=Round_Start");
    
set_task(1065353216"task_afk_check"MaxClients6240MaxClients6232MaxClients);
    
g_maxplayers get_maxplayers();
    
set_msg_block(get_user_msgid("HudTextArgs"), 2);
    
gmsgScreenFade get_user_msgid("ScreenFade");
    
g_iMaxPlayers get_maxplayers();
    
g_pCvarBlockChangeViewTime register_cvar("kv_buttonsdelay""2.0"MaxClientsMaxClients);
    
g_pCvarKv3rdPerson register_cvar("kv_3rdview"6460MaxClientsMaxClients);
    
g_pCvarKvFade register_cvar("kv_fade""000000000000"MaxClientsMaxClients);
    
RegisterHam(11"player""OnCBasePlayer_Killed_Post"1MaxClients);
    
register_event("DeathMsg""Event_DeathMsg_Knife"6804"1>0");
    
register_event("CurWeapon""Event_CurWeapon_NotKnife""be""1=1""2!29");
    
register_logevent("round_end"2"1=Round_End");
    
register_logevent("logevent_round_start"2"1=Round_Start");
    
register_clcmd("chooseteam""cmdChooseTeam", -17344, -1MaxClients);
    
register_clcmd("jointeam""GoToTheSpec", -17344, -1MaxClients);
    
register_clcmd("amx_stopmatch""StopMatch"1"Stop the Match!", -1MaxClients);
    
register_clcmd("amx_restartmatch""RestartMatch"1"Restart the Match!", -1MaxClients);
    
register_event("SendAudio""on_TerroristWin"7892"2=%!MRAD_terwin");
    
register_event("SendAudio""on_CTWin"8040"2=%!MRAD_ctwin");
    
register_clcmd("say !score""ShowScoreToUser", -17344, -1MaxClients);
    
register_clcmd("say !ss""screenshot_setup", -17344, -1MaxClients);
    
register_clcmd("say /getmenu""GetMatchMenu", -17344, -1MaxClients);
    
register_message(get_user_msgid("ShowMenu"), "message_show_menu");
    
register_message(get_user_msgid("VGUIMenu"), "message_vgui_menu");
    
g_pcvar_team register_cvar("ajc_team"8672MaxClientsMaxClients);
    
g_pcvar_class register_cvar("ajc_class"8720MaxClientsMaxClients);
    
g_pcvar_imm register_cvar("ajc_imm"8760MaxClientsMaxClients);
    
get_mapname(szMapname31);
    return 
0;
}

public 
event_new_round()
{
    
g_freezetime true;
    
g_spawn true;
    
g_planting false;
    
g_carrier 0;
    return 
0;
}

public 
event_got_bomb(id)
{
    
g_carrier id;
    return 
0;
}

public 
event_bar_time(id)
{
    if (
g_carrier == id)
    {
        
g_planting read_data(1);
        
get_user_origin(idg_pos[id], MaxClients);
        
g_time[id] = 0;
    }
    return 
0;
}

public 
event_bomb_drop()
{
    
g_spawn false;
    
g_planting false;
    
g_carrier 0;
    return 
0;
}

public 
logevent_round_start_bomb()
{
    new 
id[32];
    new 
num;
    
get_players(idnum"ae"TEAM);
    if (!
num)
    {
        return 
0;
    }
    
g_freezetime false;
    new 
x;
    new 
i;
    while (
num)
    {
        
id[i];
        
get_user_origin(xg_pos[x], MaxClients);
        
g_time[x] = 0;
        
i++;
    }
    return 
0;
}

public 
task_afk_check()
{
    if (
g_freezetime)
    {
        return 
0;
    }
    new 
id[32];
    new 
num;
    new 
x;
    new 
origin[3];
    
get_players(idnum"ae"TEAM);
    new 
i;
    while (
num)
    {
        
id[i];
        
get_user_origin(xoriginMaxClients);
        new 
var2;
        if (
g_pos[x][0] == origin[0] && g_pos[x][1] == origin[1] && (g_carrier == && g_planting))
        {
            
g_time[x] = 0;
            
g_pos[x][0] = origin[0];
            
g_pos[x][1] = origin[1];
            new 
var3;
            if (
g_spawn && g_carrier == x)
            {
                
g_spawn false;
            }
        }
        else
        {
            
g_time[x]++;
        }
        
i++;
    }
    new 
var4;
    if (!
g_carrier || num 2)
    {
        return 
0;
    }
    
decl max_time;
    new 
var5;
    if (
g_spawn)
    {
        
var5 g_pcvar_spawn;
    }
    else
    {
        
var5 g_pcvar_time;
    }
    
max_time get_pcvar_num(var5);
    new 
var6;
    if (
max_time <= || g_time[g_carrier] < max_time)
    {
        return 
0;
    }
    
get_user_origin(g_carrieroriginMaxClients);
    new 
min_dist 999999;
    new 
dist;
    new 
recipient;
    new 
origin2[3];
    new 
i;
    while (
num)
    {
        
id[i];
        if (
max_time g_time[x])
        {
            
get_user_origin(xorigin2MaxClients);
            
dist get_distance(originorigin2);
            if (
dist min_dist)
            {
                
min_dist dist;
                
recipient x;
            }
        }
        
i++;
    }
    if (!
recipient)
    {
        return 
0;
    }
    new 
carrier g_carrier;
    
engclient_cmd(carrier"drop"WEAPON8812);
    new 
c4 engfunc(12, -1"classname"WEAPON);
    if (!
c4)
    {
        return 
0;
    }
    new 
backpack pev(c418);
    if (
backpack <= g_maxplayers)
    {
        return 
0;
    }
    
set_pev(backpack84pev(backpack84) | 512);
    
dllfunc(NULL_STRINGbackpackrecipient);
    
set_hudmessage(MaxClients255MaxClients10519314431061997773MaxClients1086324736108842188810368319491045220557, -1);
    new 
message[128];
    new 
c_name[32];
    new 
r_name[32];
    
get_user_name(carrierc_name31);
    
get_user_name(recipientr_name31);
    
format(message127"Bomb transferred to \"%s\"\nsince \"%s\" is AFK"r_namec_name);
    new 
i;
    while (
num)
    {
        
show_hudmessage(id[i], "%s"message);
        
i++;
    }
    
set_hudmessage(255255MaxClients10542802531050253722MaxClients10863247361088421888103683194910452205573);
    
show_hudmessage(recipient"You got the bomb!");
    return 
0;
}

public 
GameDesc()
{
    static 
gamename[32];
    
get_pcvar_string(amx_warnamegamename31);
    
forward_return(1gamename);
    return 
4;
}

public 
OnCBasePlayer_Killed_Post(idkiller)
{
    new 
var1;
    if (!
killer || killer g_iMaxPlayers || killer != id || g_MatchStarted)
    {
        return 
0;
    }
    
set_pev(id802);
    new 
Float:flTime get_gametime();
    
set_pdata_float(id354floatsub(flTime1078355558), 55);
    
ExecuteHam(41id);
    
engclient_cmd(id"specmode"92768812);
    
engclient_cmd(id"spec_mode"93248812);
    
set_pdata_float(id100floatadd(flTimeget_pcvar_float(g_pCvarBlockChangeViewTime)), 55);
    
set_pev(id801);
    
set_pev(id33floatadd(1036831949flTime));
    
set_pdata_float(id354floatadd(1176255488flTime), 55);
    new 
szFade[13];
    new 
get_pcvar_string(g_pCvarKvFadeszFade12);
    if (
== 12)
    {
        new 
r;
        new 
g;
        new 
b;
        new 
a;
        
szFade[2] - 48 szFade[1] - 48 10 szFade[0] - 48 100;
        
szFade[5] - 48 szFade[4] - 48 10 szFade[3] - 48 100;
        
szFade[8] - 48 szFade[7] - 48 10 szFade[6] - 48 100;
        
szFade[11] - 48 szFade[10] - 48 10 szFade[9] - 48 100;
        
message_begin(NULL_VECTORgmsgScreenFade9332id);
        
write_short(8192);
        
write_short(2048);
        
write_short(MaxClients);
        
write_byte(r);
        
write_byte(g);
        
write_byte(b);
        
write_byte(a);
        
message_end();
    }
    return 
0;
}

public 
Event_DeathMsg_Knife()
{
    if (!
g_MatchStarted)
    {
        return 
0;
    }
    new 
attacker read_data(1);
    new 
victim read_data(2);
    new 
var1;
    if (
attacker != victim && cs_get_user_team(victim0) != cs_get_user_team(attacker0))
    {
        
g_TotalKills[attacker]++;
        
g_TotalDeaths[victim]++;
    }
    return 
0;
}

public 
bomb_planted(planter)
{
    if (
g_MatchStarted)
    {
        
g_BombPlants[planter]++;
    }
    return 
0;
}

public 
bomb_defused(defuser)
{
    if (
g_MatchStarted)
    {
        
g_BombDefusions[defuser]++;
    }
    return 
0;
}

public 
GetMatchMenu(id)
{
    if (
CaptainSChosen)
    {
        if (
CaptainChoosenID != id)
        {
            if (
WhoChoseThePlayer == 1)
            {
                
LetsSecondChoosePlayers(ShowMenuSecond);
            }
            if (
WhoChoseThePlayer == 2)
            {
                
LetsFirstChoosePlayers(ShowMenuFirst);
            }
        }
    }
    return 
1;
}

public 
RestartMatch(idlvlcid)
{
    if (!
cmd_access(idlvlcid0false))
    {
        return 
1;
    }
    if (
g_restartedMatch)
    {
        return 
1;
    }
    new 
var1;
    if (
g_MatchInit || g_MatchStarted || g_KnifeRound)
    {
        new 
MatchRestarterName[32];
        
get_user_name(idMatchRestarterName31);
        new 
MatchRestarterAuthID[32];
        
get_user_authid(idMatchRestarterAuthID31);
        
log_amx("Admin %s with ID = %i and AuthID %s has restarted the Match !"MatchRestarterNameidMatchRestarterAuthID);
        
server_cmd("mp_freezetime 999");
        
g_restartedMatch true;
        
set_dhudmessage(MaxClients255MaxClients, -1082130432, -1082130432MaxClients1073741824108632473610619977731061997773);
        
show_dhudmessage(MaxClients"Admin has restarted the Match ! \n Captains will be chosen shortly..");
        
set_task(1090519040"RestartMatchTask"id6240MaxClients10004MaxClients);
        return 
1;
    }
    return 
1;
}

public 
RestartMatchTask(id)
{
    
g_restartedMatch false;
    
LoadPubSettings();
    
ShowMenuSpecial(id);
    return 
0;
}

public 
StopMatch(idlvlcid)
{
    if (!
cmd_access(idlvlcid0false))
    {
        return 
1;
    }
    new 
var1;
    if (
g_MatchInit || g_MatchStarted || g_KnifeRound)
    {
        new 
MatchStopperName[32];
        
get_user_name(idMatchStopperName31);
        new 
MatchStopperAuthID[32];
        
get_user_authid(idMatchStopperAuthID31);
        
log_amx("Admin %s with AuthID %s has stopped the Match !"MatchStopperNameMatchStopperAuthID);
        
server_cmd("mp_freezetime 999");
        
set_dhudmessage(MaxClients255MaxClients, -1082130432, -1082130432MaxClients1073741824108632473610619977731061997773);
        
show_dhudmessage(MaxClients"Admin has Stopped the Match ! \n Server will restart now.");
        
set_task(1090519040"RestartServerForStoppingMatch"MaxClients6240MaxClients10004MaxClients);
        return 
1;
    }
    return 
1;
}

public 
StopMatchSpecial()
{
    new 
var1;
    if (
g_MatchInit || g_MatchStarted || g_KnifeRound)
    {
        
server_cmd("mp_freezetime 999");
        
set_dhudmessage(MaxClients255MaxClients, -1082130432, -1082130432MaxClients1073741824108632473610619977731061997773);
        
show_dhudmessage(MaxClients"Match Lord has Left the Game ! \n Server will restart now.");
        
set_task(1082130432"RestartServerForStoppingMatch"MaxClients6240MaxClients10004MaxClients);
    }
    return 
1;
}

public 
RestartServerForStoppingMatch()
{
    new 
CurrentMap[33];
    
get_mapname(CurrentMap32);
    
server_cmd("changelevel %s"CurrentMap);
    return 
1;
}

public 
GoToTheSpec(id)
{
    new 
var1;
    if (
g_MatchInit || g_KnifeRound)
    {
        if (
is_user_connected(id))
        {
            
set_task(1077936128"TransferToSpec"id6240MaxClients10004MaxClients);
        }
    }
    return 
0;
}

public 
on_TerroristWin()
{
    if (
g_KnifeRound == true)
    {
        
ShowMenuFirst gCptT;
        
ShowMenuSecond gCptCT;
        
get_user_name(ShowMenuFirstFirstCaptainName51);
        
get_user_name(ShowMenuSecondSecondCaptainName51);
        
set_task(1077936128"GiveRestartRound"MaxClients6240MaxClients112321);
        
set_task(1073741824"FirstCaptainWonKnifeRoundMessage"gCptT6240MaxClients10004MaxClients);
        
g_KnifeRound false;
        
LoadMatchSettings();
    }
    if (
g_MatchStarted)
    {
        if (
isFirstHalfStarted)
        {
            if (
FirstCaptainTeamName == 1)
            {
                
ScoreFtrstTeam += 1;
            }
            else
            {
                
ScoreScondteam += 1;
            }
            if (
ScoreFtrstTeam ScoreScondteam)
            {
                new 
GameDescBuffer[32];
                
formatex(GameDescBuffer31"1st-H: %d To %d"ScoreFtrstTeamScoreScondteam);
                
set_cvar_string("amx_warname"GameDescBuffer);
            }
            if (
ScoreScondteam ScoreFtrstTeam)
            {
                new 
GameDescBuffer[32];
                
formatex(GameDescBuffer31"1st-H: %d To %d"ScoreScondteamScoreFtrstTeam);
                
set_cvar_string("amx_warname"GameDescBuffer);
            }
            if (
ScoreScondteam == ScoreFtrstTeam)
            {
                new 
GameDescBuffer[32];
                
formatex(GameDescBuffer31"1st-H: %d To %d"ScoreScondteamScoreFtrstTeam);
                
set_cvar_string("amx_warname"GameDescBuffer);
            }
        }
        if (
isSecondHalfStarted)
        {
            if (
FirstCaptainTeamName == 1)
            {
                
ScoreScondteam += 1;
            }
            else
            {
                
ScoreFtrstTeam += 1;
            }
            if (
ScoreFtrstTeam ScoreScondteam)
            {
                new 
GameDescBuffer[32];
                
formatex(GameDescBuffer31"2nd-H: %d To %d"ScoreFtrstTeamScoreScondteam);
                
set_cvar_string("amx_warname"GameDescBuffer);
            }
            if (
ScoreScondteam ScoreFtrstTeam)
            {
                new 
GameDescBuffer[32];
                
formatex(GameDescBuffer31"2nd-H: %d To %d"ScoreScondteamScoreFtrstTeam);
                
set_cvar_string("amx_warname"GameDescBuffer);
            }
            if (
ScoreScondteam == ScoreFtrstTeam)
            {
                new 
GameDescBuffer[32];
                
formatex(GameDescBuffer31"2nd-H: %d To %d"ScoreScondteamScoreFtrstTeam);
                
set_cvar_string("amx_warname"GameDescBuffer);
            }
        }
    }
    return 
0;
}

public 
on_CTWin()
{
    if (
g_KnifeRound)
    {
        
ShowMenuFirst gCptCT;
        
ShowMenuSecond gCptT;
        
get_user_name(ShowMenuFirstFirstCaptainName51);
        
get_user_name(ShowMenuSecondSecondCaptainName51);
        
g_KnifeRound false;
        
set_task(1077936128"GiveRestartRound"MaxClients6240MaxClients121121);
        
set_task(1073741824"SecondCaptWonKnifeRoundWonMessage"gCptCT6240MaxClients10004MaxClients);
        
LoadMatchSettings();
    }
    if (
g_MatchStarted)
    {
        if (
isFirstHalfStarted)
        {
            if (
FirstCaptainTeamName == 2)
            {
                
ScoreFtrstTeam += 1;
            }
            else
            {
                
ScoreScondteam += 1;
            }
            if (
ScoreFtrstTeam ScoreScondteam)
            {
                new 
GameDescBuffer[32];
                
formatex(GameDescBuffer31"1st-H: %d To %d"ScoreFtrstTeamScoreScondteam);
                
set_cvar_string("amx_warname"GameDescBuffer);
            }
            if (
ScoreScondteam ScoreFtrstTeam)
            {
                new 
GameDescBuffer[32];
                
formatex(GameDescBuffer31"1st-H: %d To %d"ScoreScondteamScoreFtrstTeam);
                
set_cvar_string("amx_warname"GameDescBuffer);
            }
            if (
ScoreScondteam == ScoreFtrstTeam)
            {
                new 
GameDescBuffer[32];
                
formatex(GameDescBuffer31"1st-H: %d To %d"ScoreScondteamScoreFtrstTeam);
                
set_cvar_string("amx_warname"GameDescBuffer);
            }
        }
        if (
isSecondHalfStarted)
        {
            if (
FirstCaptainTeamName == 2)
            {
                
ScoreScondteam += 1;
            }
            else
            {
                
ScoreFtrstTeam += 1;
            }
            if (
ScoreFtrstTeam ScoreScondteam)
            {
                new 
GameDescBuffer[32];
                
formatex(GameDescBuffer31"2nd-H: %d To %d"ScoreFtrstTeamScoreScondteam);
                
set_cvar_string("amx_warname"GameDescBuffer);
            }
            if (
ScoreScondteam ScoreFtrstTeam)
            {
                new 
GameDescBuffer[32];
                
formatex(GameDescBuffer31"2nd-H: %d To %d"ScoreScondteamScoreFtrstTeam);
                
set_cvar_string("amx_warname"GameDescBuffer);
            }
            if (
ScoreScondteam == ScoreFtrstTeam)
            {
                new 
GameDescBuffer[32];
                
formatex(GameDescBuffer31"2nd-H: %d To %d"ScoreScondteamScoreFtrstTeam);
                
set_cvar_string("amx_warname"GameDescBuffer);
            }
        }
    }
    return 
0;
}

public 
logevent_round_start()
{
    if (
g_KnifeRound)
    {
        
set_dhudmessage(255255255, -1082130432, -1082130432MaxClients1073741824108632473610619977731061997773);
        
show_dhudmessage(MaxClients"-= Knife Round Begins =- \n Captain: %s \n Vs. \n Captain: %s"TempFirstCaptainTempSecondCaptain);
        
chatcolor(0"!t[NamVr WAR] !g !tKnife Round !yhas !gbeen started ! ");
        
chatcolor(0"!t[NamVr WAR] !g Knife War: !yCaptain- !t %s !gVs. !yCaptain- !t%s"TempFirstCaptainTempSecondCaptain);
        
chatcolor(0"!t[NamVr WAR] !g Knife War: !yCaptain- !t %s !gVs. !yCaptain- !t%s"TempFirstCaptainTempSecondCaptain);
    }
    if (
g_MatchStarted)
    {
        
ShowScoreHud();
        
set_task(1077936128"ShowScoreOnRoundStart"MaxClients6240MaxClients10004MaxClients);
    }
    return 
0;
}

public 
client_putinserver(id)
{
    new 
var1;
    if (
g_MatchInit || g_KnifeRound)
    {
        
set_task(1088421888"TransferToSpec"id6240MaxClients10004MaxClients);
    }
    return 
0;
}

public 
ShowMenuSpecial(id)
{
    
MatchStarterOwner id;
    new 
MatchStarterName[32];
    
get_user_name(idMatchStarterName31);
    new 
MatchStarterAuthID[32];
    
get_user_authid(idMatchStarterAuthID31);
    
log_amx("Admin %s with AuthID %s has started the Match !"MatchStarterNameMatchStarterAuthID);
    
g_MatchInit true;
    
server_cmd("mp_forcerespawn 1");
    
cmdTransferAllInSpec();
    
MatchInitHudMessage();
    
set_task(1084227584"ShowMenuPlayers"id6240MaxClients10004MaxClients);
    return 
1;
}

public 
ShowMenu(idlvlcid)
{
    if (!
cmd_access(idlvlcid0false))
    {
        return 
1;
    }
    new 
var1;
    if (
g_MatchInit || g_MatchStarted)
    {
        return 
1;
    }
    
MatchStarterOwner id;
    
set_cvar_string("amx_warname""[NamVr-WAR] Initialized!");
    new 
MatchStarterName[32];
    
get_user_name(idMatchStarterName31);
    new 
MatchStarterAuthID[32];
    
get_user_authid(idMatchStarterAuthID31);
    
log_amx("Admin %s with ID = %i and  AuthID %s has started the Match !"MatchStarterNameidMatchStarterAuthID);
    
g_MatchInit true;
    
cmdTransferAllInSpec();
    
MatchInitHudMessage();
    
log_amx("Startmatch");
    
set_task(1077936128"ShowMenuPlayers"id6240MaxClients10004MaxClients);
    return 
1;
}

public 
MatchInitHudMessage()
{
    
set_dhudmessage(MaxClients255MaxClients, -1082130432, -1082130432MaxClients1073741824108632473610619977731061997773);
    
show_dhudmessage(MaxClients"The Match has been Initialized ! \n Captains will be chosen by the Match Lord.");
    
chatcolor(0"!t[NamVr WAR] !g The Match has been !tInitialized.");
    
chatcolor(0"!t[NamVr WAR] !g The Match has been !tInitialized.");
    
chatcolor(0"!t[NamVr WAR] !g Captains will be !tchosen.");
    return 
0;
}

public 
ShowMenuPlayers(id)
{
    
log_amx("captain selection");
    
set_cvar_string("amx_warname""Captain Selection!");
    new 
iMenu MakePlayerMenu(id"Choose a Captain""PlayersMenuHandler");
    
menu_setprop(iMenu10"\y");
    
menu_display(idiMenuMaxClients, -1);
    return 
0;
}

MakePlayerMenu(_arg0szMenuTitle[], szMenuHandler[])
{
    new 
iMenu menu_create(szMenuTitleszMenuHandlerMaxClients);
    new 
iPlayers[32];
    new 
iNum;
    new 
iPlayer;
    new 
szPlayerName[32];
    new 
szUserId[33];
    
get_players(iPlayersiNum1611616124);
    new 
i;
    while (
iNum)
    {
        
iPlayer iPlayers[i];
        if (
get_user_team(iPlayer, {0}, MaxClients) == 3)
        {
            
get_user_name(iPlayerszPlayerName31);
            
formatex(szUserId32"%d"get_user_userid(iPlayer));
            
menu_additem(iMenuszPlayerNameszUserIdMaxClients, -1);
        }
        
i++;
    }
    return 
iMenu;
}

public 
PlayersMenuHandler(idiMenuiItem)
{
    if (
iItem == -3)
    {
        new 
iMenu MakePlayerMenu(id"Choose a Captain""PlayersMenuHandler");
        
menu_setprop(iMenu10"\y");
        
menu_display(idiMenuMaxClients, -1);
        return 
1;
    }
    new 
szUserId[32];
    new 
szPlayerName[32];
    new 
iPlayer;
    new 
iCallback;
    
menu_item_getinfo(iMenuiItemiCallbackszUserId31szPlayerName31iCallback);
    if ((
iPlayer find_player(16300str_to_num(szUserId))))
    {
        if (
CaptainCount)
        {
            if (
CaptainCount == 1)
            {
                
cs_set_user_team(iPlayer1MaxClients1);
                new 
ChosenCaptain[32];
                
get_user_name(iPlayerChosenCaptain31);
                
chatcolor(0"!t[NamVr WAR] !gPlayer  !t%s chosen !yas Second !tCaptain! "ChosenCaptain);
                
CaptainCount += 1;
                
get_user_name(iPlayerTempSecondCaptain31);
                
gCptT iPlayer;
                
CaptainSChosen true;
                
set_dhudmessage(255MaxClientsMaxClients, -1082130432, -1082130432MaxClients1073741824108632473610619977731061997773);
                
show_dhudmessage(MaxClients"Get Ready Captains! \n The Knife Round will Start in 10 seconds....");
                
chatcolor(0"!t[NamVr WAR] !gAttention ! !yThe !tKnife Round !gWill Start in 10 seconds!");
                
set_task(1092616192"Knife_Round"MaxClients6240MaxClients10004MaxClients);
                
menu_destroy(iMenu);
                return 
1;
            }
        }
        
cs_set_user_team(iPlayer2MaxClients1);
        new 
ChosenCaptain[32];
        
get_user_name(iPlayerChosenCaptain31);
        
chatcolor(0"!t[NamVr WAR] !gPlayer  !t%s chosen !yas  First !tCaptain! "ChosenCaptain);
        
CaptainCount += 1;
        
get_user_name(iPlayerTempFirstCaptain31);
        
gCptCT iPlayer;
        
menu_destroy(iMenu);
        new 
iMenu MakePlayerMenu(id"Choose a Captain""PlayersMenuHandler");
        
menu_setprop(iMenu10"\y");
        
menu_display(idiMenuMaxClients, -1);
        return 
1;
    }
    new 
iMenu MakePlayerMenu(id"Choose a Captain""PlayersMenuHandler");
    
menu_setprop(iMenu10"\y");
    
menu_display(idiMenuMaxClients, -1);
    return 
1;
}

public 
Knife_Round()
{
    
set_cvar_string("amx_warname""Captain Knife WAR");
    
server_cmd("mp_autoteambalance 0");
    
server_cmd("afk_time 1200.0");
    
server_cmd("afk_spec_time 1200.0");
    
set_task(1077936128"GiveRestartRound"MaxClients6240MaxClients181283);
    
set_task(1092616192"SetKnifeRoundTrue"MaxClients6240MaxClients10004MaxClients);
    return 
0;
}

public 
SetKnifeRoundTrue()
{
    
g_KnifeRound true;
    return 
0;
}

public 
round_end()
{
    if (
g_MatchStarted)
    {
        
RoundCounter += 1;
        
ShowScoreHud();
        
CheckForWinningTeam();
        if (
RoundCounter == 15)
        {
            
server_cmd("mp_freezetime 999");
            
set_task(1088421888"SwapTeamsMessage"MaxClients6240MaxClients10004MaxClients);
        }
        
balance_teams();
    }
    return 
0;
}

public 
screenshot_setup()
{
    new 
players[32];
    new 
number;
    
get_players(playersnumber1834816124);
    new 
i;
    while (
number)
    {
        
client_cmd(players[i], "+showscores");
        
i++;
    }
    return 
0;
}

public 
screenshot_take()
{
    new 
players[32];
    new 
number;
    
get_players(playersnumber1840416124);
    new 
i;
    while (
number)
    {
        
client_cmd(players[i], "snapshot");
        
i++;
    }
    
set_task(1073741824"screenshot_scoreboard_remove"MaxClients6240MaxClients10004MaxClients);
    return 
0;
}

public 
screenshot_scoreboard_show()
{
    
set_task(1065353216"screenshot_setup"MaxClients6240MaxClients10004MaxClients);
    
set_task(1077936128"screenshot_take"MaxClients6240MaxClients10004MaxClients);
    return 
0;
}

public 
screenshot_scoreboard_remove()
{
    new 
players[32];
    new 
number;
    
get_players(playersnumber1840416124);
    new 
i;
    while (
number)
    {
        
client_cmd(players[i], "-showscores");
        
i++;
    }
    return 
0;
}

public 
ChooseTeam(id)
{
    
set_cvar_string("amx_warname""Captain Team Selection");
    
set_dhudmessage(255255255, -1082130432, -1082130432MaxClients1073741824108632473610619977731061997773);
    
show_dhudmessage(MaxClients"Captain %s will Choose Team and Players First !"FirstCaptainName);
    new 
TeamChooser MakeTeamSelectorMenu(id"Please Choose the Team.""TeamHandler");
    
menu_setprop(TeamChooser10"\y");
    
menu_display(idTeamChooserMaxClients, -1);
    return 
0;
}

MakeTeamSelectorMenu(_arg0szMenuTitle[], szMenuHandler[])
{
    new 
TeamChooser menu_create(szMenuTitleszMenuHandlerMaxClients);
    
menu_additem(TeamChooser"Counter-Terrorist"19300MaxClients, -1);
    
menu_additem(TeamChooser"Terrorist"19300MaxClients, -1);
    return 
TeamChooser;
}

public 
TeamHandler(idTeamChooseriItem)
{
    if (
iItem == -3)
    {
        new 
TeamChooser MakeTeamSelectorMenu(id"Please Choose the Team.""TeamHandler");
        
menu_setprop(TeamChooser10"\y");
        
menu_display(idTeamChooserMaxClients, -1);
        return 
1;
    }
    switch (
iItem)
    {
        case 
0:
        {
            
chatcolor(0"!t[NamVr WAR] !gCaptain !t%s !ychosen Team- !gCounter-Terrorist"FirstCaptainName);
            
FirstCaptainTeamName 2;
            
SecondCaptainTeamName 1;
            if (
get_user_team(id, {0}, MaxClients) != 2)
            {
                
SwapPlayer();
            }
            
set_cvar_string("amx_warname""=[ Players Selection ]=");
            
set_task(1084227584"LetsFirstChoosePlayers"id6240MaxClients10004MaxClients);
        }
        case 
1:
        {
            
FirstCaptainTeamName 1;
            
SecondCaptainTeamName 2;
            
chatcolor(0"!t[NamVr WAR] !gCaptain !t%s !ychosen Team- !gTerrorist"FirstCaptainName);
            if (
get_user_team(id, {0}, MaxClients) != 1)
            {
                
SwapPlayer();
            }
            
set_cvar_string("amx_warname""Players Selection");
            
set_task(1084227584"LetsFirstChoosePlayers"id6240MaxClients10004MaxClients);
        }
        default:
        {
        }
    }
    return 
1;
}

public 
LetsFirstChoosePlayers(id)
{
    new 
players[32];
    new 
count;
    
get_players(playerscount"eh""SPECTATOR");
    if (
count)
    {
        new 
iChoosePlayers LetsFirstChoosePlayersMenu(id"Choose A player.""LetsFirstChoosePlayersHandler");
        
menu_setprop(iChoosePlayers10"\y");
        
menu_display(idiChoosePlayersMaxClients, -1);
        return 
1;
    }
    
set_cvar_string("amx_warname""Teams Are Set!");
    
set_dhudmessage(MaxClients255MaxClients, -1082130432, -1082130432MaxClients1073741824108632473610619977731061997773);
    
show_dhudmessage(MaxClients"Teams are SET ! \n \n First Half will start Now.......");
    
set_task(1073741824"GiveRestartRound"MaxClients6240MaxClients10004MaxClients);
    
set_task(1082130432"LiveOnThreeRestart"MaxClients6240MaxClients10004MaxClients);
    
set_task(1090519040"StartMatch"MaxClients6240MaxClients10004MaxClients);
    return 
1;
}

LetsFirstChoosePlayersMenu(_arg0szMenuTitle[], szMenuHandler[])
{
    new 
iChoosePlayers menu_create(szMenuTitleszMenuHandlerMaxClients);
    new 
iPlayers[32];
    new 
iNum;
    new 
iPlayer;
    new 
szPlayerName[32];
    new 
szUserId[32];
    
get_players(iPlayersiNum2118016124);
    new 
i;
    while (
iNum)
    {
        
iPlayer iPlayers[i];
        if (
get_user_team(iPlayer, {0}, MaxClients) == 3)
        {
            
get_user_name(iPlayerszPlayerName31);
            
formatex(szUserId31"%d"get_user_userid(iPlayer));
            
menu_additem(iChoosePlayersszPlayerNameszUserIdMaxClients, -1);
        }
        
i++;
    }
    return 
iChoosePlayers;
}

public 
LetsFirstChoosePlayersHandler(idiChoosePlayersiItem)
{
    if (
iItem == -3)
    {
        new 
iChoosePlayers LetsFirstChoosePlayersMenu(id"Choose A player.""LetsFirstChoosePlayersHandler");
        
menu_setprop(iChoosePlayers10"\y");
        
menu_display(idiChoosePlayersMaxClients, -1);
        return 
1;
    }
    new 
szUserId[32];
    new 
szPlayerName[32];
    new 
iPlayer;
    new 
iCallback;
    
menu_item_getinfo(iChoosePlayersiItemiCallbackszUserId31szPlayerName31iCallback);
    if ((
iPlayer find_player(21400str_to_num(szUserId))))
    {
        new 
ChoosenPlayer[32];
        
get_user_name(iPlayerChoosenPlayer31);
        
chatcolor(0"!t[NamVr WAR] !gCaptain !t%s !gchose !yPlayer !t%s  "FirstCaptainNameChoosenPlayer);
        if (!
is_user_connected(iPlayer))
        {
            new 
iChoosePlayers LetsFirstChoosePlayersMenu(id"Choose A player.""LetsFirstChoosePlayersHandler");
            
menu_setprop(iChoosePlayers10"\y");
            
menu_display(idiChoosePlayersMaxClients, -1);
            return 
1;
        }
        
CaptainChoosenID id;
        
WhoChoseThePlayer 1;
        
cs_set_user_team(iPlayercs_get_user_team(id0), MaxClients1);
        
LetsSecondChoosePlayers(ShowMenuSecond);
        return 
1;
    }
    return 
1;
}

public 
LetsSecondChoosePlayers(id)
{
    new 
players[32];
    new 
count;
    
get_players(playerscount"eh""SPECTATOR");
    if (
count)
    {
        new 
iChoosePlayers LetsSecondChoosePlayersMenu(id"Choose A player.""LetsSecondChoosePlayersHandler");
        
menu_setprop(iChoosePlayers10"\y");
        
menu_display(idiChoosePlayersMaxClients, -1);
        return 
1;
    }
    
set_dhudmessage(MaxClients255MaxClients, -1082130432, -1082130432MaxClients1073741824108632473610619977731061997773);
    
show_dhudmessage(MaxClients"Teams are SET ! \n \n First Half will start Now.......");
    
set_task(1073741824"GiveRestartRound"MaxClients6240MaxClients10004MaxClients);
    
set_task(1082130432"LiveOnThreeRestart"MaxClients6240MaxClients10004MaxClients);
    
set_task(1090519040"StartMatch"MaxClients6240MaxClients10004MaxClients);
    return 
1;
}

LetsSecondChoosePlayersMenu(_arg0szMenuTitle[], szMenuHandler[])
{
    new 
iChoosePlayers menu_create(szMenuTitleszMenuHandlerMaxClients);
    new 
iPlayers[32];
    new 
iNum;
    new 
iPlayer;
    new 
szPlayerName[32];
    new 
szUserId[32];
    
get_players(iPlayersiNum2247216124);
    new 
i;
    while (
iNum)
    {
        
iPlayer iPlayers[i];
        if (
get_user_team(iPlayer, {0}, MaxClients) == 3)
        {
            
get_user_name(iPlayerszPlayerName31);
            
formatex(szUserId31"%d"get_user_userid(iPlayer));
            
menu_additem(iChoosePlayersszPlayerNameszUserIdMaxClients, -1);
        }
        
i++;
    }
    return 
iChoosePlayers;
}

public 
LetsSecondChoosePlayersHandler(idiChoosePlayersiItem)
{
    if (
iItem == -3)
    {
        new 
iChoosePlayers LetsSecondChoosePlayersMenu(id"Choose A player.""LetsSecondChoosePlayersHandler");
        
menu_setprop(iChoosePlayers10"\y");
        
menu_display(idiChoosePlayersMaxClients, -1);
        return 
1;
    }
    new 
szUserId[32];
    new 
szPlayerName[32];
    new 
iPlayer;
    new 
iCallback;
    
menu_item_getinfo(iChoosePlayersiItemiCallbackszUserId31szPlayerName31iCallback);
    if ((
iPlayer find_player(22696str_to_num(szUserId))))
    {
        new 
ChoosenPlayer[32];
        
get_user_name(iPlayerChoosenPlayer31);
        
chatcolor(0"!t[NamVr WAR] !gCaptain !t%s !gchose !yPlayer !t%s  "SecondCaptainNameChoosenPlayer);
        if (!
is_user_connected(iPlayer))
        {
            new 
iChoosePlayers LetsSecondChoosePlayersMenu(id"Choose A player.""LetsSecondChoosePlayersHandler");
            
menu_setprop(iChoosePlayers10"\y");
            
menu_display(idiChoosePlayersMaxClients, -1);
            return 
1;
        }
        
WhoChoseThePlayer 2;
        
CaptainChoosenID id;
        
cs_set_user_team(iPlayercs_get_user_team(id0), MaxClients1);
        
LetsFirstChoosePlayers(ShowMenuFirst);
        return 
1;
    }
    return 
1;
}

public 
client_disconnected(id)
{
    new 
var1;
    if (
CaptainSChosen || g_KnifeRound)
    {
        new 
var2;
        if (
gCptCT != id && gCptT != id)
        {
            if (
is_user_connected(MatchStarterOwner))
            {
                
set_hudmessage(MaxClients255MaxClients, -1082130432, -1082130432MaxClients1073741824108632473610619977731061997773, -1);
                
show_hudmessage(MaxClients"Restarting the Match! \n One of the Captain left the Game.");
                
RestartMatchTask(MatchStarterOwner);
            }
            
StopMatchSpecial();
        }
    }
    if (
g_MatchStarted)
    {
        
g_TotalLeaves += 1;
        
g_TotalKills[id] = 0;
        
g_TotalDeaths[id] = 0;
        
g_BombPlants[id] = 0;
        
g_BombDefusions[id] = 0;
    }
    return 
0;
}

public 
DoRanking()
{
    new 
KillerName[256];
    new 
DeathsName[256];
    new 
BombPName[256];
    new 
BombDName[256];
    new 
players[32];
    new 
pnum;
    new 
tempid;
    new 
topKillerID;
    new 
topDeathsID;
    new 
topBombPID;
    new 
topBombDID;
    new 
topKills;
    new 
topDeaths;
    new 
topBombP;
    new 
topBombD;
    
get_players(playerspnum1840416124);
    new 
i;
    while (
pnum)
    {
        
tempid players[i];
        new 
var1;
        if (
g_TotalKills[tempid] >= topKills && g_TotalKills[tempid])
        {
            
topKills g_TotalKills[tempid];
            
topKillerID tempid;
        }
        new 
var2;
        if (
g_TotalDeaths[tempid] >= topDeaths && g_TotalDeaths[tempid])
        {
            
topDeaths g_TotalDeaths[tempid];
            
topDeathsID tempid;
        }
        new 
var3;
        if (
g_BombPlants[tempid] >= topBombP && g_BombPlants[tempid])
        {
            
topBombP g_BombPlants[tempid];
            
topBombPID tempid;
        }
        new 
var4;
        if (
g_BombDefusions[tempid] >= topBombD && g_BombDefusions[tempid])
        {
            
topBombD g_BombDefusions[tempid];
            
topBombDID tempid;
        }
        
i++;
    }
    if (
<= topKillerID <= gMaxPlayers)
    {
        
get_user_name(topKillerIDKillerName255);
    }
    if (
<= topDeathsID <= gMaxPlayers)
    {
        
get_user_name(topDeathsIDDeathsName255);
    }
    if (
<= topBombPID <= gMaxPlayers)
    {
        
get_user_name(topBombPIDBombPName255);
    }
    if (
<= topBombDID <= gMaxPlayers)
    {
        
get_user_name(topBombDIDBombDName255);
    }
    new 
i;
    while (
pnum)
    {
        
tempid players[i];
        new 
var5;
        if (
topKills == g_TotalKills[tempid] && topKillerID != tempid && g_TotalKills[tempid])
        {
            new 
lineToAdd[65] = {44,32,0};
            new 
pName[64];
            
get_user_name(tempidpName63);
            
add(lineToAdd64pNameMaxClients);
            
add(KillerName255 strlen(BombDName), lineToAddMaxClients);
        }
        new 
var6;
        if (
topDeaths == g_TotalDeaths[tempid] && topDeathsID != tempid && g_TotalDeaths[tempid])
        {
            new 
lineToAdd[65] = {44,32,0};
            new 
pName[64];
            
get_user_name(tempidpName63);
            
add(lineToAdd64pNameMaxClients);
            
add(DeathsName255 strlen(DeathsName), lineToAddMaxClients);
        }
        new 
var7;
        if (
topBombP == g_BombPlants[tempid] && topBombPID != tempid && g_BombPlants[tempid])
        {
            new 
lineToAdd[65] = {44,32,0};
            new 
pName[64];
            
get_user_name(tempidpName63);
            
add(lineToAdd64pNameMaxClients);
            
add(BombPName255 strlen(BombPName), lineToAddMaxClients);
        }
        new 
var8;
        if (
topBombD == g_BombDefusions[tempid] && topBombDID != tempid && g_BombDefusions[tempid])
        {
            new 
lineToAdd[65] = {44,32,0};
            new 
pName[64];
            
get_user_name(tempidpName63);
            
add(lineToAdd64pNameMaxClients);
            
add(BombDName255 strlen(BombDName), lineToAddMaxClients);
        }
        
i++;
    }
    new 
var9;
    if (
strlen(BombDName))
    {
        
var9 BombDName;
    }
    else
    {
        
var9 24324;
    }
    new 
var10;
    if (
strlen(BombPName))
    {
        
var10 BombPName;
    }
    else
    {
        
var10 24304;
    }
    new 
var11;
    if (
strlen(DeathsName))
    {
        
var11 DeathsName;
    }
    else
    {
        
var11 24284;
    }
    new 
var12;
    if (
strlen(KillerName))
    {
        
var12 KillerName;
    }
    else
    {
        
var12 24264;
    }
    
format(msgToDisplay455msgToDisplayvar12topKillsvar11topDeathsvar10topBombPvar9topBombDg_TotalLeaves);
    new 
taskId 6969;
    
set_task(1065353216"displayRankingTable"taskIdmsgToDisplaystrlen(msgToDisplay), 24424MaxClients);
    return 
0;
}

public 
displayRankingTable(msgToDisplay[], taskId)
{
    
set_hudmessage(135135135, -1082130432, -1082130432MaxClients1086324736108632473610569646081041865114, -1);
    
show_hudmessage(MaxClientsmsgToDisplay);
    return 
0;
}

public 
cmdChooseTeam(id)
{
    new 
var1;
    if (
g_MatchInit || g_KnifeRound || g_MatchStarted)
    {
        if (
cs_get_user_team(id0) == 3)
        {
            return 
1;
        }
        
chatcolor(id"!g[NamVr WAR] !tYou cannot !gchoose !ta team !ywhile !gMatch !yis !tgoing on.");
        return 
1;
    }
    return 
0;
}

public 
Event_CurWeapon_NotKnife(id)
{
    if (!
g_KnifeRound)
    {
        return 
0;
    }
    if (!
user_has_weapon(id29, -1))
    {
        
give_item(id"weapon_knife");
    }
    
engclient_cmd(id"weapon_knife"248448812);
    return 
0;
}

public 
cmdTeamSwap()
{
    new 
players[32];
    new 
num;
    
get_players(playersnum1840416124);
    new 
player;
    new 
i;
    while (
num)
    {
        
player players[i];
        new 
var1;
        if (
cs_get_user_team(player0) == 1)
        {
            
var1 2;
        }
        else
        {
            
var1 1;
        }
        
cs_set_user_team(playervar1MaxClients1);
        
i++;
    }
    return 
1;
}

public 
SwapPlayer()
{
    new 
players[32];
    new 
num;
    
get_players(playersnum1840416124);
    new 
player;
    new 
i;
    while (
num)
    {
        
player players[i];
        if (
get_user_team(player, {0}, MaxClients) != 3)
        {
            new 
var1;
            if (
cs_get_user_team(player0) == 1)
            {
                
var1 2;
            }
            else
            {
                
var1 1;
            }
            
cs_set_user_team(playervar1MaxClients1);
        }
        
i++;
    }
    return 
1;
}

public 
cmdTransferAllInSpec()
{
    new 
Players[32];
    new 
playerCount;
    new 
player;
    
get_players(PlayersplayerCount2484816124);
    new 
i;
    while (
playerCount)
    {
        
player Players[i];
        new 
CsTeams:team cs_get_user_team(player0);
        new 
var1;
        if (!
team == && !team == && is_user_connected(player))
        {
            
user_silentkill(player1);
            
cs_set_user_team(player3MaxClients1);
        }
        
i++;
    }
    return 
1;
}

public 
StartMatch()
{
    
set_cvar_string("amx_warname""[NamVr-WAR] Started!");
    
server_cmd("mp_forcerespawn 0");
    
set_task(1077936128"GiveRestartRound"MaxClients6240MaxClients251243);
    
g_MatchInit false;
    
CaptainSChosen false;
    
chatcolor(0"!t[NamVr WAR] !yPlease !gTry !yNot to !tLeave !gThe Match!");
    
chatcolor(0"!t[NamVr WAR] !tFirst Half !gStarted");
    
chatcolor(0"!t[NamVr WAR] !gAttention ! !yThe !tMatch !yHas Been !g STARTED !");
    new 
ServerName[512];
    
formatex(ServerName511"NamVr |[NamVr WAR]- %s VS. %s In Progress"FirstCaptainNameSecondCaptainName);
    
server_cmd("hostname \"%s\""ServerName);
    
ServerName[0] = 0;
    
server_cmd("afk_time 80.0");
    
server_cmd("afk_spec_time 180.0");
    
set_task(1093664768"MatchStartedTrue"MaxClients6240MaxClients10004MaxClients);
    
isFirstHalfStarted true;
    
balance_teams();
    
set_task(1094713344"FirstHalfHUDMessage"MaxClients6240MaxClients10004MaxClients);
    return 
0;
}

public 
SwapTeamsMessage()
{
    
GiveRestartRound();
    
set_task(1077936128"TeamSwapMessage"MaxClients6240MaxClients10004MaxClients);
    
set_task(1088421888"FirstHalfCompletedHUDMessage"MaxClients6240MaxClients10004MaxClients);
    
set_task(1094713344"SwapTeamsAndRestartMatch"MaxClients6240MaxClients10004MaxClients);
    return 
0;
}

public 
SwapTeamsAndRestartMatch()
{
    
cmdTeamSwap();
    
GiveRestartRound();
    
set_task(1073741824"LiveOnThreeRestart"MaxClients6240MaxClients10004MaxClients);
    
set_task(1082130432"GiveRestartRound"MaxClients6240MaxClients266923);
    
chatcolor(0"!t[NamVr WAR] !gTeams !yHave Been !gSwapped !");
    
chatcolor(0"!t[NamVr WAR] !gSecond half !yhas been !gStarted !");
    
is_secondHalf true;
    
isFirstHalfStarted false;
    
isSecondHalfStarted true;
    
set_task(1096810496"SecondHalfHUDMessage"MaxClients6240MaxClients10004MaxClients);
    
LoadMatchSettings();
    return 
0;
}

chatcolor(idinput[])
{
    new 
count 1;
    new 
players[32];
    static 
msg[191];
    
vformat(msg190input3);
    
replace_all(msg190"!g"27940);
    
replace_all(msg190"!y"27960);
    
replace_all(msg190"!t"27980);
    
replace_all(msg190"!m"28000);
    if (
id)
    {
        
players[0] = id;
    }
    else
    {
        
get_players(playerscount"ch"16124);
    }
    new 
i;
    while (
count)
    {
        if (
is_user_connected(players[i]))
        {
            
message_begin(NULL_VECTORget_user_msgid("SayText"), 9332players[i]);
            
write_byte(players[i]);
            
write_string(msg);
            
message_end();
        }
        
i++;
    }
    return 
0;
}

public 
ShowScoreHud()
{
    new 
score_message[1024];
    if (
ScoreFtrstTeam ScoreScondteam)
    {
        
format(score_message1023"* [NamVr-WAR] Team [ %s ] winning %i to  %i "FirstCaptainNameScoreFtrstTeamScoreScondteam);
        
set_dhudmessage(255255MaxClientsMaxClients1063675494MaxClients1073741824108422758410619977731061997773);
        
show_dhudmessage(MaxClientsscore_message);
    }
    if (
ScoreScondteam ScoreFtrstTeam)
    {
        
format(score_message1023"* [NamVr-WAR] Team [ %s ] winning %i To %i"SecondCaptainNameScoreScondteamScoreFtrstTeam);
        
set_dhudmessage(255255MaxClientsMaxClients1063675494MaxClients1073741824108422758410619977731061997773);
        
show_dhudmessage(MaxClientsscore_message);
    }
    if (
ScoreScondteam == ScoreFtrstTeam)
    {
        
format(score_message1023"* [NamVr-WAR] Both Teams Have Won %i Rounds."ScoreScondteam);
        
set_dhudmessage(255255MaxClientsMaxClients1063675494MaxClients1073741824108422758410619977731061997773);
        
show_dhudmessage(MaxClientsscore_message);
    }
    return 
0;
}

public 
CheckForWinningTeam()
{
    if (
ScoreFtrstTeam >= 16)
    {
        new 
GameDescBuffer[32];
        
formatex(GameDescBuffer31"GG! %d To %d"ScoreFtrstTeamScoreScondteam);
        
set_cvar_string("amx_warname"GameDescBuffer);
        
server_cmd("mp_freezetime 99999");
        
set_task(1088421888"FirstTeamWinnerMessage"MaxClients6240MaxClients10004MaxClients);
    }
    if (
ScoreScondteam >= 16)
    {
        new 
GameDescBuffer[32];
        
formatex(GameDescBuffer31"GG! %d To %d"ScoreScondteamScoreFtrstTeam);
        
set_cvar_string("amx_warname"GameDescBuffer);
        
server_cmd("mp_freezetime 99999");
        
set_task(1088421888"SecondTeamWinnerMessage"MaxClients6240MaxClients10004MaxClients);
    }
    if (
ScoreScondteam == 15 ScoreFtrstTeam == 15)
    {
        
set_cvar_string("amx_warname""WAR Draw!");
        
server_cmd("mp_freezetime 99999");
        
server_cmd("sv_restart 1");
        
set_task(1073741824"MatchDrawMessage"MaxClients6240MaxClients10004MaxClients);
    }
    return 
0;
}

public 
TransferToSpec(id)
{
    new 
CsTeams:team cs_get_user_team(id0);
    new 
var1;
    if (
is_user_connected(id) && !team == && !team == 0)
    {
        new 
TransferedName[32];
        
get_user_name(idTransferedName31);
        
user_silentkill(id1);
        
cs_set_user_team(id3MaxClients1);
    }
    return 
1;
}

public 
FirstTeamWonTheMatch()
{
    
set_dhudmessage(MaxClients255MaxClients, -1082130432, -1082130432MaxClients1073741824108632473610619977731061997773);
    
show_dhudmessage(MaxClients"Team [ %s ]  Won The Match !! \n GG WP To Team %s .."FirstCaptainNameFirstCaptainName);
    
set_cvar_string("amx_warname""-= WAR Not Started! =-");
    return 
0;
}

public 
SecondTeamWonTheMatch()
{
    
set_dhudmessage(MaxClients255MaxClients, -1082130432, -1082130432MaxClients1073741824108632473610619977731061997773);
    
show_dhudmessage(MaxClients"Team [ %s ] Won The Match !! \n GG WP To Team %s  !"SecondCaptainNameSecondCaptainName);
    
set_cvar_string("amx_warname""-= WAR Not Started! =-");
    return 
0;
}

public 
MatchDraw()
{
    
set_dhudmessage(MaxClients255MaxClients, -1082130432, -1082130432MaxClients1073741824108632473610619977731061997773);
    
show_dhudmessage(MaxClients"= { Match Draw } = \n GG WP To Both Teams :D");
    
set_cvar_string("amx_warname""-= WAR Not Started! =-");
    return 
0;
}

public 
LoadMatchSettings()
{
    
server_cmd("ajc_team 5");
    
server_cmd("ajc_class 5");
    
server_cmd("mp_forcechasecam 2");
    
server_cmd("mp_forcecamera 2");
    
server_cmd("sv_alltalk 2");
    
server_cmd("mp_autoteambalance 2");
    
server_cmd("mp_freezetime 10");
    return 
0;
}

public 
LoadPubSettings()
{
    
set_cvar_string("amx_warname""-= WAR Not Started! =-");
    
CaptainChoosenID 0;
    
WhoChoseThePlayer 0;
    
g_TotalLeaves 0;
    
g_TotalKills[0] = 0;
    
g_TotalDeaths[0] = 0;
    
g_BombPlants[0] = 0;
    
g_BombDefusions[0] = 0;
    
msgToDisplay[0] = 0;
    
remove_task(6969MaxClients);
    
server_cmd("jp_active 0");
    
server_cmd("sv_gravity 800");
    
isFirstHalfStarted false;
    
isSecondHalfStarted false;
    
server_cmd("ajc_team 0");
    
server_cmd("ajc_class 0");
    
FirstCaptainTeamName 0;
    
SecondCaptainTeamName 0;
    
MatchStarterOwner 0;
    
CaptainSChosen false;
    
g_KnifeRound false;
    
is_secondHalf false;
    
g_MatchInit false;
    
g_MatchStarted false;
    
RoundCounter 0;
    
gCptT 0;
    
gCptCT 0;
    
CaptainCount 0;
    
ScoreFtrstTeam 0;
    
ScoreScondteam 0;
    
ShowMenuFirst 0;
    
ShowMenuSecond 0;
    
FirstCaptainName[0] = 0;
    
SecondCaptainName[0] = 0;
    
TempFirstCaptain[0] = 0;
    
TempSecondCaptain[0] = 0;
    
server_cmd("exec server.cfg");
    
set_task(1077936128"GiveRestartRound"MaxClients6240MaxClients313281);
    return 
0;
}

public 
FirstTeamWinnerMessage()
{
    
GiveRestartRound();
    
set_task(1077936128"MatchIsOverHUDMessage"MaxClients6240MaxClients10004MaxClients);
    
set_task(1088421888"SecondHalfCompletedHUDMessage"MaxClients6240MaxClients10004MaxClients);
    
set_task(1095761920"FirstTeamWonTheMatch"MaxClients6240MaxClients10004MaxClients);
    
set_task(1101004800"DoRanking"MaxClients6240MaxClients10004MaxClients);
    
set_task(1107296256"LoadPubSettings"MaxClients6240MaxClients10004MaxClients);
    return 
0;
}

public 
SecondTeamWinnerMessage()
{
    
GiveRestartRound();
    
set_task(1077936128"MatchIsOverHUDMessage"MaxClients6240MaxClients10004MaxClients);
    
set_task(1088421888"SecondHalfCompletedHUDMessage"MaxClients6240MaxClients10004MaxClients);
    
set_task(1095761920"SecondTeamWonTheMatch"MaxClients6240MaxClients10004MaxClients);
    
set_task(1101004800"DoRanking"MaxClients6240MaxClients10004MaxClients);
    
set_task(1107296256"LoadPubSettings"MaxClients6240MaxClients10004MaxClients);
    return 
0;
}

public 
MatchDrawMessage()
{
    
set_task(1077936128"MatchIsOverHUDMessage"MaxClients6240MaxClients10004MaxClients);
    
set_task(1088421888"SecondHalfCompletedHUDMessage"MaxClients6240MaxClients10004MaxClients);
    
set_task(1095761920"MatchDraw"MaxClients6240MaxClients10004MaxClients);
    
set_task(1101004800"DoRanking"MaxClients6240MaxClients10004MaxClients);
    
set_task(1107296256"LoadPubSettings"MaxClients6240MaxClients10004MaxClients);
    return 
0;
}

public 
SecondCaptWonKnifeRoundWonMessage(id)
{
    
set_dhudmessage(255255255, -1082130432, -1082130432MaxClients1073741824107793612810619977731061997773);
    
show_dhudmessage(MaxClients"Captain [ %s ] Won the Knife Round !"FirstCaptainName);
    
chatcolor(0"!t[NamVr WAR] !gCaptain !t%s !gWon !ythe !tKnife Round !"FirstCaptainName);
    
set_task(1084227584"ChooseTeam"gCptCT6240MaxClients10004MaxClients);
    return 
0;
}

public 
FirstCaptainWonKnifeRoundMessage(id)
{
    
set_dhudmessage(255255255, -1082130432, -1082130432MaxClients1073741824107793612810619977731061997773);
    
show_dhudmessage(MaxClients"Captain [ %s ] Won the Knife Round !"FirstCaptainName);
    
chatcolor(0"!t[NamVr WAR] !gCaptain !t%s !gWon !ythe !tKnife Round !"FirstCaptainName);
    
set_task(1084227584"ChooseTeam"gCptT6240MaxClients10004MaxClients);
    return 
0;
}

public 
ShowScoreToUser(id)
{
    if (
g_MatchStarted)
    {
        if (
isFirstHalfStarted)
        {
            new 
var1;
            if (
FirstCaptainTeamName == && get_user_team(id, {0}, MaxClients) == 2)
            {
                
chatcolor(id"!t[NamVr WAR] !yYour !gTeam's Score !yis: !t%i | !gOpponent's Team !tScore: !t %i"ScoreScondteamScoreFtrstTeam);
            }
            new 
var2;
            if (
FirstCaptainTeamName == && get_user_team(id, {0}, MaxClients) == 1)
            {
                
chatcolor(id"!t[NamVr WAR] !yYour !gTeam's Score !yis: !t%i | !gOpponent's Team !tScore: !t %i"ScoreFtrstTeamScoreScondteam);
            }
            new 
var3;
            if (
FirstCaptainTeamName == && get_user_team(id, {0}, MaxClients) == 2)
            {
                
chatcolor(id"!t[NamVr WAR] !yYour !gTeam's Score !yis: !t%i | !gOpponent's Team !tScore: !t %i"ScoreFtrstTeamScoreScondteam);
            }
            new 
var4;
            if (
FirstCaptainTeamName == && get_user_team(id, {0}, MaxClients) == 1)
            {
                
chatcolor(id"!t[NamVr WAR] !yYour !gTeam's Score !yis: !t%i | !gOpponent's Team !tScore: !t %i"ScoreScondteamScoreFtrstTeam);
            }
        }
        if (
isSecondHalfStarted)
        {
            new 
var5;
            if (
FirstCaptainTeamName == && get_user_team(id, {0}, MaxClients) == 2)
            {
                
chatcolor(id"!t[NamVr WAR] !yYour !gTeam's Score !yis: !t%i | !gOpponent's Team !tScore: !t %i"ScoreFtrstTeamScoreScondteam);
            }
            new 
var6;
            if (
FirstCaptainTeamName == && get_user_team(id, {0}, MaxClients) == 1)
            {
                
chatcolor(id"!t[NamVr WAR] !yYour !gTeam's Score !yis: !t%i | !gOpponent's Team !tScore: !t %i"ScoreScondteamScoreFtrstTeam);
            }
            new 
var7;
            if (
FirstCaptainTeamName == && get_user_team(id, {0}, MaxClients) == 2)
            {
                
chatcolor(id"!t[NamVr WAR] !yYour !gTeam's Score !yis: !t%i | !gOpponent's Team !tScore: !t %i"ScoreScondteamScoreFtrstTeam);
            }
            new 
var8;
            if (
FirstCaptainTeamName == && get_user_team(id, {0}, MaxClients) == 1)
            {
                
chatcolor(id"!t[NamVr WAR] !yYour !gTeam's Score !yis: !t%i | !gOpponent's Team !tScore: !t %i"ScoreFtrstTeamScoreScondteam);
            }
        }
    }
    return 
0;
}

public 
ShowScoreOnRoundStart()
{
    new 
players[32];
    new 
num;
    new 
iPlayer;
    
get_players(playersnum3590816124);
    new 
i;
    while (
num)
    {
        
iPlayer players[i];
        if (
isFirstHalfStarted)
        {
            new 
var1;
            if (
FirstCaptainTeamName == && get_user_team(iPlayer, {0}, MaxClients) == 2)
            {
                
chatcolor(iPlayer"!t[NamVr WAR] !yYour !gTeam's Score !yis: !t%i | !gOpponent's Team !tScore: !t %i"ScoreScondteamScoreFtrstTeam);
            }
            new 
var2;
            if (
FirstCaptainTeamName == && get_user_team(iPlayer, {0}, MaxClients) == 1)
            {
                
chatcolor(iPlayer"!t[NamVr WAR] !yYour !gTeam's Score !yis: !t%i | !gOpponent's Team !tScore: !t %i"ScoreFtrstTeamScoreScondteam);
            }
            new 
var3;
            if (
FirstCaptainTeamName == && get_user_team(iPlayer, {0}, MaxClients) == 2)
            {
                
chatcolor(iPlayer"!t[NamVr WAR] !yYour !gTeam's Score !yis: !t%i | !gOpponent's Team !tScore: !t %i"ScoreFtrstTeamScoreScondteam);
            }
            new 
var4;
            if (
FirstCaptainTeamName == && get_user_team(iPlayer, {0}, MaxClients) == 1)
            {
                
chatcolor(iPlayer"!t[NamVr WAR] !yYour !gTeam's Score !yis: !t%i | !gOpponents !tScore: !t %i"ScoreScondteamScoreFtrstTeam);
            }
        }
        if (
isSecondHalfStarted)
        {
            new 
var5;
            if (
FirstCaptainTeamName == && get_user_team(iPlayer, {0}, MaxClients) == 2)
            {
                
chatcolor(iPlayer"!t[NamVr WAR] !yYour !gTeam's Score !yis: !t%i | !gOpponent's Team !tScore: !t %i"ScoreFtrstTeamScoreScondteam);
            }
            new 
var6;
            if (
FirstCaptainTeamName == && get_user_team(iPlayer, {0}, MaxClients) == 1)
            {
                
chatcolor(iPlayer"!t[NamVr WAR] !yYour !gTeam's Score !yis: !t%i | !gOpponent's Team !tScore: !t %i"ScoreScondteamScoreFtrstTeam);
            }
            new 
var7;
            if (
FirstCaptainTeamName == && get_user_team(iPlayer, {0}, MaxClients) == 2)
            {
                
chatcolor(iPlayer"!t[NamVr WAR] !yYour !gTeam's Score !yis: !t%i | !gOpponent's Team !tScore: !t %i"ScoreScondteamScoreFtrstTeam);
            }
            new 
var8;
            if (
FirstCaptainTeamName == && get_user_team(iPlayer, {0}, MaxClients) == 1)
            {
                
chatcolor(iPlayer"!t[NamVr WAR] !yYour !gTeam's Score !yis: !t%i | !gOpponent's Team !tScore: !t %i"ScoreFtrstTeamScoreScondteam);
            }
        }
        
i++;
    }
    return 
0;
}

public 
GiveRestartRound()
{
    
server_cmd("sv_restartround \"1\"");
    return 
0;
}

public 
message_show_menu(msgiddestid)
{
    if (!
should_autojoin(id))
    {
        return 
0;
    }
    static 
team_select[13] =
    {
        
3584101971099583101108101991160
    
};
    static 
menu_text_code[13];
    
get_msg_arg_string(NULL_STRINGmenu_text_code12);
    if (!
equal(menu_text_codeteam_selectMaxClients))
    {
        return 
0;
    }
    
set_force_team_join_task(idmsgid);
    return 
1;
}

public 
message_vgui_menu(msgiddestid)
{
    new 
var1;
    if (
get_msg_arg_int(1) == && !should_autojoin(id))
    {
        return 
0;
    }
    
set_force_team_join_task(idmsgid);
    return 
1;
}

bool:should_autojoin(id)
{
    new 
var2;
    return 
get_pcvar_num(g_pcvar_team) && !get_user_team(id, {0}, MaxClients) && !task_exists(idMaxClients) && (!get_pcvar_num(g_pcvar_imm) || !get_user_flags(idMaxClients) & 1);
}

set_force_team_join_task(idmenu_msgid)
{
    static 
param_menu_msgid[2];
    
param_menu_msgid[0] = menu_msgid;
    
set_task(1036831949"task_force_team_join"idparam_menu_msgid210004MaxClients);
    return 
0;
}

public 
task_force_team_join(menu_msgid[], id)
{
    if (
get_user_team(id, {0}, MaxClients))
    {
        return 
0;
    }
    static class[
2];
    static 
team[2];
    
get_pcvar_string(g_pcvar_teamteam1);
    
get_pcvar_string(g_pcvar_class, class, 1);
    
force_team_join(idmenu_msgid[0], team, class);
    return 
0;
}

force_team_join(idmenu_msgidteam[], class[])
{
    static 
jointeam[9] =
    {
        
106111105110116101971090
    
};
    if (class[
0] == 48)
    {
        
engclient_cmd(idjointeamteam8812);
        return 
0;
    }
    static 
joinclass[10] =
    {
        
10611110511099108971151150
    
};
    static 
msg_block;
    
msg_block get_msg_block(menu_msgid);
    
set_msg_block(menu_msgid2);
    
engclient_cmd(idjointeamteam8812);
    
engclient_cmd(idjoinclass, class, 8812);
    
set_msg_block(menu_msgidmsg_block);
    return 
0;
}

public 
FirstHalfHUDMessage()
{
    
set_dhudmessage(2557777, -1082130432MaxClients11077936128108213043210606555961060655596);
    
show_dhudmessage(MaxClients"  %s       %s                            %s                            %s       %s  ""LIVE""LIVE""LIVE""LIVE""LIVE");
    
set_dhudmessage(2557777, -1082130432103112769511077936128108213043210613266841061326684);
    
show_dhudmessage(MaxClients"  %s       %s                            %s                            %s       %s  ""LIVE""LIVE""LIVE""LIVE""LIVE");
    
set_dhudmessage(2557777, -1082130432104253620211077936128108213043210619977731061997773);
    
show_dhudmessage(MaxClients"  %s       %s                            %s                            %s       %s  ""LIVE""LIVE""LIVE""LIVE""LIVE");
    
set_dhudmessage(2557777, -1082130432104891154411077936128108213043210626688611062668861);
    
show_dhudmessage(MaxClients"  %s       %s                            %s                            %s       %s  ""LIVE""LIVE""LIVE""LIVE""LIVE");
    
set_dhudmessage(2557777, -1082130432105226698811077936128108213043210633399501063339950);
    
show_dhudmessage(MaxClients"  %s       %s                            %s                            %s       %s  ""LIVE""LIVE""LIVE""LIVE""LIVE");
    
set_dhudmessage(2557777, -1082130432105562243111077936128108213043210640110391064011039);
    
show_dhudmessage(MaxClients"  %s       %s                            %s                            %s       %s  ""LIVE""LIVE""LIVE""LIVE""LIVE");
    
set_dhudmessage(2557777, -1082130432105797124111077936128108213043210646821271064682127);
    
show_dhudmessage(MaxClients"  %s       %s                            %s                            %s       %s  ""LIVE""LIVE""LIVE""LIVE""LIVE");
    
set_dhudmessage(2557777, -1082130432105964896311077936128108213043210653532161065353216);
    
show_dhudmessage(MaxClients"  %s       %s                            %s                            %s       %s  ""LIVE""LIVE""LIVE""LIVE""LIVE");
    
set_dhudmessage(2557777, -1082130432106132668411077936128108213043210656887601065688760);
    
show_dhudmessage(MaxClients"  %s       %s                            %s                            %s       %s  ""LIVE""LIVE""LIVE""LIVE""LIVE");
    
set_dhudmessage(2557777, -1082130432106300440611077936128108213043210660243051066024305);
    
show_dhudmessage(MaxClients"  %s       %s                            %s                            %s       %s  ""LIVE""LIVE""LIVE""LIVE""LIVE");
    return 
0;
}

public 
SecondHalfHUDMessage()
{
    
set_dhudmessage(2557777, -1082130432MaxClients11077936128108213043210606555961060655596);
    
show_dhudmessage(MaxClients"  %s       %s                            %s                            %s       %s  ""LIVE""LIVE""LIVE""LIVE""LIVE");
    
set_dhudmessage(2557777, -1082130432103112769511077936128108213043210613266841061326684);
    
show_dhudmessage(MaxClients"  %s       %s                            %s                            %s       %s  ""LIVE""LIVE""LIVE""LIVE""LIVE");
    
set_dhudmessage(2557777, -1082130432104253620211077936128108213043210619977731061997773);
    
show_dhudmessage(MaxClients"  %s       %s                            %s                            %s       %s  ""LIVE""LIVE""LIVE""LIVE""LIVE");
    
set_dhudmessage(2557777, -1082130432104891154411077936128108213043210626688611062668861);
    
show_dhudmessage(MaxClients"  %s       %s                            %s                            %s       %s  ""LIVE""LIVE""LIVE""LIVE""LIVE");
    
set_dhudmessage(2557777, -1082130432105226698811077936128108213043210633399501063339950);
    
show_dhudmessage(MaxClients"  %s       %s                            %s                            %s       %s  ""LIVE""LIVE""LIVE""LIVE""LIVE");
    
set_dhudmessage(2557777, -1082130432105562243111077936128108213043210640110391064011039);
    
show_dhudmessage(MaxClients"  %s       %s                            %s                            %s       %s  ""LIVE""LIVE""LIVE""LIVE""LIVE");
    
set_dhudmessage(2557777, -1082130432105797124111077936128108213043210646821271064682127);
    
show_dhudmessage(MaxClients"  %s       %s                            %s                            %s       %s  ""LIVE""LIVE""LIVE""LIVE""LIVE");
    
set_dhudmessage(2557777, -1082130432105964896311077936128108213043210653532161065353216);
    
show_dhudmessage(MaxClients"  %s       %s                            %s                            %s       %s  ""LIVE""LIVE""LIVE""LIVE""LIVE");
    
set_dhudmessage(2557777, -1082130432106132668411077936128108213043210656887601065688760);
    
show_dhudmessage(MaxClients"  %s       %s                            %s                            %s       %s  ""LIVE""LIVE""LIVE""LIVE""LIVE");
    
set_dhudmessage(2557777, -1082130432106300440611077936128108213043210660243051066024305);
    
show_dhudmessage(MaxClients"  %s       %s                            %s                            %s       %s  ""LIVE""LIVE""LIVE""LIVE""LIVE");
    return 
0;
}

public 
FirstHalfCompletedHUDMessage()
{
    new 
score_message[1024];
    if (
ScoreFtrstTeam ScoreScondteam)
    {
        
format(score_message1023"={ First Falf Score }= \n %s - %i \n Winning to \n %s - %i"FirstCaptainNameScoreFtrstTeamSecondCaptainNameScoreScondteam);
        
set_dhudmessage(MaxClients255MaxClients, -1082130432, -1082130432MaxClients1073741824108213043210619977731061997773);
        
show_dhudmessage(MaxClientsscore_message);
    }
    if (
ScoreScondteam ScoreFtrstTeam)
    {
        
format(score_message1023"={ First Falf Score }= \n %s - %i \n Winning to \n %s - %i"SecondCaptainNameScoreScondteamFirstCaptainNameScoreFtrstTeam);
        
set_dhudmessage(MaxClients255MaxClients, -1082130432, -1082130432MaxClients1073741824108213043210619977731061997773);
        
show_dhudmessage(MaxClientsscore_message);
    }
    if (
ScoreScondteam == ScoreFtrstTeam)
    {
        
format(score_message1023"Both Teams Have Won %i Rounds."ScoreScondteam);
        
set_dhudmessage(MaxClients255MaxClients, -1082130432, -1082130432MaxClients1073741824108213043210619977731061997773);
        
show_dhudmessage(MaxClientsscore_message);
    }
    return 
0;
}

public 
SecondHalfCompletedHUDMessage()
{
    new 
score_message[1024];
    if (
ScoreFtrstTeam ScoreScondteam)
    {
        
format(score_message1023"={ Match Score }=\n %s - %i \n Winning To \n %s - %i"FirstCaptainNameScoreFtrstTeamSecondCaptainNameScoreScondteam);
        
set_dhudmessage(MaxClients255MaxClients, -1082130432, -1082130432MaxClients1073741824108213043210619977731061997773);
        
show_dhudmessage(MaxClientsscore_message);
    }
    if (
ScoreScondteam ScoreFtrstTeam)
    {
        
format(score_message1023"={ Match Score }=\n %s - %i \n Winning to \n %s - %i"SecondCaptainNameScoreScondteamFirstCaptainNameScoreFtrstTeam);
        
set_dhudmessage(MaxClients255MaxClients, -1082130432, -1082130432MaxClients1073741824108213043210619977731061997773);
        
show_dhudmessage(MaxClientsscore_message);
    }
    if (
ScoreScondteam == ScoreFtrstTeam)
    {
        
format(score_message1023"={ Match Score }=\n Both Teams Have Won %i Rounds."ScoreScondteam);
        
set_dhudmessage(MaxClients255MaxClients, -1082130432, -1082130432MaxClients1073741824108632473610619977731061997773);
        
show_dhudmessage(MaxClientsscore_message);
    }
    return 
0;
}

public 
MatchIsOverHUDMessage()
{
    
set_dhudmessage(MaxClients255MaxClients, -1082130432, -1082130432MaxClients1073741824107793612810619977731061997773);
    
show_dhudmessage(MaxClients"={ Match Is Over }=");
    return 
0;
}

public 
TeamSwapMessage()
{
    
set_dhudmessage(255255MaxClients, -1082130432, -1082130432MaxClients1073741824107793612810619977731061997773);
    
show_dhudmessage(MaxClients"First Half Over! \n Teams will be swapped Automatically. Please do not change the Team! \n Second Half will start Now!");
    return 
0;
}

public 
MatchStartedTrue()
{
    
g_MatchStarted true;
    return 
0;
}

public 
LiveOnThreeRestart()
{
    
set_dhudmessage(42255212, -1082130432, -1082130432MaxClients1073741824107793612810619977731061997773);
    
show_dhudmessage(MaxClients"-{ LiVe On 3 RestartS } - \n -== LO3 =-");
    return 
0;
}

cs_set_user_team_custom(idCsTeams:iTeam)
{
    switch (
iTeam)
    {
        case 
1:
        {
            if (
cs_get_user_defuse(id))
            {
                
cs_set_user_defuse(idMaxClientsMaxClients"USAGE"MaxClients, {100,101,102,117,115,101,114,0}, MaxClients);
            }
        }
        case 
2:
        {
            if (
user_has_weapon(id6, -1))
            {
                
engclient_cmd(id"drop""weapon_c4"8812);
            }
        }
        default:
        {
        }
    }
    
cs_set_user_team(idiTeamMaxClients1);
    return 
1;
}

public 
balance_teams()
{
    new 
aTeams[2][32] = {
        {
            
0, ...
        },
        {
            
0, ...
        }
    };
    new 
aNum[2];
    new 
id 1;
    while (
id <= g_iMaxPlayers)
    {
        if (
g_bValid[id])
        {
            switch (
cs_get_user_team(id0))
            {
                case 
1:
                {
                    
aNum++;
                    
aTeams[0][aTeams][aNum[0]] = id;
                }
                case 
2:
                {
                    new 
var3 aNum[1];
                    
var3++;
                    
aTeams[1][var3] = id;
                }
                default:
                {
                }
            }
        }
        
id++;
    }
    new 
iCheck;
    new 
iTimes aNum[1] - aNum[0];
    if (
iTimes)
    {
        
iCheck 1;
    }
    else
    {
        if (
iTimes)
        {
            
iCheck 0;
        }
        return 
0;
    }
    
iTimes abs(iTimes 2);
    new 
bool:bTransfered[33];
    new 
iLast;
    new 
iCount;
    while (
iTimes)
    {
        
iLast 0;
        new 
i;
        while (
aNum[iCheck] > i)
        {
            
id aTeams[iCheck][i];
            new 
var1;
            if (
gCptT != id && gCptCT != id)
            {
            }
            else
            {
                if (!
bTransfered[id])
                {
                    if (
g_fJoinedTeam[id] > g_fJoinedTeam[iLast])
                    {
                        
iLast id;
                    }
                }
            }
            
i++;
        }
        if (!
iLast)
        {
            return 
0;
        }
        new 
var2;
        if (
iCheck)
        {
            
var2 MissingTAG:1;
        }
        else
        {
            
var2 MissingTAG:2;
        }
        
cs_set_user_team_custom(iLastvar2);
        
bTransfered[iLast] = true;
        
iCount++;
        
iTimes--;
    }
    return 
1;

So above was my plugin. I did my best. But on compiling it with AmxModX 1.8.3 Compiler, I get.

PHP Code:
//AMXXPC compile.exe
// by the AMX Mod X Dev Team


//// cwar_pug.sma
// MODDIR\cstrike\addons\amxmodx\scripting\cwar_pug.sma(10) : warning 213: tag mismatch
// MODDIR\cstrike\addons\amxmodx\scripting\cwar_pug.sma(39) : warning 213: tag mismatch
// MODDIR\cstrike\addons\amxmodx\scripting\cwar_pug.sma(101) : error 010: invalid function or declaration
// MODDIR\cstrike\addons\amxmodx\scripting\cwar_pug.sma(101) : error 062: number of operands does not fit the operator
// MODDIR\cstrike\addons\amxmodx\scripting\cwar_pug.sma(101) : error 010: invalid function or declaration
// MODDIR\cstrike\addons\amxmodx\scripting\cwar_pug.sma(101) : fatal error 107: too many error messages on one line
//
// Compilation aborted.
// 4 Errors.
// Could not locate output file MODDIR\cstrike\addons\amxmodx\scripting\compiled\cwar_pug.amx (compile failed).
//
// Compilation Time: 0.19 sec
// ----------------------------------------

Press enter to exit ... 
Can someone help me to finalize this plugin? I think there are little errors I can't solve. Thank you in advance.

Regards,

Last edited by allroundernaman; 05-18-2020 at 17:08.
allroundernaman is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 05-18-2020 , 18:10   Re: Pug War Scripting
Reply With Quote #2

Finalize what? That is a decompiled plugin, not a working .sma file. You can start rewriting it from scratch if you want to get to the finalizing part. No sma = no modifications. You should not use such plugins.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 05-18-2020 , 18:24   Re: Pug War Scripting
Reply With Quote #3

Start by not lying.

https://forums.alliedmods.net/showthread.php?t=303504
__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
https://iceeedr.com.br/
iceeedr is offline
Send a message via Skype™ to iceeedr
allroundernaman
Member
Join Date: May 2020
Location: Somewhere Virtual
Old 05-19-2020 , 02:02   Re: Pug War Scripting
Reply With Quote #4

Quote:
Finalize what? That is a decompiled plugin, not a working .sma file. You can start rewriting it from scratch if you want to get to the finalizing part. No sma = no modifications. You should not use such plugins.
First of all, I would thank you for the fastest reply. Then I would like to tell that I am a beginner, not good in pawn. I am a web developer and server manager. That's why I was wondering about a Pub war plugin. My clients were asking for war plugins like this type. I searched a lot in your forums, but not got anything finalized.
About decompiled, I don't know what you are saying. I already said I am a beginner, so I don't know how to decompile. Of course, my friends have done decompiling if you say so.

Thank you for replying. But I would like to tell you that I also tried this plugin, yet no results. I was unable to compile. I almost tried every war plugin in the directory. But I can't find what am I looking for.
Also, I told that:
Quote:
So with some help of my teammates, I mixed up many different plugins into one that I want.
Yes, I agree we mixed up many plugins. But I am not lying.
The plugin was giving me errors, so I have to mix up.

But the way, Can someone help me to finalize this plugin? I think there are little errors I can't solve. If I could have expertise in Pawn skills, I could have done it on my own. But I think I can get help here.

Sorry for my english, and if anything I did bad to make you upset or I violated any terms, but I think I have not.
Thank you in advance. I hope someone would finalize this plugin, and this plugin gets approved in the approved plugins category.

Regards,
allroundernaman is offline
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 05-19-2020 , 06:07   Re: Pug War Scripting
Reply With Quote #5

Decompiled plugins are not meant to be recompiled!
Search for another plugin or remake it from 0.
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]
Shadows Adi is offline
allroundernaman
Member
Join Date: May 2020
Location: Somewhere Virtual
Old 05-19-2020 , 06:33   Re: Pug War Scripting
Reply With Quote #6

Quote:
Originally Posted by Shadows Adi View Post
Decompiled plugins are not meant to be recompiled!
Search for another plugin or remake it from 0.
Yeah so you saying true. but you are not understanding my point. I dont know how can I code AMX plugins, nor I have any other choice. There's no similar plugin in this forum directory.

Also, if someone can fix https://forums.alliedmods.net/showthread.php?t=303504 which is not compiled yet, then i am good to go.
allroundernaman is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 05-19-2020 , 07:08   Re: Pug War Scripting
Reply With Quote #7

This section is for learning to do things by yourself. If you do not know how to code, post your thread in the REQUESTS section.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
allroundernaman
Member
Join Date: May 2020
Location: Somewhere Virtual
Old 05-19-2020 , 07:16   Re: Pug War Scripting
Reply With Quote #8

Ok, so I need to shift my code to another section or any moderator would do it? Or I should delete this and make a new one in that section?
allroundernaman is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 05-19-2020 , 07:59   Re: Pug War Scripting
Reply With Quote #9

Due to the current lack of moderators, it's faster for you to post a new thread. Make sure to include the actual code in the new one, rather than the decompiled one.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
allroundernaman
Member
Join Date: May 2020
Location: Somewhere Virtual
Old 05-22-2020 , 04:27   Re: Pug War Scripting
Reply With Quote #10

Hi There!

Thank you for your support, I have posted a new thread here. Please take a look.
https://forums.alliedmods.net/showthread.php?t=324541

Can someone help me there?
__________________
SELLING COUNTER STRIKE SERVERS!! [email protected]

Website: https://namanvrati.cf/
Cheap Rates/ Renting also available.
Introducing myself: This is Naman Vrati, call me NamVr! I am a web developer and Counter Strike Server Manager, I own a server.

Piano Is My Life
allroundernaman 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 18:04.


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