Hello everyone.Is this plugin going to sort out? here reworked pcwmanager.amxx plugin, but does not work as well as it should? who pays Script, ? or can anyone properly handled and put here as it should look like. Thanks.
Here are the details!
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <hamsandwich>
#define PLUGIN "PCWmanager"
#define VERSION "3.5"
#define AUTHOR "Unkolix"
#define ACCESS_LEVEL ADMIN_MENU
#define IsPlayer(%1) (1 <= %1 <= g_max_clients)
new bool:LiveStarted, bool:HalfTwo, bool:b_chat = true, bool:block_team = false, bool:no_rr = false;
new c_ff,c_pass, tWin, ctWin, tWinHalf, ctWinHalf;
new g_max_clients, ScoreCount[33];
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("say .rr", "RestartRound", ACCESS_LEVEL)
register_clcmd("say .restart", "RestartServer", ACCESS_LEVEL)
register_clcmd("say .live", "live", ACCESS_LEVEL)
register_clcmd("say .maps", "mapchooser", ACCESS_LEVEL)
register_clcmd("say .ff", "ffchooser", ACCESS_LEVEL)
register_clcmd("say .kickt", "KickT", ACCESS_LEVEL)
register_clcmd("say .kickct", "KickCT", ACCESS_LEVEL)
register_clcmd("say .score", "ClientCommand_SayScore")
register_clcmd("say .rez", "ClientCommand_SayScore")
register_clcmd("say .warmup", "warmup", ACCESS_LEVEL)
register_clcmd("say .gg", "gg", ACCESS_LEVEL)
register_clcmd("say .perekuras", "perekuras", ACCESS_LEVEL)
register_clcmd("say .renkam", "renkam", ACCESS_LEVEL)
register_clcmd("say .knife", "knife", ACCESS_LEVEL)
register_clcmd("say .config", "config", ACCESS_LEVEL)
register_clcmd("say .chaton", "chaton", ACCESS_LEVEL);
register_clcmd("say .chatoff", "chatoff", ACCESS_LEVEL);
register_clcmd("say /cp", "cp", ACCESS_LEVEL);
register_clcmd( "jointeam", "BlockJT")
register_clcmd("say", "Hook_Say", -1, "Password")
register_clcmd("say", "cmd_say", -1, "");
register_event("SendAudio", "tRoundWin", "a", "2&%!MRAD_terwin")
register_event("SendAudio", "ctRoundWin", "a", "2&%!MRAD_ctwin")
register_event("HLTV", "event_new_round", "a", "1=0", "2=0")
register_event("DeathMsg", "Event_DeathMsg", "a")
register_logevent("logevent_round_end", 2, "1=Round_End")
c_ff = get_cvar_pointer("mp_friendlyfire")
c_pass = get_cvar_pointer("sv_password")
g_max_clients = get_maxplayers()
register_dictionary("PCWmanager.txt")
}
public Event_DeathMsg()
{
new killer = read_data(1);
new victim = read_data(2);
static IsPlayer;
IsPlayer = (victim == killer || !is_user_connected(killer));
if (!IsPlayer && get_user_team(victim) != get_user_team(killer))
{
ScoreCount[killer]++;
}
for(new i = 1 ; i <= g_max_clients ; i++)
if(is_user_connected(i) && IsPlayer(i))
{
new name[33]
get_user_name(i, name, charsmax(name))
if(ScoreCount[i] == 4)
{
client_print_color(0, "!n*** Zaidejas !t%s !npadare !gMini Ace !n***", name)
}
else if(ScoreCount[i] == 5)
{
client_print_color(0, "!n*** Zaidejas !t%s !npadare !gACE !n***", name)
}
}
}
public cp(id)
{
meniu(id)
return PLUGIN_HANDLED;
}
public meniu(id)
{
new newmenu[64], choice_1[64], choice_2[64], choice_3[64], choice_4[64],
choice_5[64], choice_6[64], choice_7[64], choice_8[64], choice_9[64];
format(newmenu, sizeof(newmenu), "%L", id, "NEW_MENU");
new menu = menu_create(newmenu, "meniurod");
format(choice_1, sizeof(choice_1), "%L", id, "MENU_CHOICE_1");
menu_additem(menu, choice_1, "1", ACCESS_LEVEL);
format(choice_2, sizeof(choice_2), "%L", id, "MENU_CHOICE_2");
menu_additem(menu, choice_2, "2", ACCESS_LEVEL);
format(choice_3, sizeof(choice_3), "%L", id, "MENU_CHOICE_3");
menu_additem(menu, choice_3, "3", ACCESS_LEVEL);
format(choice_4, sizeof(choice_4), "%L", id, "MENU_CHOICE_4");
menu_additem(menu, choice_4, "4", ACCESS_LEVEL);
format(choice_5, sizeof(choice_5), "%L", id, "MENU_CHOICE_5");
menu_additem(menu, choice_5, "5", ACCESS_LEVEL);
format(choice_6, sizeof(choice_6), "%L", id, "MENU_CHOICE_6");
menu_additem(menu, choice_6, "6", ACCESS_LEVEL);
format(choice_7, sizeof(choice_7), "%L", id, "MENU_CHOICE_7");
menu_additem(menu, choice_7, "7", ACCESS_LEVEL);
format(choice_8, sizeof(choice_

, "%L", id, "MENU_CHOICE_8");
menu_additem(menu, choice_8, "8", ACCESS_LEVEL);
format(choice_9, sizeof(choice_9), "%L", id, "MENU_CHOICE_9");
menu_additem(menu, choice_9, "9", ACCESS_LEVEL);
new menu_exit_name[64];
format(menu_exit_name, sizeof(menu_exit_name), "%L", id, "MENU_EXIT_NAME")
menu_setprop(menu, MPROP_EXITNAME, menu_exit_name)
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
menu_display(id, menu, 0);
}
public meniurod(id, menu, item)
{
if( item == MENU_EXIT ) //Checks if player clicks menu exit (0)
{
menu_destroy(menu); //If so the menu will be destroyed
return PLUGIN_HANDLED;
}
new data[6], szName[64];
new access, callback;
menu_item_getinfo(menu, item, access, data,charsmax(data), szName,charsmax(szName), callback);
new key = str_to_num(data);
switch(key)
{
case 1: {
renkam(0)
}
case 2: {
live(0)
}
case 3: {
warmup(0)
}
case 4: {
knife(0)
}
case 5: {
gg(0)
}
case 6: {
client_cmd(id, "amx_ssmenu");
}
case 7: {
chaton(0)
}
case 8: {
chatoff(0)
}
case 9: {
client_cmd(id, "amx_kickmenu");
}
}
menu_destroy(menu);
return PLUGIN_CONTINUE
}
public event_new_round()
{
for(new i = 1 ; i <= g_max_clients ; i++)
ScoreCount[i] = 0;
if(LiveStarted == true && (tWin + ctWin) >=1)
{
ClientCommand_SayScore(0)
}
if((tWin + ctWinHalf) == 15 && (ctWin + tWinHalf) == 15)
{
gg(0)
}
if((tWinHalf + ctWinHalf) == 0 && (ctWin + tWin) == 15)
{
set_hudmessage(255, 255, 255, 0.06, 0.62, 0, 6.0, 12.0)
show_hudmessage(0, "%L", 0, "CHANGING_TEAMS", (ctWin + tWin))
if(!no_rr)
{
server_cmd( "sv_restart 1" )
no_rr = true;
}
}
if((ctWin + tWin) < 15)
{
no_rr = false;
}
if(HalfTwo == true)
{
if((ctWin + tWinHalf) == 15)
{
client_print_color(0, "%L", 0, "TR_GAIN")
}
else if((tWin + ctWinHalf) == 15)
{
client_print_color(0, "%L", 0, "CT_GAIN")
}
if((ctWin + tWinHalf) == 16)
{
set_hudmessage(255, 255, 255, 0.06, 0.62, 0, 6.0, 12.0)
show_hudmessage(0, "%L", 0, "TR_WIN")
client_print_color(0, "%L", 0, "TR_WIN")
gg(0)
LiveStarted = false;
HalfTwo = false;
}
else if((tWin + ctWinHalf) == 16)
{
set_hudmessage(255, 255, 255, 0.06, 0.62, 0, 6.0, 12.0)
show_hudmessage(0, "%L", 0, "CT_WIN")
client_print_color(0, "%L", 0, "CT_WIN")
gg(0)
LiveStarted = false;
HalfTwo = false;
}
}
}
public BlockJT(id)
{
if(block_team == true)
{
if(cs_get_user_team(id) & CS_TEAM_CT || cs_get_user_team(id) & CS_TEAM_T)
{
return PLUGIN_HANDLED;
}
else
{
return PLUGIN_CONTINUE;
}
}
return PLUGIN_CONTINUE;
}
public logevent_round_end()
{
if((ctWin + tWin) == 15 && HalfTwo != true)
{
new iPlayers[ 32 ], iNum, iPlayer
get_players( iPlayers, iNum )
for ( new a = 0; a < iNum; a++ )
{
iPlayer = iPlayers[ a ];
switch ( cs_get_user_team( iPlayer ) )
{
case CS_TEAM_T: cs_set_user_team( iPlayer, CS_TEAM_CT )
case CS_TEAM_CT: cs_set_user_team( iPlayer, CS_TEAM_T )
}
}
server_cmd("sv_restart 1")
HalfTwo = true;
}
}
public RestartRound(id)
{
if (get_user_flags(id) & ACCESS_LEVEL)
{
server_cmd( "sv_restart 1" )
}
}
public RestartServer(id)
{
if (get_user_flags(id) & ACCESS_LEVEL)
{
server_cmd( "restart" )
}
}
public tRoundWin(id)
{
if(LiveStarted == true)
{
if(HalfTwo != true)
{
tWin++;
}
else if(HalfTwo == true)
{
tWinHalf++;
}
}
}
public ctRoundWin(id)
{
if(LiveStarted == true)
{
if(HalfTwo != true)
{
ctWin++;
}
else if(HalfTwo == true)
{
ctWinHalf++;
}
}
}
public ClientCommand_SayScore(id)
{
if(LiveStarted == true)
{
if(HalfTwo != true)
{
client_print_color(id, "%L", id, "SCORE", tWin, ctWin)
}
else if(HalfTwo == true)
{
client_print_color(id, "%L", id, "SCORE", (ctWin + tWinHalf), (tWin + ctWinHalf))
}
}
return PLUGIN_HANDLED
}
public live(id)
{
new szName[32]
get_cvar_string("hostname", szName, charsmax(szName))
if (get_user_flags(id) & ACCESS_LEVEL)
{
server_cmd( "exec live.cfg" )
set_task(1.0,"RestartRound_live")
set_task(2.0,"RestartRound_live")
set_task(3.0,"RestartRound_live")
client_print_color(0, "%L", 0, "LIVE", szName)
client_print_color(0, "%L", 0, "SEKMES", szName)
client_print_color(0, "%L", 0, "APKEISTOS", szName)
}
}
public RestartRound_live(id)
{
if (get_user_flags(id) & ACCESS_LEVEL)
{
server_cmd( "sv_restart 1" )
tWin=0;
tWinHalf=0;
ctWin=0;
ctWinHalf=0;
LiveStarted = true;
HalfTwo = false;
block_team = true;
}
}
public warmup(id)
{
new szName[64]
get_cvar_string("hostname", szName, charsmax(szName))
if(get_user_flags(id) & ACCESS_LEVEL)
{
server_cmd( "exec warmup.cfg" )
server_cmd( "sv_restart 1" )
client_print_color(0, "%L", 0, "APSILIMAS", szName)
client_print_color(0, "%L", 0, "APS_MSG", szName)
block_team = false;
}
}
public perekuras(id)
{
new szName[64]
get_cvar_string("hostname", szName, charsmax(szName))
if(get_user_flags(id) & ACCESS_LEVEL)
{
server_cmd( "exec renkam.cfg" )
new iPlayers[ 32 ], iNum, iPlayer
get_players( iPlayers, iNum )
for ( new a = 0; a < iNum; a++ )
{
iPlayer = iPlayers[ a ];
if(cs_get_user_team(iPlayer) == CS_TEAM_CT)
{
cs_set_user_team(iPlayer, CS_TEAM_T)
}
}
client_print_color(0, "%L", 0, "PEREKURAS", szName)
client_print_color(0, "%L", 0, "PEREKURAS", szName)
client_print_color(0, "%L", 0, "PEREKURAS", szName)
client_print_color(0, "%L", 0, "PEREKURAS", szName)
tWin=0;
tWinHalf=0;
ctWin=0;
ctWinHalf=0;
LiveStarted = false;
block_team = false;
server_cmd("sv_restart 1")
}
}
public gg(id)
{
new szName[32]
get_cvar_string("hostname", szName, charsmax(szName))
if(get_user_flags(id) & ACCESS_LEVEL)
{
server_cmd( "exec gg.cfg" )
server_cmd( "sv_restart 1" )
client_print_color(0, "%L", 0, "BAIGTAS", szName)
client_print_color(0, "%L", 0, "BAIGTAS", szName)
client_print_color(0, "%L", 0, "BAIGTAS", szName)
client_print_color(0, "%L", 0, "BAIGTAS", szName)
tWin=0;
tWinHalf=0;
ctWin=0;
ctWinHalf=0;
LiveStarted = false;
block_team = false;
}
}
public renkam(id)
{
if(get_user_flags(id) & ACCESS_LEVEL)
{
server_cmd( "exec renkam.cfg" )
new iPlayers[ 32 ], iNum, iPlayer
get_players( iPlayers, iNum )
for ( new a = 0; a < iNum; a++ )
{
iPlayer = iPlayers[ a ];
if(cs_get_user_team(iPlayer) == CS_TEAM_CT)
{
cs_set_user_team(iPlayer, CS_TEAM_T)
}
}
client_print_color(0, "%L", 0, "SKIRSTYMAS")
client_print_color(0, "%L", 0, "SKIRSTYMAS")
client_print_color(0, "%L", 0, "SKIRSTYMAS")
block_team = false;
tWin=0;
tWinHalf=0;
ctWin=0;
ctWinHalf=0;
LiveStarted = false;
server_cmd("sv_restart 1")
}
}
public knife(id)
{
new szName[32]
get_cvar_string("hostname", szName, charsmax(szName))
if(get_user_flags(id) & ACCESS_LEVEL)
{
server_cmd( "exec knife.cfg" )
server_cmd( "sv_restart 1" )
client_print_color(0, "%L", 0, "KNF_ON", szName)
client_print_color(0, "%L", 0, "KNF", szName)
tWin=0;
tWinHalf=0;
ctWin=0;
ctWinHalf=0;
LiveStarted = false;
block_team = false;
}
}
public mapchooser(id)
{
new menu = menu_create("\rPCW Maps Chooser:", "menu_handler");
menu_additem(menu, "\wde_dust2", "1", ACCESS_LEVEL);
menu_additem(menu, "\wde_nuke", "2", ACCESS_LEVEL);
menu_additem(menu, "\wde_inferno", "3", ACCESS_LEVEL);
menu_additem(menu, "\wde_train", "4", ACCESS_LEVEL);
menu_additem(menu, "\wde_cbble", "5", ACCESS_LEVEL);
menu_additem(menu, "\wde_cpl_mill", "6", ACCESS_LEVEL);
menu_additem(menu, "\wde_tuscan", "7", ACCESS_LEVEL);
menu_additem(menu, "\wde_mirage", "8", ACCESS_LEVEL);
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
menu_display(id, menu, 0);
}
public ffchooser(id)
{
new menu = menu_create("\rFriendlyfire Settings:", "menu_handler2");
menu_additem(menu, "\wFriendlyfire ON", "1", ACCESS_LEVEL);
menu_additem(menu, "\wFriendlyfire OFF", "2", ACCESS_LEVEL);
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
menu_display(id, menu, 0);
}
public menu_handler(id, menu, item)
{
if( item == MENU_EXIT )
{
menu_destroy(menu);
return PLUGIN_HANDLED;
}
new data[6], iName[64];
new access, callback;
menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
new key = str_to_num(data);
switch(key)
{
case 1:
{
server_cmd( "changelevel de_dust2" )
}
case 2:
{
server_cmd( "changelevel de_nuke" )
}
case 3:
{
server_cmd( "changelevel de_inferno" )
}
case 4:
{
server_cmd( "changelevel de_train" )
}
case 5:
{
server_cmd( "changelevel de_cbble" )
}
case 6:
{
server_cmd( "changelevel de_cpl_mill" )
}
case 7:
{
server_cmd( "changelevel de_tuscan" )
}
case 8:
{
server_cmd( "changelvel de_mirage" )
}
}
menu_destroy(menu);
return PLUGIN_HANDLED;
}
public menu_handler2(id, menu, item)
{
if( item == MENU_EXIT )
{
menu_destroy(menu);
return PLUGIN_HANDLED;
}
new data[6], iName[64];
new access, callback;
menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
new key = str_to_num(data);
switch(key)
{
case 1:
{
set_pcvar_string(c_ff, "1" )
set_hudmessage(255, 255, 255, 0.06, 0.62, 0, 6.0, 12.0)
show_hudmessage(0, "%L", 0, "FF_ON")
client_print_color(0, "%L", 0, "FF_ON");
}
case 2:
{
set_pcvar_string(c_ff, "0" )
set_hudmessage(255, 255, 255, 0.06, 0.62, 0, 6.0, 12.0)
show_hudmessage(0, "%L", 0, "FF_OFF")
client_print_color(0, "%L", 0, "FF_OFF");
}
}
menu_destroy(menu);
return PLUGIN_HANDLED;
}
public KickT(id, level, cid)
{
if(!cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED
new iPlayers[32], iNum, i
get_players(iPlayers, iNum)
for(i=0; i<iNum; i++)
{
if (cs_get_user_team(iPlayers[i]) == CS_TEAM_T)
server_cmd( "kick #%d ^"Your match has been finished^"", get_user_userid(i))
}
return PLUGIN_HANDLED
}
public KickCT(id, level, cid)
{
if(get_user_flags(id) & ACCESS_LEVEL)
{
new iPlayers[32], iNum, i
get_players(iPlayers, iNum)
for(i=0; i<iNum; i++)
{
if (cs_get_user_team(iPlayers[i]) == CS_TEAM_CT)
server_cmd( "kick #%d ^"Your match has been finished^"", get_user_userid(i))
}
}
return PLUGIN_HANDLED
}
public Hook_Say(id, level, cid)
{
if(get_user_flags(id) & ACCESS_LEVEL)
{
new said[128];
read_args(said, sizeof(said)-1)
remove_quotes(said)
if(get_user_flags(id) & ACCESS_LEVEL)
{
if(equali(said, ".nopass"))
{
set_pcvar_string(c_pass, "")
set_hudmessage(255, 255, 255, 0.06, 0.62, 0, 6.0, 12.0)
show_hudmessage(0, "%L", 0, "NO_PASS")
client_print_color(0, "%L", 0, "NO_PASS")
}
else if(equali(said, ".pass",5))
{
replace(said, sizeof(said)-1, ".pass ", "")
set_pcvar_string(c_pass, said)
set_hudmessage(255, 255, 255, 0.06, 0.62, 0, 6.0, 12.0)
show_hudmessage(0, "%L", 0, "PASS", said)
client_print_color(0,"%L", 0, "PASS", said)
}
}
}
return PLUGIN_CONTINUE;
}
public config(id)
{
if (get_user_flags(id) & ACCESS_LEVEL)
{
server_cmd( "exec config.cfg" )
server_cmd( "sv_restart 1" )
}
}
public chaton(id)
{
if (get_user_flags(id) & ACCESS_LEVEL)
{
b_chat = true;
client_print_color( 0, "%L", 0, "CHAT_ON");
}
}
public cmd_say( id )
{
if(b_chat)
{
return PLUGIN_CONTINUE;
}
client_print_color( id, "%L", id, "CHAT_OFF");
return PLUGIN_HANDLED;
}
public chatoff(id)
{
if (get_user_flags(id) & ACCESS_LEVEL)
{
if ( !LiveStarted )
{
client_print_color( id, "%L", id, "NO_LIVE");
}
else
{
b_chat = false;
client_print_color( 0, "%L", 0, "CHAT_OFF");
}
}
}
stock client_print_color(const id, const input[], any:...)
{
new count = 1, players[32];
static msg[191];
vformat(msg, 190, input, 3);
replace_all(msg, 190, "!g", "^x04"); // Green Color
replace_all(msg, 190, "!n", "^x01"); // Default Color
replace_all(msg, 190, "!t", "^x03"); // Team Color
if (id) players[0] = id; else get_players(players, count, "ch");
{
for (new i = 0; i < count; i++)
{
if (is_user_connected(players[i]))
{
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}
}