Versão do master menu editado por [D]etonado[R].
Mas coisas acrescentadas e retiração de alguns bugs...
Qualquer outro Bug comente no tópico que irei resolver.
Mas coisas acrescentadas e retiração de alguns bugs...
Qualquer outro Bug comente no tópico que irei resolver.
- Código:
#include <amxmodx>
#include <amxmisc>
#include <zombieplague>
#define SERVER_PREFIX "(ZPlague)"
#define FLAG_ACESS ADMIN_IMMUNITY
new g_jogador[33]
public plugin_init()
{
register_plugin("[ZP] Master Menu", "1.0", "[D]etonado[R] / [P]erfec[T] [S]cr[@]s[H] / Leozinho")
register_clcmd("[Doar]Quantia", "cmd_doar_ammopacks")
register_clcmd("say /mrmenu", "cmd_master_menu")
register_clcmd("say /mastermenu", "cmd_master_menu")
register_clcmd("say_team /mrmenu", "cmd_master_menu")
register_clcmd("say_team /mastermenu", "cmd_master_menu")
}
public cmd_master_menu(id)
{
if (!(get_user_flags(id) & FLAG_ACESS))
{
client_printcolor(id, "!g%s!t Acesso Negado !", SERVER_PREFIX)
return PLUGIN_HANDLED
}
new szMenu[128]
formatex(szMenu, 127, "\r%s \wMaster Menu:", SERVER_PREFIX)
new menu = menu_create(szMenu, "cmd_master_menu_handler")
menu_additem(menu, "\y[Mudar Claridade do Mapa]", "1")
menu_additem(menu, "\y[Dar Restart no Server]", "2")
menu_additem(menu, "\y[Mudar Tempo do Round]", "3")
menu_additem(menu, "\y[Avisos para Evento]", "4")
menu_additem(menu, "\y[Doar Ammopacks]", "5")
menu_additem(menu, "\y[Amx Mod Menu]", "6")
menu_setprop(menu, MPROP_BACKNAME, "\wVoltar")
menu_setprop(menu, MPROP_NEXTNAME, "\wAvancar")
menu_setprop(menu, MPROP_EXITNAME, "\wSair")
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
menu_display(id, menu, 0)
return PLUGIN_HANDLED
}
public cmd_master_menu_handler(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new data[6], iName[64], access, callback
menu_item_getinfo(menu, item, access, data, 5, iName, 63, callback)
new key = str_to_num(data)
new AdminName[32]; get_user_name(id, AdminName, 31)
switch(key)
{
case 1:
{
cmd_claridade_menu(id)
client_printcolor(0, "!g%s!t o MASTER: !y[ !g%s!y ]!t esta escolhendo a claridade do mapa !", SERVER_PREFIX, AdminName)
}
case 2:
{
cmd_restart_menu(id)
client_printcolor(0, "!g%s!t o MASTER: !y[ !g%s!y ]!t esta dando restart no server !", SERVER_PREFIX, AdminName)
}
case 3:
{
cmd_tempo_menu(id)
client_printcolor(0, "!g%s!t o MASTER: !y[ !g%s!y ]!t esta mudando o tempo do round !", SERVER_PREFIX, AdminName)
}
case 4:
{
cmd_avisos_menu(id)
client_printcolor(0, "!g%s!t o MASTER: !y[ !g%s!y ]!t esta escolhendo avisos para dar no evento !", SERVER_PREFIX, AdminName)
}
case 5:
{
cmd_donate_menu(id)
client_printcolor(0, "!g%s!t o MASTER: !y[ !g%s!y ]!t esta doando ammopacks !", SERVER_PREFIX, AdminName)
}
case 6:
{
client_cmd(id, "amxmodmenu")
client_printcolor(0, "!g%s!t o MASTER: !y[ !g%s!y ]!t esta entrando no amxmodmenu !", SERVER_PREFIX, AdminName)
}
}
return PLUGIN_HANDLED
}
public cmd_claridade_menu(id)
{
new szMenu[128]
formatex(szMenu, 127, "\r%s \wEscolha a claridade do mapa:", SERVER_PREFIX)
new menu = menu_create(szMenu, "cmd_claridade_menu_handler")
menu_additem(menu, "\y[Escuridao | Alta]", "1")
menu_additem(menu, "\y[Escuridao | Media]", "2")
menu_additem(menu, "\y[Escuridao | Baixa]^n", "3")
menu_additem(menu, "\y[Claridade | Alta]", "4")
menu_additem(menu, "\y[Claridade | Media]", "5")
menu_additem(menu, "\y[Claridade | Baixa]^n", "6")
menu_setprop(menu, MPROP_BACKNAME, "\wVoltar")
menu_setprop(menu, MPROP_NEXTNAME, "\wAvancar")
menu_setprop(menu, MPROP_EXITNAME, "\wSair")
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
menu_display(id, menu, 0)
return PLUGIN_HANDLED
}
public cmd_claridade_menu_handler(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new data[6], iName[64], access, callback
menu_item_getinfo(menu, item, access, data, 5, iName, 63, callback)
new key = str_to_num(data)
new AdminName[32]; get_user_name(id, AdminName, 31)
switch(key)
{
case 1:
{
server_cmd("zp_lighting a")
client_printcolor(0, "!g%s!t o MASTER: !y[ !g%s!y ]!t colocou na escuridao !y[alta]!t !", SERVER_PREFIX, AdminName)
}
case 2:
{
server_cmd("zp_lighting c")
client_printcolor(0, "!g%s!t o MASTER: !y[ !g%s!y ]!t colocou na escuridao !y[media]!t !", SERVER_PREFIX, AdminName)
}
case 3:
{
server_cmd("zp_lighting e")
client_printcolor(0, "!g%s!t o MASTER: !y[ !g%s!y ]!t colocou na escuridao !y[baixa]!t !", SERVER_PREFIX, AdminName)
}
case 4:
{
server_cmd("zp_lighting k")
client_printcolor(0, "!g%s!t o MASTER: !y[ !g%s!y ]!t colocou na claridade !y[alta]!t !", SERVER_PREFIX, AdminName)
}
case 5:
{
server_cmd("zp_lighting i")
client_printcolor(0, "!g%s!t o MASTER: !y[ !g%s!y ]!t colocou na claridade !y[media]!t !", SERVER_PREFIX, AdminName)
}
case 6:
{
server_cmd("zp_lighting g")
client_printcolor(0, "!g%s!t o MASTER: !y[ !g%s!y ]!t colocou na claridade !y[baixa]!t !", SERVER_PREFIX, AdminName)
}
}
return PLUGIN_HANDLED
}
public cmd_restart_menu(id)
{
new szMenu[128]
formatex(szMenu, 127, "\r%s \wEscolha o tempo do restart:", SERVER_PREFIX)
new menu = menu_create(szMenu, "cmd_restart_menu_handler")
menu_additem(menu, "\y[Restart | 1 segundo]", "1")
menu_additem(menu, "\y[Restart | 3 segundos]", "2")
menu_additem(menu, "\y[Restart | 5 segundos]^n", "3")
menu_additem(menu, "\y[Restart | 10 segundos]", "4")
menu_additem(menu, "\y[Restart | 30 segundos]", "5")
menu_additem(menu, "\y[Restart | 50 segundos]^n", "6")
menu_setprop(menu, MPROP_BACKNAME, "\wVoltar")
menu_setprop(menu, MPROP_NEXTNAME, "\wAvancar")
menu_setprop(menu, MPROP_EXITNAME, "\wSair")
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
menu_display(id, menu, 0)
return PLUGIN_HANDLED
}
public cmd_restart_menu_handler(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new data[6], iName[64], access, callback
menu_item_getinfo(menu, item, access, data, 5, iName, 63, callback)
new key = str_to_num(data)
new AdminName[32]; get_user_name(id, AdminName, 31)
switch(key)
{
case 1:
{
server_cmd("sv_restartround 1")
client_printcolor(0, "!g%s!t o MASTER: !y[ !g%s!y ]!t deu restart de !y[1 segundo]!t !", SERVER_PREFIX, AdminName)
}
case 2:
{
server_cmd("sv_restartround 3")
client_printcolor(0, "!g%s!t o MASTER: !y[ !g%s!y ]!t deu restart de !y[3 segundos]!t !", SERVER_PREFIX, AdminName)
}
case 3:
{
server_cmd("sv_restartround 5")
client_printcolor(0, "!g%s!t o MASTER: !y[ !g%s!y ]!t deu restart de !y[5 segundos]!t !", SERVER_PREFIX, AdminName)
}
case 4:
{
server_cmd("sv_restartround 10")
client_printcolor(0, "!g%s!t o MASTER: !y[ !g%s!y ]!t deu restart de !y[10 segundos]!t !", SERVER_PREFIX, AdminName)
}
case 5:
{
server_cmd("sv_restartround 30")
client_printcolor(0, "!g%s!t o MASTER: !y[ !g%s!y ]!t deu restart de !y[30 segundos]!t !", SERVER_PREFIX, AdminName)
}
case 6:
{
server_cmd("sv_restartround 50")
client_printcolor(0, "!g%s!t o MASTER: !y[ !g%s!y ]!t deu restart de !y[50 segundos]!t !", SERVER_PREFIX, AdminName)
}
}
return PLUGIN_HANDLED
}
public cmd_tempo_menu(id)
{
new szMenu[128]
formatex(szMenu, 127, "\r%s \wEscolha o tempo do round:", SERVER_PREFIX)
new menu = menu_create(szMenu, "cmd_tempo_menu_handler")
menu_additem(menu, "\y[Round | 5 minutos]", "1")
menu_additem(menu, "\y[Round | 7 minutos]", "2")
menu_additem(menu, "\y[Round | 9 minutos]^n", "3")
menu_additem(menu, "\y[Round | 50 minutos]", "4")
menu_additem(menu, "\y[Round | 70 minutos]", "5")
menu_additem(menu, "\y[Round | 90 minutos]^n", "6")
menu_setprop(menu, MPROP_BACKNAME, "\wVoltar")
menu_setprop(menu, MPROP_NEXTNAME, "\wAvancar")
menu_setprop(menu, MPROP_EXITNAME, "\wSair")
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
menu_display(id, menu, 0)
return PLUGIN_HANDLED
}
public cmd_tempo_menu_handler(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new data[6], iName[64], access, callback
menu_item_getinfo(menu, item, access, data, 5, iName, 63, callback)
new key = str_to_num(data)
new AdminName[32]; get_user_name(id, AdminName, 31)
switch(key)
{
case 1:
{
set_cvar_num("mp_roundtime", 5)
client_printcolor(0, "!g%s!t o MASTER: !y[ !g%s!y ]!t mudou o tempo do round para !y[5 minutos]!t !", SERVER_PREFIX, AdminName)
}
case 2:
{
set_cvar_num("mp_roundtime", 7)
client_printcolor(0, "!g%s!t o MASTER: !y[ !g%s!y ]!t mudou o tempo do round para !y[7 minutos]!t !", SERVER_PREFIX, AdminName)
}
case 3:
{
set_cvar_num("mp_roundtime", 9)
client_printcolor(0, "!g%s!t o MASTER: !y[ !g%s!y ]!t mudou o tempo do round para !y[9 minutos]!t !", SERVER_PREFIX, AdminName)
}
case 4:
{
set_cvar_num("mp_roundtime", 50)
client_printcolor(0, "!g%s!t o MASTER: !y[ !g%s!y ]!t mudou o tempo do round para !y[50 minutos]!t !", SERVER_PREFIX, AdminName)
}
case 5:
{
set_cvar_num("mp_roundtime", 70)
client_printcolor(0, "!g%s!t o MASTER: !y[ !g%s!y ]!t mudou o tempo do round para !y[70 minutos]!t !", SERVER_PREFIX, AdminName)
}
case 6:
{
set_cvar_num("mp_roundtime", 90)
client_printcolor(0, "!g%s!t o MASTER: !y[ !g%s!y ]!t mudou o tempo do round para !y[90 minutos]!t !", SERVER_PREFIX, AdminName)
}
}
return PLUGIN_HANDLED
}
public cmd_avisos_menu(id)
{
new szMenu[128]
formatex(szMenu, 127, "\r%s \wEscolha os avisos de evento:", SERVER_PREFIX)
new menu = menu_create(szMenu, "cmd_avisos_menu_handler")
menu_additem(menu, "\y[Evento vai comecar | 5:00]", "1")
menu_additem(menu, "\y[Evento vai comecar | 7:00]", "2")
menu_additem(menu, "\y[Evento vai comecar | 9:00]^n", "3")
menu_additem(menu, "\y[Proibido Comprar multijump no Evento]", "4")
menu_additem(menu, "\y[Proibido Dedurar os players no Evento]", "5")
menu_additem(menu, "\y[Proibido Atirar no Nemesis/Assassin no Evento]^n", "6")
menu_setprop(menu, MPROP_BACKNAME, "\wVoltar")
menu_setprop(menu, MPROP_NEXTNAME, "\wAvancar")
menu_setprop(menu, MPROP_EXITNAME, "\wSair")
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
menu_display(id, menu, 0)
return PLUGIN_HANDLED
}
public cmd_avisos_menu_handler(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new data[6], iName[64], access, callback
menu_item_getinfo(menu, item, access, data, 5, iName, 63, callback)
new key = str_to_num(data)
new AdminName[32]; get_user_name(id, AdminName, 31)
switch(key)
{
case 1:
{
client_cmd(id, "say @@r o Evento vai comecar as 5:00 em ponto !")
client_printcolor(0, "!g%s!t o MASTER: !y[ !g%s!y ]!t esta mandando um !y[aviso]!t !", SERVER_PREFIX, AdminName)
}
case 2:
{
client_cmd(id, "say @@r o Evento vai comecar as 7:00 em ponto !")
client_printcolor(0, "!g%s!t o MASTER: !y[ !g%s!y ]!t esta mandando um !y[aviso]!t !", SERVER_PREFIX, AdminName)
}
case 3:
{
client_cmd(id, "say @@r o Evento vai comecar as 9:00 em ponto !")
client_printcolor(0, "!g%s!t o MASTER: !y[ !g%s!y ]!t esta mandando um !y[aviso]!t !", SERVER_PREFIX, AdminName)
}
case 4:
{
client_cmd(id, "say @@r E Proibido Comprar multijump no Evento !")
client_printcolor(0, "!g%s!t o MASTER: !y[ !g%s!y ]!t esta mandando um !y[aviso]!t !", SERVER_PREFIX, AdminName)
}
case 5:
{
client_cmd(id, "say @@r E Proibido Dedurar os players no Evento !")
client_printcolor(0, "!g%s!t o MASTER: !y[ !g%s!y ]!t esta mandando um !y[aviso]!t !", SERVER_PREFIX, AdminName)
}
case 6:
{
client_cmd(id, "say @@r E Proibido Atirar no Nemesis/Assassin no Evento !")
client_printcolor(0, "!g%s!t o MASTER: !y[ !g%s!y ]!t esta mandando um !y[aviso]!t !", SERVER_PREFIX, AdminName)
}
}
return PLUGIN_HANDLED
}
public cmd_donate_menu(id)
{
new szMenu[128]
formatex(szMenu, 127, "\r%s \wEscolha um Jogador:\y^n^n\wSaldo Sacado: \r[%i]", SERVER_PREFIX, zp_get_user_ammo_packs(id))
new menu = menu_create(szMenu, "cmd_donate_menu_handler")
new players[32], pnum, tempid
new szName[32], szTempid[10]
get_players(players, pnum)
for (new i; i<pnum; i++)
{
tempid = players[i]
if (id != tempid)
{
get_user_name(tempid, szName, 31)
num_to_str(tempid, szTempid, 9)
menu_additem(menu, szName, szTempid, 0)
}
}
menu_setprop(menu, MPROP_BACKNAME, "\wVoltar")
menu_setprop(menu, MPROP_NEXTNAME, "\wAvancar")
menu_setprop(menu, MPROP_EXITNAME, "\wSair")
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
menu_display(id, menu, 0)
return PLUGIN_HANDLED
}
public cmd_donate_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)
g_jogador[id] = str_to_num(data)
new PlayerName[32]; get_user_name(g_jogador[id], PlayerName, 31)
if (!is_user_connected(g_jogador[id]))
{
client_printcolor(id, "!g%s!y o Jogador !t%s!y nao esta no Servidor.", PlayerName)
cmd_donate_menu(id)
return PLUGIN_HANDLED
}
client_cmd(id, "messagemode [Doar]Quantia")
set_hudmessage(0, 0, 255, 0.01, 0.12, 0, 6.0, 12.0)
show_hudmessage(id, "Digite a quantia que voce deseja doar...")
return PLUGIN_HANDLED
}
public cmd_doar_ammopacks(id)
{
new AdminName[32]; get_user_name(id, AdminName, 31)
new PlayerName[32]; get_user_name(g_jogador[id], PlayerName, 31)
new amount[30]; read_args(amount, charsmax(amount))
remove_quotes(amount)
new num_ammopacks = str_to_num(amount)
if (equal(amount, "") || equal(amount, " "))
{
client_printcolor(id, "!g%s!t Quantia invalida !", SERVER_PREFIX)
cmd_donate_menu(id)
return PLUGIN_HANDLED
}
if (num_ammopacks <= 0)
{
client_printcolor(id, "!g%s!t Quantia invalida !", SERVER_PREFIX)
cmd_donate_menu(id)
return PLUGIN_HANDLED
}
if (num_ammopacks > zp_get_user_ammo_packs(id))
{
client_printcolor(id, "!g%s!y Voce nao possui !t[%i]!y ammopacks para doar !", SERVER_PREFIX, num_ammopacks)
cmd_donate_menu(id)
return PLUGIN_HANDLED
}
zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) - num_ammopacks)
zp_set_user_ammo_packs(g_jogador[id], zp_get_user_ammo_packs(g_jogador[id]) + num_ammopacks)
client_printcolor(0, "!g%s!t o MASTER: !y[ !g%s!y ]!t doou !y[%i]!t ammopacks para o Jogador: !y[ !g%s!y ]", SERVER_PREFIX, AdminName, num_ammopacks, PlayerName)
cmd_donate_menu(id)
return PLUGIN_CONTINUE
}
stock client_printcolor(const id, const input[], any:...)
{
new count = 1, players[32]
static msg[191]
vformat(msg, 190, input, 3)
replace_all(msg, 190, "!g", "^4") // Cor Verde
replace_all(msg, 190, "!y", "^1") // Cor Normal
replace_all(msg, 190, "!t", "^3") // Cor do Time [TR = Vermelho] [CT = Azul] [SPECT = Branco]
replace_all(msg, 190, "!t2", "^0") // Cor do Time [TR = Vermelho] [CT = Azul] [SPECT = Branco]
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()
}
}
}
Última edição por [D]etonado[R] em 30/1/2014, 12:50 am, editado 1 vez(es)