KAIP MAN SITA SUKOMPILIUOT? PADEKIT KAS JEI GALIT... :)
Posted: 2016 Aug 10 20:35
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
new gbAlreadyAdded[33], tWins, ctWins,
players, bool:started
new const prefix[] = "[Gather]"
public plugin_init() {
register_plugin("Gather Plugin", "V1.0", "Xmoo")
register_clcmd("say .start", "FuncStart", ADMIN_CVAR)
register_clcmd("say .add", "FuncAdd")
register_clcmd("say .rr", "FunRestart")", ADMIN_SLAY)
register_clcmd("say .ready", "FuncReady", ADMIN_CVAR)
register_clcmd("say .score", "teamscores", ADMIN_CVAR)
register_clcmd("say .stop", "FuncStop", ADMIN_CVAR)
register_clcmd("say .ffon", "FuncFriendlyF", ADMIN_CVAR)
register_clcmd("say .ffoff", "FuncFriendlyF", ADMIN_CVAR)
register_clcmd("say .bant", "FuncBanT", ADMIN_CVAR)
register_clcmd("say .banct", "FuncBanCT", ADMIN_CVAR)
register_clcmd("say .pass", "FuncPass", ADMIN_CVAR)
register_clcmd("say .nopass", "FuncPass", ADMIN_CVAR)
register_event("SendAudio", "tRoundWin", "a", "2&%!MRAD_terwin")
register_event("SendAudio", "ctRoundWin", "a", "2&%!MRAD_ctwin")
register_event("ResetHUD","ResetHUD","be");
register_cvar("sv_gather", "1")
register_cvar("sv_player", "1")
}
public client_connect(index)
{
gbAlreadyAdded[index] = false
}
public client_disconnect(index)
{
if(gbAlreadyAdded[index] )
{
players--
new playersleft = get_cvar_num("sv_player") - 1
server_cmd("sv_player %d", playersleft)
gbAlreadyAdded[index] = false
}
}
public ResetHUD(index)
{
if(started == false)
{
set_hudmessage(255, 0, 0, 0.1, 0.2, 0, 6.0, 10000.0)
show_hudmessage(0, "Ready for next match!^n type .add to add yourself to the game - %d/10", players)
}
}
public tRoundWin()
{
tWins++
//roundcheck()
}
public ctRoundWin()
{
ctWins++
//roundcheck()
}
// DISABLED temporarily
/*public roundcheck()
{
new rp = ctWins + tWins
new winner[] = "null"
if( rp < 14)
{
return PLUGIN_HANDLED
}
if(ctWins > tWins)
{
winner = "CT's"
}
else
{
winner = "T's"
}
if(ctWins == 15)
{
client_print(0, print_center, "%s The %s have won the game! Final score is %d (CT) - %d (T).", prefix, winner, ctWins, tWins)
tWins = 0
ctWins = 0
rp = 0
gbAlreadyAdded[0] = false
return PLUGIN_HANDLED
}
else if(tWins == 15)
{
client_print(0, print_center, "%s The %s have won the game! Final score is %d (CT) - %d (T).", prefix, winner, ctWins, tWins)
tWins = 0
ctWins = 0
rp = 0
gbAlreadyAdded[0] = false
return PLUGIN_HANDLED
}
switch(rp)
{
case 14:
{
client_print(0, print_center, "%s This is the last round of first half and the score is %d (CT) - %d (T)", prefix, ctWins, tWins)
}
case 15:
{
client_print(0, print_center, "%s The %s won the first half! The score was %d (CT) - %d (T).", prefix, winner, ctWins, tWins)
new pNum, Players[32], index
get_players(Players, pNum)
for(new i; i < pNum; i++)
{
index = Players
if(cs_get_user_team(index) == CS_TEAM_T )
{
cs_set_user_team(index, CS_TEAM_CT)
}
else
{
cs_set_user_team(index, CS_TEAM_T)
}
}
}
case 29:
{
client_print(0, print_center, "%s This is the final round! Whoever wins this wins the game!", prefix)
}
}
return PLUGIN_CONTINUE
}*/
public FuncBanCT(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) == CS_TEAM_CT)
server_cmd("banid #%d 0", i)
}
return PLUGIN_HANDLED
}
public FuncBanT(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) == CS_TEAM_T)
server_cmd("banid #%d 0", i)
}
return PLUGIN_HANDLED
}
public FuncStart(id, level, cid)
{
gbAlreadyAdded[id] = false
server_cmd("sv_player 1")
if (get_cvar_num("sv_player") == 1)
{
set_hudmessage(255, 0, 0, 0.1, 0.2, 0, 6.0, 10000.0)
show_hudmessage(0, "Ready for next match!^n typ .add to add yourself to the game - 0/10")
return PLUGIN_CONTINUE
}
return PLUGIN_CONTINUE
}
public FuncAdd(id, level, cid)
{
if(gbAlreadyAdded[id])
{
client_print(id, print_chat, "You've already been added.")
return
}
else
{
gbAlreadyAdded[id] = true
}
if (get_cvar_num("sv_player") == 1)
{
players++
server_cmd("sv_player 2")
set_hudmessage(255, 0, 0, 0.1, 0.2, 0, 6.0, 10000.0)
show_hudmessage(0, "Ready for next match!^n typ .add to add yourself to the game - 1/10")
}
if (get_cvar_num("sv_player") == 2)
{
players++
server_cmd("sv_player 3")
set_hudmessage(255, 0, 0, 0.1, 0.2, 0, 6.0, 10000.0)
show_hudmessage(0, "Ready for next match!^n typ .add to add yourself to the game - 2/10")
}
if (get_cvar_num("sv_player") == 3)
{
players++
server_cmd("sv_player 4")
set_hudmessage(255, 0, 0, 0.1, 0.2, 0, 6.0, 10000.0)
show_hudmessage(0, "Ready for next match!^n typ .add to add yourself to the game - 3/10")
}
if (get_cvar_num("sv_player") == 4)
{
players++
server_cmd("sv_player 5")
set_hudmessage(255, 0, 0, 0.1, 0.2, 0, 6.0, 10000.0)
show_hudmessage(0, "Ready for next match!^n typ .add to add yourself to the game - 4/10")
}
if (get_cvar_num("sv_player") == 5)
{
players++
server_cmd("sv_player 6")
set_hudmessage(255, 0, 0, 0.1, 0.2, 0, 6.0, 10000.0)
show_hudmessage(0, "Ready for next match!^n typ .add to add yourself to the game - 5/10")
}
if (get_cvar_num("sv_player") == 6)
{
players++
server_cmd("sv_player 7")
set_hudmessage(255, 0, 0, 0.1, 0.2, 0, 6.0, 10000.0)
show_hudmessage(0, "Ready for next match!^n typ .add to add yourself to the game - 6/10")
}
if (get_cvar_num("sv_player") == 7)
{
players++
server_cmd("sv_player 8")
set_hudmessage(255, 0, 0, 0.1, 0.2, 0, 6.0, 10000.0)
show_hudmessage(0, "Ready for next match!^n typ .add to add yourself to the game - 7/10")
}
if (get_cvar_num("sv_player") == 8)
{
players++
server_cmd("sv_player 9")
set_hudmessage(255, 0, 0, 0.1, 0.2, 0, 6.0, 10000.0)
show_hudmessage(0, "Ready for next match!^n typ .add to add yourself to the game - 8/10")
}
if (get_cvar_num("sv_player") == 9)
{
players++
server_cmd("sv_player 10")
set_hudmessage(255, 0, 0, 0.1, 0.2, 0, 6.0, 10000.0)
show_hudmessage(0, "Ready for next match!^n typ .add to add yourself to the game - 9/10")
}
if (get_cvar_num("sv_player") == 10)
{
players++
server_cmd("sv_player 0")
set_hudmessage(255, 0, 0, 0.1, 0.2, 0, 6.0, 10000.0)
show_hudmessage(0, "Ready for next match!^n Admin typ .ready to start the game!")
}
return
}
public FuncReady(id, level, cid)
{
if(!cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED
tWins = 0
ctWins = 0
started = true
set_hudmessage(255, 0, 0, 0.1, 0.2, 0, 6.0, 10.0)
show_hudmessage(0, "Match starting...")
set_task(1.0, "restart5")
set_task(2.0, "restart4")
set_task(3.0, "restart3")
set_task(4.0, "restart2")
set_task(5.0, "restart1")
server_cmd("sv_restart 6")
set_task(6.0, "restart")
set_task(9.0, "restarted")
return PLUGIN_HANDLED;
}
public restart5()
client_print(0, print_chat, "%s Game starting in 5 seconds!", prefix)
public restart4()
client_print(0, print_chat, "%s 4", prefix)
public restart3()
client_print(0, print_chat, "%s 3", prefix)
public restart2()
client_print(0, print_chat, "%s 2", prefix)
public restart1()
client_print(0, print_chat, "%s 1", prefix)
public restart()
client_print(0, print_chat, "%s Game started! HF GL!", prefix)
public restarted()
client_print(0, print_center, "Thanks for playing with RealWars (RW)", 0, "Thanks for playing with RealWars (RW)")
//new g_teamScore[2]
public teamscores(id, level, cid)
{
new rp = tWins + ctWins
set_hudmessage(255, 255, 0, 0.0, 0.90, 0, 2.0, 8.0, 0.8, 0.8, 3)
show_hudmessage(id, "You are plaing round %d^n CT Score : %d^n T Score : %d", rp, ctWins, tWins )
client_print(0, print_chat, "CT Score : %d^n - T Score : %d", ctWins, tWins )
return PLUGIN_HANDLED
}
public FuncStop(id, level, cid)
{
if(!cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED
started = false
tWins = 0, ctWins = 0
server_cmd("sv_restart 1")
server_cmd("amx_csay The game is now over! You can leave the server NOW!")
client_print(0, print_chat, "%s The game is NOW over! You can leave the server NOW!", 0, "Game started! HF GL!", prefix)
return PLUGIN_HANDLED
}
public FuncFriendlyF(id, level, cid)
{
if(!cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED
if ( (get_cvar_num("mp_friendlyfire")) == 0)
{
server_cmd("mp_friendlyfire 1")
client_print(0, print_chat, "%s Friendlyfire is now on.", prefix)
}
else
{
server_cmd("mp_friendlyfire 0")
client_print(0, print_chat, "%s Friendlyfire is now off.", prefix)
}
return PLUGIN_HANDLED
}
public FuncPass(id, level, cid)
{
if(!cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED
new password[32]
get_cvar_string("sv_password", password, 31)
if (equal(password, ""))
server_cmd("sv_password ^"123^"")
else
server_cmd("sv_password ^"^"")
return PLUGIN_HANDLED
}
public plugin_end()
{
server_cmd("sv_player 1")
}
#include <amxmisc>
#include <cstrike>
new gbAlreadyAdded[33], tWins, ctWins,
players, bool:started
new const prefix[] = "[Gather]"
public plugin_init() {
register_plugin("Gather Plugin", "V1.0", "Xmoo")
register_clcmd("say .start", "FuncStart", ADMIN_CVAR)
register_clcmd("say .add", "FuncAdd")
register_clcmd("say .rr", "FunRestart")", ADMIN_SLAY)
register_clcmd("say .ready", "FuncReady", ADMIN_CVAR)
register_clcmd("say .score", "teamscores", ADMIN_CVAR)
register_clcmd("say .stop", "FuncStop", ADMIN_CVAR)
register_clcmd("say .ffon", "FuncFriendlyF", ADMIN_CVAR)
register_clcmd("say .ffoff", "FuncFriendlyF", ADMIN_CVAR)
register_clcmd("say .bant", "FuncBanT", ADMIN_CVAR)
register_clcmd("say .banct", "FuncBanCT", ADMIN_CVAR)
register_clcmd("say .pass", "FuncPass", ADMIN_CVAR)
register_clcmd("say .nopass", "FuncPass", ADMIN_CVAR)
register_event("SendAudio", "tRoundWin", "a", "2&%!MRAD_terwin")
register_event("SendAudio", "ctRoundWin", "a", "2&%!MRAD_ctwin")
register_event("ResetHUD","ResetHUD","be");
register_cvar("sv_gather", "1")
register_cvar("sv_player", "1")
}
public client_connect(index)
{
gbAlreadyAdded[index] = false
}
public client_disconnect(index)
{
if(gbAlreadyAdded[index] )
{
players--
new playersleft = get_cvar_num("sv_player") - 1
server_cmd("sv_player %d", playersleft)
gbAlreadyAdded[index] = false
}
}
public ResetHUD(index)
{
if(started == false)
{
set_hudmessage(255, 0, 0, 0.1, 0.2, 0, 6.0, 10000.0)
show_hudmessage(0, "Ready for next match!^n type .add to add yourself to the game - %d/10", players)
}
}
public tRoundWin()
{
tWins++
//roundcheck()
}
public ctRoundWin()
{
ctWins++
//roundcheck()
}
// DISABLED temporarily
/*public roundcheck()
{
new rp = ctWins + tWins
new winner[] = "null"
if( rp < 14)
{
return PLUGIN_HANDLED
}
if(ctWins > tWins)
{
winner = "CT's"
}
else
{
winner = "T's"
}
if(ctWins == 15)
{
client_print(0, print_center, "%s The %s have won the game! Final score is %d (CT) - %d (T).", prefix, winner, ctWins, tWins)
tWins = 0
ctWins = 0
rp = 0
gbAlreadyAdded[0] = false
return PLUGIN_HANDLED
}
else if(tWins == 15)
{
client_print(0, print_center, "%s The %s have won the game! Final score is %d (CT) - %d (T).", prefix, winner, ctWins, tWins)
tWins = 0
ctWins = 0
rp = 0
gbAlreadyAdded[0] = false
return PLUGIN_HANDLED
}
switch(rp)
{
case 14:
{
client_print(0, print_center, "%s This is the last round of first half and the score is %d (CT) - %d (T)", prefix, ctWins, tWins)
}
case 15:
{
client_print(0, print_center, "%s The %s won the first half! The score was %d (CT) - %d (T).", prefix, winner, ctWins, tWins)
new pNum, Players[32], index
get_players(Players, pNum)
for(new i; i < pNum; i++)
{
index = Players
if(cs_get_user_team(index) == CS_TEAM_T )
{
cs_set_user_team(index, CS_TEAM_CT)
}
else
{
cs_set_user_team(index, CS_TEAM_T)
}
}
}
case 29:
{
client_print(0, print_center, "%s This is the final round! Whoever wins this wins the game!", prefix)
}
}
return PLUGIN_CONTINUE
}*/
public FuncBanCT(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) == CS_TEAM_CT)
server_cmd("banid #%d 0", i)
}
return PLUGIN_HANDLED
}
public FuncBanT(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) == CS_TEAM_T)
server_cmd("banid #%d 0", i)
}
return PLUGIN_HANDLED
}
public FuncStart(id, level, cid)
{
gbAlreadyAdded[id] = false
server_cmd("sv_player 1")
if (get_cvar_num("sv_player") == 1)
{
set_hudmessage(255, 0, 0, 0.1, 0.2, 0, 6.0, 10000.0)
show_hudmessage(0, "Ready for next match!^n typ .add to add yourself to the game - 0/10")
return PLUGIN_CONTINUE
}
return PLUGIN_CONTINUE
}
public FuncAdd(id, level, cid)
{
if(gbAlreadyAdded[id])
{
client_print(id, print_chat, "You've already been added.")
return
}
else
{
gbAlreadyAdded[id] = true
}
if (get_cvar_num("sv_player") == 1)
{
players++
server_cmd("sv_player 2")
set_hudmessage(255, 0, 0, 0.1, 0.2, 0, 6.0, 10000.0)
show_hudmessage(0, "Ready for next match!^n typ .add to add yourself to the game - 1/10")
}
if (get_cvar_num("sv_player") == 2)
{
players++
server_cmd("sv_player 3")
set_hudmessage(255, 0, 0, 0.1, 0.2, 0, 6.0, 10000.0)
show_hudmessage(0, "Ready for next match!^n typ .add to add yourself to the game - 2/10")
}
if (get_cvar_num("sv_player") == 3)
{
players++
server_cmd("sv_player 4")
set_hudmessage(255, 0, 0, 0.1, 0.2, 0, 6.0, 10000.0)
show_hudmessage(0, "Ready for next match!^n typ .add to add yourself to the game - 3/10")
}
if (get_cvar_num("sv_player") == 4)
{
players++
server_cmd("sv_player 5")
set_hudmessage(255, 0, 0, 0.1, 0.2, 0, 6.0, 10000.0)
show_hudmessage(0, "Ready for next match!^n typ .add to add yourself to the game - 4/10")
}
if (get_cvar_num("sv_player") == 5)
{
players++
server_cmd("sv_player 6")
set_hudmessage(255, 0, 0, 0.1, 0.2, 0, 6.0, 10000.0)
show_hudmessage(0, "Ready for next match!^n typ .add to add yourself to the game - 5/10")
}
if (get_cvar_num("sv_player") == 6)
{
players++
server_cmd("sv_player 7")
set_hudmessage(255, 0, 0, 0.1, 0.2, 0, 6.0, 10000.0)
show_hudmessage(0, "Ready for next match!^n typ .add to add yourself to the game - 6/10")
}
if (get_cvar_num("sv_player") == 7)
{
players++
server_cmd("sv_player 8")
set_hudmessage(255, 0, 0, 0.1, 0.2, 0, 6.0, 10000.0)
show_hudmessage(0, "Ready for next match!^n typ .add to add yourself to the game - 7/10")
}
if (get_cvar_num("sv_player") == 8)
{
players++
server_cmd("sv_player 9")
set_hudmessage(255, 0, 0, 0.1, 0.2, 0, 6.0, 10000.0)
show_hudmessage(0, "Ready for next match!^n typ .add to add yourself to the game - 8/10")
}
if (get_cvar_num("sv_player") == 9)
{
players++
server_cmd("sv_player 10")
set_hudmessage(255, 0, 0, 0.1, 0.2, 0, 6.0, 10000.0)
show_hudmessage(0, "Ready for next match!^n typ .add to add yourself to the game - 9/10")
}
if (get_cvar_num("sv_player") == 10)
{
players++
server_cmd("sv_player 0")
set_hudmessage(255, 0, 0, 0.1, 0.2, 0, 6.0, 10000.0)
show_hudmessage(0, "Ready for next match!^n Admin typ .ready to start the game!")
}
return
}
public FuncReady(id, level, cid)
{
if(!cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED
tWins = 0
ctWins = 0
started = true
set_hudmessage(255, 0, 0, 0.1, 0.2, 0, 6.0, 10.0)
show_hudmessage(0, "Match starting...")
set_task(1.0, "restart5")
set_task(2.0, "restart4")
set_task(3.0, "restart3")
set_task(4.0, "restart2")
set_task(5.0, "restart1")
server_cmd("sv_restart 6")
set_task(6.0, "restart")
set_task(9.0, "restarted")
return PLUGIN_HANDLED;
}
public restart5()
client_print(0, print_chat, "%s Game starting in 5 seconds!", prefix)
public restart4()
client_print(0, print_chat, "%s 4", prefix)
public restart3()
client_print(0, print_chat, "%s 3", prefix)
public restart2()
client_print(0, print_chat, "%s 2", prefix)
public restart1()
client_print(0, print_chat, "%s 1", prefix)
public restart()
client_print(0, print_chat, "%s Game started! HF GL!", prefix)
public restarted()
client_print(0, print_center, "Thanks for playing with RealWars (RW)", 0, "Thanks for playing with RealWars (RW)")
//new g_teamScore[2]
public teamscores(id, level, cid)
{
new rp = tWins + ctWins
set_hudmessage(255, 255, 0, 0.0, 0.90, 0, 2.0, 8.0, 0.8, 0.8, 3)
show_hudmessage(id, "You are plaing round %d^n CT Score : %d^n T Score : %d", rp, ctWins, tWins )
client_print(0, print_chat, "CT Score : %d^n - T Score : %d", ctWins, tWins )
return PLUGIN_HANDLED
}
public FuncStop(id, level, cid)
{
if(!cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED
started = false
tWins = 0, ctWins = 0
server_cmd("sv_restart 1")
server_cmd("amx_csay The game is now over! You can leave the server NOW!")
client_print(0, print_chat, "%s The game is NOW over! You can leave the server NOW!", 0, "Game started! HF GL!", prefix)
return PLUGIN_HANDLED
}
public FuncFriendlyF(id, level, cid)
{
if(!cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED
if ( (get_cvar_num("mp_friendlyfire")) == 0)
{
server_cmd("mp_friendlyfire 1")
client_print(0, print_chat, "%s Friendlyfire is now on.", prefix)
}
else
{
server_cmd("mp_friendlyfire 0")
client_print(0, print_chat, "%s Friendlyfire is now off.", prefix)
}
return PLUGIN_HANDLED
}
public FuncPass(id, level, cid)
{
if(!cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED
new password[32]
get_cvar_string("sv_password", password, 31)
if (equal(password, ""))
server_cmd("sv_password ^"123^"")
else
server_cmd("sv_password ^"^"")
return PLUGIN_HANDLED
}
public plugin_end()
{
server_cmd("sv_player 1")
}