mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-25 14:25:38 +03:00
new cleaned-up version of the plugins (no more OLOcode :D)
This commit is contained in:
parent
12bf140931
commit
ddf3b6df32
@ -38,34 +38,45 @@
|
|||||||
new g_msgChannel
|
new g_msgChannel
|
||||||
|
|
||||||
#define MAX_CLR 10
|
#define MAX_CLR 10
|
||||||
new g_Colors[MAX_CLR][] = {"COL_WHITE","COL_RED","COL_GREEN","COL_BLUE","COL_YELLOW","COL_MAGENTA","COL_CYAN","COL_ORANGE","COL_OCEAN","COL_MAROON"}
|
|
||||||
new g_Values[MAX_CLR][] = {{255,255,255},{255,0,0},{0,255,0},{0,0,255},{255,255,0},{255,0,255},{0,255,255},{227,96,8},{45,89,116},{103,44,38}}
|
|
||||||
new Float:g_Pos[4][] = {{0.0,0.0},{0.05,0.55},{-1.0,0.2},{-1.0,0.7}}
|
|
||||||
|
|
||||||
public plugin_init() {
|
new g_Colors[MAX_CLR][] = {"COL_WHITE", "COL_RED", "COL_GREEN", "COL_BLUE", "COL_YELLOW", "COL_MAGENTA", "COL_CYAN", "COL_ORANGE", "COL_OCEAN", "COL_MAROON"}
|
||||||
register_plugin("Admin Chat",AMXX_VERSION_STR,"AMXX Dev Team")
|
new g_Values[MAX_CLR][] = {{255, 255, 255}, {255, 0, 0}, {0, 255, 0}, {0, 0, 255}, {255, 255, 0}, {255, 0, 255}, {0, 255, 255}, {227, 96, 8}, {45, 89, 116}, {103, 44, 38}}
|
||||||
|
new Float:g_Pos[4][] = {{0.0, 0.0}, {0.05, 0.55}, {-1.0, 0.2}, {-1.0, 0.7}}
|
||||||
|
|
||||||
|
public plugin_init()
|
||||||
|
{
|
||||||
|
register_plugin("Admin Chat", AMXX_VERSION_STR, "AMXX Dev Team")
|
||||||
register_dictionary("adminchat.txt")
|
register_dictionary("adminchat.txt")
|
||||||
register_dictionary("common.txt")
|
register_dictionary("common.txt")
|
||||||
register_clcmd("say","cmdSayChat",ADMIN_CHAT,"@[@|@|@][w|r|g|b|y|m|c]<text> - displays hud message")
|
register_clcmd("say", "cmdSayChat", ADMIN_CHAT, "@[@|@|@][w|r|g|b|y|m|c]<text> - displays hud message")
|
||||||
register_clcmd("say_team","cmdSayAdmin",0,"@<text> - displays message to admins")
|
register_clcmd("say_team", "cmdSayAdmin", 0, "@<text> - displays message to admins")
|
||||||
register_concmd("amx_say","cmdSay",ADMIN_CHAT,"<message> - sends message to all players")
|
register_concmd("amx_say", "cmdSay", ADMIN_CHAT, "<message> - sends message to all players")
|
||||||
register_concmd("amx_chat","cmdChat",ADMIN_CHAT,"<message> - sends message to admins")
|
register_concmd("amx_chat", "cmdChat", ADMIN_CHAT, "<message> - sends message to admins")
|
||||||
register_concmd("amx_psay","cmdPsay",ADMIN_CHAT,"<name or #userid> <message> - sends private message")
|
register_concmd("amx_psay", "cmdPsay", ADMIN_CHAT, "<name or #userid> <message> - sends private message")
|
||||||
register_concmd("amx_tsay","cmdTsay",ADMIN_CHAT,"<color> <message> - sends left side hud message to all players")
|
register_concmd("amx_tsay", "cmdTsay", ADMIN_CHAT, "<color> <message> - sends left side hud message to all players")
|
||||||
register_concmd("amx_csay","cmdTsay",ADMIN_CHAT,"<color> <message> - sends center hud message to all players")
|
register_concmd("amx_csay", "cmdTsay", ADMIN_CHAT, "<color> <message> - sends center hud message to all players")
|
||||||
}
|
}
|
||||||
|
|
||||||
public cmdSayChat(id) {
|
public cmdSayChat(id)
|
||||||
if (!access(id,ADMIN_CHAT)) return PLUGIN_CONTINUE
|
{
|
||||||
new said[6], i=0
|
if (!access(id, ADMIN_CHAT))
|
||||||
read_argv(1,said,5)
|
return PLUGIN_CONTINUE
|
||||||
while (said[i]=='@')
|
|
||||||
|
new said[6], i = 0
|
||||||
|
read_argv(1, said, 5)
|
||||||
|
|
||||||
|
while (said[i] == '@')
|
||||||
i++
|
i++
|
||||||
if ( !i || i > 3 ) return PLUGIN_CONTINUE
|
|
||||||
|
if (!i || i > 3)
|
||||||
|
return PLUGIN_CONTINUE
|
||||||
|
|
||||||
new message[192], a = 0
|
new message[192], a = 0
|
||||||
read_args(message,191)
|
read_args(message, 191)
|
||||||
remove_quotes(message)
|
remove_quotes(message)
|
||||||
switch(said[i]){
|
|
||||||
|
switch(said[i])
|
||||||
|
{
|
||||||
case 'r': a = 1
|
case 'r': a = 1
|
||||||
case 'g': a = 2
|
case 'g': a = 2
|
||||||
case 'b': a = 3
|
case 'b': a = 3
|
||||||
@ -74,169 +85,223 @@ public cmdSayChat(id) {
|
|||||||
case 'c': a = 6
|
case 'c': a = 6
|
||||||
case 'o': a = 7
|
case 'o': a = 7
|
||||||
}
|
}
|
||||||
|
|
||||||
new name[32], authid[32], userid
|
new name[32], authid[32], userid
|
||||||
get_user_authid(id,authid,31)
|
|
||||||
get_user_name(id,name,31)
|
get_user_authid(id, authid, 31)
|
||||||
|
get_user_name(id, name, 31)
|
||||||
userid = get_user_userid(id)
|
userid = get_user_userid(id)
|
||||||
log_amx("Chat: ^"%s<%d><%s><>^" tsay ^"%s^"",name,userid,authid,message[i+1])
|
|
||||||
log_message("^"%s<%d><%s><>^" triggered ^"amx_tsay^" (text ^"%s^") (color ^"%L^")",
|
log_amx("Chat: ^"%s<%d><%s><>^" tsay ^"%s^"", name, userid, authid, message[i + 1])
|
||||||
name,userid,authid,message[ i+1 ],"en",g_Colors[a])
|
log_message("^"%s<%d><%s><>^" triggered ^"amx_tsay^" (text ^"%s^") (color ^"%L^")", name, userid, authid, message[i + 1], "en", g_Colors[a])
|
||||||
if (++g_msgChannel>6||g_msgChannel<3)
|
|
||||||
|
if (++g_msgChannel > 6 || g_msgChannel < 3)
|
||||||
g_msgChannel = 3
|
g_msgChannel = 3
|
||||||
|
|
||||||
new Float:verpos = g_Pos[i][1] + float(g_msgChannel) / 35.0
|
new Float:verpos = g_Pos[i][1] + float(g_msgChannel) / 35.0
|
||||||
set_hudmessage(g_Values[a][0], g_Values[a][1], g_Values[a][2],
|
|
||||||
g_Pos[i][0], verpos , 0, 6.0, 6.0, 0.5, 0.15, g_msgChannel )
|
|
||||||
|
|
||||||
if ( get_cvar_num("amx_show_activity") == 2 ){
|
set_hudmessage(g_Values[a][0], g_Values[a][1], g_Values[a][2], g_Pos[i][0], verpos, 0, 6.0, 6.0, 0.5, 0.15, g_msgChannel)
|
||||||
show_hudmessage(0,"%s : %s",name,message[i+1])
|
|
||||||
client_print(0,print_notify,"%s : %s",name,message[i+1])
|
if (get_cvar_num("amx_show_activity") == 2)
|
||||||
}
|
{
|
||||||
else{
|
show_hudmessage(0, "%s : %s", name, message[i + 1])
|
||||||
show_hudmessage(0,"%s", message[i+1])
|
client_print(0, print_notify, "%s : %s", name, message[i + 1])
|
||||||
client_print(0,print_notify,"%s", message[i+1])
|
} else {
|
||||||
|
show_hudmessage(0, "%s", message[i + 1])
|
||||||
|
client_print(0, print_notify, "%s", message[i + 1])
|
||||||
}
|
}
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
public cmdSayAdmin(id) {
|
public cmdSayAdmin(id)
|
||||||
|
{
|
||||||
new said[2]
|
new said[2]
|
||||||
read_argv(1,said,1)
|
read_argv(1, said, 1)
|
||||||
if (said[0]!='@') return PLUGIN_CONTINUE
|
|
||||||
new message[192], name[32],authid[32], userid
|
if (said[0] != '@')
|
||||||
|
return PLUGIN_CONTINUE
|
||||||
|
|
||||||
|
new message[192], name[32], authid[32], userid
|
||||||
new players[32], inum
|
new players[32], inum
|
||||||
read_args(message,191)
|
|
||||||
|
read_args(message, 191)
|
||||||
remove_quotes(message)
|
remove_quotes(message)
|
||||||
get_user_authid(id,authid,31)
|
get_user_authid(id, authid, 31)
|
||||||
get_user_name(id,name,31)
|
get_user_name(id, name, 31)
|
||||||
userid = get_user_userid(id)
|
userid = get_user_userid(id)
|
||||||
log_amx("Chat: ^"%s<%d><%s><>^" chat ^"%s^"",name,userid,authid,message[1])
|
|
||||||
log_message("^"%s<%d><%s><>^" triggered ^"amx_chat^" (text ^"%s^")",name,userid,authid,message[1])
|
log_amx("Chat: ^"%s<%d><%s><>^" chat ^"%s^"", name, userid, authid, message[1])
|
||||||
format(message,191,"(ADMINS) %s : %s",name,message[1])
|
log_message("^"%s<%d><%s><>^" triggered ^"amx_chat^" (text ^"%s^")", name, userid, authid, message[1])
|
||||||
get_players(players,inum)
|
|
||||||
for (new i=0; i<inum; ++i){
|
format(message, 191, "(ADMINS) %s : %s", name, message[1])
|
||||||
|
get_players(players, inum)
|
||||||
|
|
||||||
|
for (new i = 0; i < inum; ++i)
|
||||||
|
{
|
||||||
if (players[i] != id && get_user_flags(players[i]) & ADMIN_CHAT)
|
if (players[i] != id && get_user_flags(players[i]) & ADMIN_CHAT)
|
||||||
client_print(players[i],print_chat,"%s",message)
|
client_print(players[i], print_chat, "%s", message)
|
||||||
}
|
}
|
||||||
client_print(id,print_chat,"%s",message)
|
|
||||||
|
client_print(id, print_chat, "%s", message)
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
public cmdChat(id,level,cid) {
|
public cmdChat(id, level, cid)
|
||||||
if (!cmd_access(id,level,cid,2))
|
{
|
||||||
|
if (!cmd_access(id, level, cid, 2))
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
|
|
||||||
new message[192], name[32], players[32], inum, authid[32], userid
|
new message[192], name[32], players[32], inum, authid[32], userid
|
||||||
read_args(message,191)
|
|
||||||
|
read_args(message, 191)
|
||||||
remove_quotes(message)
|
remove_quotes(message)
|
||||||
get_user_authid(id,authid,31)
|
get_user_authid(id, authid, 31)
|
||||||
get_user_name(id,name,31)
|
get_user_name(id, name, 31)
|
||||||
userid = get_user_userid(id)
|
userid = get_user_userid(id)
|
||||||
get_players(players,inum)
|
get_players(players, inum)
|
||||||
log_amx("Chat: ^"%s<%d><%s><>^" chat ^"%s^"",name,userid,authid,message)
|
|
||||||
log_message("^"%s<%d><%s><>^" triggered ^"amx_chat^" (text ^"%s^")",name,userid,authid,message)
|
log_amx("Chat: ^"%s<%d><%s><>^" chat ^"%s^"", name, userid, authid, message)
|
||||||
format(message,191,"(ADMINS) %s : %s",name,message)
|
log_message("^"%s<%d><%s><>^" triggered ^"amx_chat^" (text ^"%s^")", name, userid, authid, message)
|
||||||
console_print(id,"%s",message)
|
|
||||||
for (new i = 0; i < inum; ++i) {
|
format(message, 191, "(ADMINS) %s : %s", name, message)
|
||||||
if ( access(players[i],ADMIN_CHAT) )
|
console_print(id, "%s", message)
|
||||||
client_print(players[i],print_chat,"%s",message)
|
|
||||||
|
for (new i = 0; i < inum; ++i)
|
||||||
|
{
|
||||||
|
if (access(players[i], ADMIN_CHAT))
|
||||||
|
client_print(players[i], print_chat, "%s", message)
|
||||||
}
|
}
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
public cmdSay(id,level,cid) {
|
public cmdSay(id, level, cid)
|
||||||
if (!cmd_access(id,level,cid,2))
|
{
|
||||||
|
if (!cmd_access(id, level, cid, 2))
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
new message[192],name[32],authid[32],userid
|
|
||||||
read_args(message,191)
|
new message[192], name[32], authid[32], userid
|
||||||
|
|
||||||
|
read_args(message, 191)
|
||||||
remove_quotes(message)
|
remove_quotes(message)
|
||||||
get_user_authid(id,authid,31)
|
get_user_authid(id, authid, 31)
|
||||||
get_user_name(id,name,31)
|
get_user_name(id, name, 31)
|
||||||
userid = get_user_userid(id)
|
userid = get_user_userid(id)
|
||||||
client_print(0,print_chat,"%L",LANG_PLAYER, "PRINT_ALL",name,message)
|
client_print(0, print_chat, "%L", LANG_PLAYER, "PRINT_ALL", name, message)
|
||||||
console_print(id,"%L",LANG_PLAYER,"PRINT_ALL",name,message)
|
console_print(id, "%L", LANG_PLAYER, "PRINT_ALL", name, message)
|
||||||
log_amx("Chat: ^"%s<%d><%s><>^" say ^"%s^"", name,userid,authid,message)
|
|
||||||
log_message("^"%s<%d><%s><>^" triggered ^"amx_say^" (text ^"%s^")",name,userid,authid,message)
|
log_amx("Chat: ^"%s<%d><%s><>^" say ^"%s^"", name, userid, authid, message)
|
||||||
|
log_message("^"%s<%d><%s><>^" triggered ^"amx_say^" (text ^"%s^")", name, userid, authid, message)
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
public cmdPsay(id,level,cid) {
|
public cmdPsay(id, level, cid)
|
||||||
if (!cmd_access(id,level,cid,3))
|
{
|
||||||
|
if (!cmd_access(id, level, cid, 3))
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
|
|
||||||
new name[32]
|
new name[32]
|
||||||
read_argv(1,name,31)
|
read_argv(1, name, 31)
|
||||||
new priv = cmd_target(id,name,0)
|
new priv = cmd_target(id, name, 0)
|
||||||
if (!priv) return PLUGIN_HANDLED
|
|
||||||
new length = strlen(name)+1
|
if (!priv)
|
||||||
new message[192], name2[32],authid[32],authid2[32], userid, userid2
|
return PLUGIN_HANDLED
|
||||||
get_user_authid(id,authid,31)
|
|
||||||
get_user_name(id,name2,31)
|
new length = strlen(name) + 1
|
||||||
|
new message[192], name2[32], authid[32], authid2[32], userid, userid2
|
||||||
|
|
||||||
|
get_user_authid(id, authid, 31)
|
||||||
|
get_user_name(id, name2, 31)
|
||||||
userid = get_user_userid(id)
|
userid = get_user_userid(id)
|
||||||
read_args(message,191)
|
read_args(message, 191)
|
||||||
if (message[0]=='"' && message[length]=='"'){ // HLSW fix
|
|
||||||
message[0]=' '
|
if (message[0] == '"' && message[length] == '"') // HLSW fix
|
||||||
message[length]=' '
|
{
|
||||||
length+=2
|
message[0] = ' '
|
||||||
|
message[length] = ' '
|
||||||
|
length += 2
|
||||||
}
|
}
|
||||||
|
|
||||||
remove_quotes(message[length])
|
remove_quotes(message[length])
|
||||||
get_user_name(priv,name,31)
|
get_user_name(priv, name, 31)
|
||||||
if (id&&id!=priv) client_print(id,print_chat,"(%s) %s : %s",name,name2,message[length])
|
|
||||||
client_print(priv,print_chat,"(%s) %s : %s",name,name2,message[length])
|
if (id && id != priv)
|
||||||
console_print(id,"(%s) %s : %s",name,name2,message[length])
|
client_print(id, print_chat, "(%s) %s : %s", name, name2, message[length])
|
||||||
get_user_authid(priv,authid2,31)
|
|
||||||
|
client_print(priv, print_chat, "(%s) %s : %s", name, name2, message[length])
|
||||||
|
console_print(id, "(%s) %s : %s", name, name2, message[length])
|
||||||
|
get_user_authid(priv, authid2, 31)
|
||||||
userid2 = get_user_userid(priv)
|
userid2 = get_user_userid(priv)
|
||||||
log_amx("Chat: ^"%s<%d><%s><>^" psay ^"%s<%d><%s><>^" ^"%s^"",
|
|
||||||
name2,userid,authid,name,userid2,authid2,message[length])
|
log_amx("Chat: ^"%s<%d><%s><>^" psay ^"%s<%d><%s><>^" ^"%s^"", name2, userid, authid, name, userid2, authid2, message[length])
|
||||||
log_message("^"%s<%d><%s><>^" triggered ^"amx_psay^" against ^"%s<%d><%s><>^" (text ^"%s^")",
|
log_message("^"%s<%d><%s><>^" triggered ^"amx_psay^" against ^"%s<%d><%s><>^" (text ^"%s^")", name2, userid, authid, name, userid2, authid2, message[length])
|
||||||
name2,userid,authid,name,userid2,authid2,message[length])
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
public cmdTsay(id,level,cid) {
|
public cmdTsay(id, level, cid)
|
||||||
if (!cmd_access(id,level,cid,3))
|
{
|
||||||
|
if (!cmd_access(id, level, cid, 3))
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
|
|
||||||
new cmd[16], color[16], color2[16], message[192], name[32], authid[32], userid = 0
|
new cmd[16], color[16], color2[16], message[192], name[32], authid[32], userid = 0
|
||||||
read_argv(0,cmd,15)
|
|
||||||
|
read_argv(0, cmd, 15)
|
||||||
new bool:tsay = (tolower(cmd[4]) == 't')
|
new bool:tsay = (tolower(cmd[4]) == 't')
|
||||||
read_args(message,191)
|
|
||||||
|
read_args(message, 191)
|
||||||
remove_quotes(message)
|
remove_quotes(message)
|
||||||
parse(message,color,15)
|
parse(message, color, 15)
|
||||||
new found = 0,a = 0
|
|
||||||
new lang[3],langnum = get_langsnum()
|
new found = 0, a = 0
|
||||||
for (new i=0;i<MAX_CLR;++i) {
|
new lang[3], langnum = get_langsnum()
|
||||||
for (new j=0;j<langnum;j++) {
|
|
||||||
get_lang(j,lang)
|
for (new i = 0; i < MAX_CLR; ++i)
|
||||||
format(color2,15,"%L",lang,g_Colors[i])
|
{
|
||||||
if (equali(color,color2)) {
|
for (new j = 0; j < langnum; j++)
|
||||||
|
{
|
||||||
|
get_lang(j, lang)
|
||||||
|
format(color2, 15, "%L", lang, g_Colors[i])
|
||||||
|
|
||||||
|
if (equali(color, color2))
|
||||||
|
{
|
||||||
a = i
|
a = i
|
||||||
found = 1
|
found = 1
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (found==1)
|
if (found == 1)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
new length = found ? (strlen(color) + 1) : 0
|
new length = found ? (strlen(color) + 1) : 0
|
||||||
if (++g_msgChannel>6||g_msgChannel<3)
|
|
||||||
|
if (++g_msgChannel > 6 || g_msgChannel < 3)
|
||||||
g_msgChannel = 3
|
g_msgChannel = 3
|
||||||
new Float:verpos = ( tsay ? 0.55 : 0.1 ) + float(g_msgChannel) / 35.0
|
|
||||||
get_user_authid(id,authid,31)
|
new Float:verpos = (tsay ? 0.55 : 0.1) + float(g_msgChannel) / 35.0
|
||||||
get_user_name(id,name,31)
|
|
||||||
|
get_user_authid(id, authid, 31)
|
||||||
|
get_user_name(id, name, 31)
|
||||||
userid = get_user_userid(id)
|
userid = get_user_userid(id)
|
||||||
set_hudmessage(g_Values[a][0], g_Values[a][1], g_Values[a][2], tsay ? 0.05 : -1.0, verpos, 0, 6.0, 6.0, 0.5, 0.15, g_msgChannel)
|
set_hudmessage(g_Values[a][0], g_Values[a][1], g_Values[a][2], tsay ? 0.05 : -1.0, verpos, 0, 6.0, 6.0, 0.5, 0.15, g_msgChannel)
|
||||||
|
|
||||||
if ( get_cvar_num("amx_show_activity") == 2 ){
|
if (get_cvar_num("amx_show_activity") == 2)
|
||||||
show_hudmessage(0,"%s : %s",name,message[length])
|
{
|
||||||
client_print(0,print_notify,"%s : %s",name,message[length])
|
show_hudmessage(0, "%s : %s", name, message[length])
|
||||||
console_print(id,"%s : %s",name,message[length])
|
client_print(0, print_notify, "%s : %s", name, message[length])
|
||||||
}
|
console_print(id, "%s : %s", name, message[length])
|
||||||
else{
|
} else {
|
||||||
show_hudmessage(0,"%s",message[length])
|
show_hudmessage(0, "%s", message[length])
|
||||||
client_print(0,print_notify,"%s",message[length])
|
client_print(0, print_notify, "%s", message[length])
|
||||||
console_print(id,"%s",message[length])
|
console_print(id, "%s", message[length])
|
||||||
}
|
}
|
||||||
|
|
||||||
log_amx("Chat: ^"%s<%d><%s><>^" %s ^"%s^"",name,userid,authid,cmd[4],message[length])
|
log_amx("Chat: ^"%s<%d><%s><>^" %s ^"%s^"", name, userid, authid, cmd[4], message[length])
|
||||||
log_message("^"%s<%d><%s><>^" triggered ^"%s^" (text ^"%s^") (color ^"%s^")",
|
log_message("^"%s<%d><%s><>^" triggered ^"%s^" (text ^"%s^") (color ^"%s^")", name, userid, authid, cmd, message[length], color2)
|
||||||
name,userid,authid,cmd,message[length],color2)
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
1006
plugins/admincmd.sma
1006
plugins/admincmd.sma
File diff suppressed because it is too large
Load Diff
@ -37,73 +37,86 @@
|
|||||||
#define DISPLAY_MSG // Comment to disable message on join
|
#define DISPLAY_MSG // Comment to disable message on join
|
||||||
#define HELPAMOUNT 10 // Number of commands per page
|
#define HELPAMOUNT 10 // Number of commands per page
|
||||||
|
|
||||||
public plugin_init() {
|
public plugin_init()
|
||||||
register_plugin("Admin Help",AMXX_VERSION_STR,"AMXX Dev Team")
|
{
|
||||||
|
register_plugin("Admin Help", AMXX_VERSION_STR, "AMXX Dev Team")
|
||||||
register_dictionary("adminhelp.txt")
|
register_dictionary("adminhelp.txt")
|
||||||
register_concmd("amx_help","cmdHelp",0,"<page> [nr of cmds (only for server)] - displays this help")
|
register_concmd("amx_help", "cmdHelp", 0, "<page> [nr of cmds (only for server)] - displays this help")
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined DISPLAY_MSG
|
#if defined DISPLAY_MSG
|
||||||
public client_putinserver(id) {
|
public client_putinserver(id)
|
||||||
|
{
|
||||||
if (is_user_bot(id))
|
if (is_user_bot(id))
|
||||||
return
|
return
|
||||||
set_task(15.0,"dispInfo",id)
|
|
||||||
|
set_task(15.0, "dispInfo", id)
|
||||||
}
|
}
|
||||||
|
|
||||||
public client_disconnect(id) {
|
public client_disconnect(id)
|
||||||
|
{
|
||||||
remove_task(id)
|
remove_task(id)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public cmdHelp(id,level,cid) {
|
public cmdHelp(id, level, cid)
|
||||||
|
{
|
||||||
new arg1[8], flags = get_user_flags(id)
|
new arg1[8], flags = get_user_flags(id)
|
||||||
new start = read_argv(1,arg1,7) ? str_to_num(arg1) : 1
|
new start = read_argv(1, arg1, 7) ? str_to_num(arg1) : 1
|
||||||
|
|
||||||
new lHelpAmount = HELPAMOUNT
|
new lHelpAmount = HELPAMOUNT
|
||||||
|
|
||||||
if (id == 0 && read_argc() == 3)
|
if (id == 0 && read_argc() == 3)
|
||||||
lHelpAmount = read_argv(2, arg1, 7) ? str_to_num(arg1) : HELPAMOUNT
|
lHelpAmount = read_argv(2, arg1, 7) ? str_to_num(arg1) : HELPAMOUNT
|
||||||
|
|
||||||
if (--start < 0)
|
if (--start < 0)
|
||||||
start = 0
|
start = 0
|
||||||
|
|
||||||
new clcmdsnum = get_concmdsnum(flags,id)
|
new clcmdsnum = get_concmdsnum(flags, id)
|
||||||
|
|
||||||
if (start >= clcmdsnum)
|
if (start >= clcmdsnum)
|
||||||
start = clcmdsnum - 1
|
start = clcmdsnum - 1
|
||||||
|
|
||||||
console_print(id,"^n----- %L -----",id,"HELP_COMS")
|
console_print(id, "^n----- %L -----", id, "HELP_COMS")
|
||||||
|
|
||||||
new info[128], cmd[32], eflags
|
new info[128], cmd[32], eflags
|
||||||
new end = start + lHelpAmount // HELPAMOUNT
|
new end = start + lHelpAmount // HELPAMOUNT
|
||||||
|
|
||||||
if (end > clcmdsnum)
|
if (end > clcmdsnum)
|
||||||
end = clcmdsnum
|
end = clcmdsnum
|
||||||
|
|
||||||
for (new i = start; i < end; i++) {
|
for (new i = start; i < end; i++)
|
||||||
get_concmd(i,cmd,31,eflags,info,127,flags,id)
|
{
|
||||||
console_print(id,"%3d: %s %s",i+1,cmd,info)
|
get_concmd(i, cmd, 31, eflags, info, 127, flags, id)
|
||||||
|
console_print(id, "%3d: %s %s", i + 1, cmd, info)
|
||||||
}
|
}
|
||||||
console_print(id,"----- %L -----",id,"HELP_ENTRIES",start+1,end,clcmdsnum)
|
|
||||||
|
console_print(id, "----- %L -----", id, "HELP_ENTRIES", start + 1, end, clcmdsnum)
|
||||||
|
|
||||||
if (end < clcmdsnum)
|
if (end < clcmdsnum)
|
||||||
console_print(id,"----- %L -----",id,"HELP_USE_MORE",end+1)
|
console_print(id, "----- %L -----", id, "HELP_USE_MORE", end + 1)
|
||||||
else
|
else
|
||||||
console_print(id,"----- %L -----",id,"HELP_USE_BEGIN")
|
console_print(id, "----- %L -----", id, "HELP_USE_BEGIN")
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined DISPLAY_MSG
|
#if defined DISPLAY_MSG
|
||||||
public dispInfo(id) {
|
public dispInfo(id)
|
||||||
client_print(id,print_chat,"%L",id,"TYPE_HELP")
|
{
|
||||||
|
client_print(id, print_chat, "%L", id, "TYPE_HELP")
|
||||||
|
|
||||||
new nextmap[32]
|
new nextmap[32]
|
||||||
get_cvar_string("amx_nextmap",nextmap,31)
|
get_cvar_string("amx_nextmap", nextmap, 31)
|
||||||
if (get_cvar_float("mp_timelimit")) {
|
|
||||||
|
if (get_cvar_float("mp_timelimit"))
|
||||||
|
{
|
||||||
new timeleft = get_timeleft()
|
new timeleft = get_timeleft()
|
||||||
if (timeleft > 0) {
|
|
||||||
client_print(id,print_chat, "%L" , id, "TIME_INFO_1", timeleft / 60, timeleft % 60,nextmap)
|
if (timeleft > 0)
|
||||||
}
|
{
|
||||||
else {
|
client_print(id, print_chat, "%L", id, "TIME_INFO_1", timeleft / 60, timeleft % 60, nextmap)
|
||||||
client_print(id,print_chat,"%L",id,"TIME_INFO_2",nextmap)
|
} else {
|
||||||
|
client_print(id, print_chat, "%L", id, "TIME_INFO_2", nextmap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,16 +40,15 @@
|
|||||||
|
|
||||||
new g_cmdLoopback[16]
|
new g_cmdLoopback[16]
|
||||||
|
|
||||||
public plugin_init() {
|
public plugin_init()
|
||||||
register_plugin("Slots Reservation",AMXX_VERSION_STR,"AMXX Dev Team")
|
{
|
||||||
|
register_plugin("Slots Reservation", AMXX_VERSION_STR, "AMXX Dev Team")
|
||||||
register_dictionary("adminslots.txt")
|
register_dictionary("adminslots.txt")
|
||||||
register_dictionary("common.txt")
|
register_dictionary("common.txt")
|
||||||
register_cvar("amx_reservation","1")
|
register_cvar("amx_reservation", "1")
|
||||||
|
|
||||||
format( g_cmdLoopback, 15, "amxres%c%c%c%c" ,
|
format(g_cmdLoopback, 15, "amxres%c%c%c%c", random_num('A', 'Z'), random_num('A', 'Z'), random_num('A', 'Z'), random_num('A', 'Z'))
|
||||||
random_num('A','Z') , random_num('A','Z') ,random_num('A','Z'),random_num('A','Z') )
|
register_clcmd(g_cmdLoopback, "ackSignal")
|
||||||
|
|
||||||
register_clcmd( g_cmdLoopback, "ackSignal" )
|
|
||||||
|
|
||||||
#if defined HIDE_RESERVED_SLOTS
|
#if defined HIDE_RESERVED_SLOTS
|
||||||
new maxplayers = get_maxplayers()
|
new maxplayers = get_maxplayers()
|
||||||
@ -59,26 +58,28 @@ public plugin_init() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public ackSignal(id) {
|
public ackSignal(id)
|
||||||
|
{
|
||||||
new lReason[64]
|
new lReason[64]
|
||||||
format(lReason,63,"%L",id,"DROPPED_RES")
|
format(lReason, 63, "%L", id, "DROPPED_RES")
|
||||||
server_cmd("kick #%d ^"%s^"", get_user_userid(id), lReason )
|
server_cmd("kick #%d ^"%s^"", get_user_userid(id), lReason)
|
||||||
}
|
}
|
||||||
|
|
||||||
public client_authorized(id) {
|
public client_authorized(id)
|
||||||
|
{
|
||||||
new maxplayers = get_maxplayers()
|
new maxplayers = get_maxplayers()
|
||||||
new players = get_playersnum( 1 )
|
new players = get_playersnum(1)
|
||||||
new limit = maxplayers - get_cvar_num("amx_reservation")
|
new limit = maxplayers - get_cvar_num("amx_reservation")
|
||||||
|
|
||||||
if ( access(id,ADMIN_RESERVATION) || (players <= limit) )
|
if (access(id, ADMIN_RESERVATION) || (players <= limit))
|
||||||
{
|
{
|
||||||
#if defined HIDE_RESERVED_SLOTS
|
#if defined HIDE_RESERVED_SLOTS
|
||||||
setVisibleSlots( players , maxplayers, limit )
|
setVisibleSlots(players, maxplayers, limit)
|
||||||
#endif
|
#endif
|
||||||
return PLUGIN_CONTINUE
|
return PLUGIN_CONTINUE
|
||||||
}
|
}
|
||||||
|
|
||||||
client_cmd(id,g_cmdLoopback)
|
client_cmd(id, g_cmdLoopback)
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
@ -87,20 +88,20 @@ public client_authorized(id) {
|
|||||||
public client_disconnect(id)
|
public client_disconnect(id)
|
||||||
{
|
{
|
||||||
new maxplayers = get_maxplayers()
|
new maxplayers = get_maxplayers()
|
||||||
setVisibleSlots( get_playersnum(1) - 1 , maxplayers ,
|
|
||||||
maxplayers - get_cvar_num("amx_reservation") )
|
setVisibleSlots(get_playersnum(1) - 1, maxplayers, maxplayers - get_cvar_num("amx_reservation"))
|
||||||
return PLUGIN_CONTINUE
|
return PLUGIN_CONTINUE
|
||||||
}
|
}
|
||||||
|
|
||||||
setVisibleSlots( players , maxplayers , limit )
|
setVisibleSlots(players, maxplayers, limit)
|
||||||
{
|
{
|
||||||
new num = players + 1
|
new num = players + 1
|
||||||
|
|
||||||
if ( players == maxplayers )
|
if (players == maxplayers)
|
||||||
num = maxplayers
|
num = maxplayers
|
||||||
else if ( players < limit )
|
else if (players < limit)
|
||||||
num = limit
|
num = limit
|
||||||
|
|
||||||
set_cvar_num( "sv_visiblemaxplayers" , num )
|
set_cvar_num("sv_visiblemaxplayers", num)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -48,49 +48,60 @@ new g_execLen
|
|||||||
new bool:g_execResult
|
new bool:g_execResult
|
||||||
new Float:g_voteRatio
|
new Float:g_voteRatio
|
||||||
|
|
||||||
public plugin_init() {
|
public plugin_init()
|
||||||
register_plugin("Admin Votes",AMXX_VERSION_STR,"AMXX Dev Team")
|
{
|
||||||
|
register_plugin("Admin Votes", AMXX_VERSION_STR, "AMXX Dev Team")
|
||||||
register_dictionary("adminvote.txt")
|
register_dictionary("adminvote.txt")
|
||||||
register_dictionary("common.txt")
|
register_dictionary("common.txt")
|
||||||
register_dictionary("mapsmenu.txt")
|
register_dictionary("mapsmenu.txt")
|
||||||
register_menucmd(register_menuid("Change map to "),MENU_KEY_1|MENU_KEY_2,"voteCount")
|
register_menucmd(register_menuid("Change map to "), MENU_KEY_1|MENU_KEY_2, "voteCount")
|
||||||
register_menucmd(register_menuid("Choose map: "),MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4,"voteCount")
|
register_menucmd(register_menuid("Choose map: "), MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4, "voteCount")
|
||||||
register_menucmd(register_menuid("Kick "),MENU_KEY_1|MENU_KEY_2,"voteCount")
|
register_menucmd(register_menuid("Kick "), MENU_KEY_1|MENU_KEY_2, "voteCount")
|
||||||
register_menucmd(register_menuid("Ban "),MENU_KEY_1|MENU_KEY_2,"voteCount")
|
register_menucmd(register_menuid("Ban "), MENU_KEY_1|MENU_KEY_2, "voteCount")
|
||||||
register_menucmd(register_menuid("Vote: "),MENU_KEY_1|MENU_KEY_2,"voteCount")
|
register_menucmd(register_menuid("Vote: "), MENU_KEY_1|MENU_KEY_2, "voteCount")
|
||||||
register_menucmd(register_menuid("The result: "),MENU_KEY_1|MENU_KEY_2,"actionResult")
|
register_menucmd(register_menuid("The result: "), MENU_KEY_1|MENU_KEY_2, "actionResult")
|
||||||
register_concmd("amx_votemap","cmdVoteMap",ADMIN_VOTE,"<map> [map] [map] [map]")
|
register_concmd("amx_votemap", "cmdVoteMap", ADMIN_VOTE, "<map> [map] [map] [map]")
|
||||||
register_concmd("amx_votekick","cmdVoteKickBan",ADMIN_VOTE,"<name or #userid>")
|
register_concmd("amx_votekick", "cmdVoteKickBan", ADMIN_VOTE, "<name or #userid>")
|
||||||
register_concmd("amx_voteban","cmdVoteKickBan",ADMIN_VOTE,"<name or #userid>")
|
register_concmd("amx_voteban", "cmdVoteKickBan", ADMIN_VOTE, "<name or #userid>")
|
||||||
register_concmd("amx_vote","cmdVote",ADMIN_VOTE,"<question> <answer#1> <answer#2>")
|
register_concmd("amx_vote", "cmdVote", ADMIN_VOTE, "<question> <answer#1> <answer#2>")
|
||||||
register_concmd("amx_cancelvote","cmdCancelVote",ADMIN_VOTE,"- cancels last vote")
|
register_concmd("amx_cancelvote", "cmdCancelVote", ADMIN_VOTE, "- cancels last vote")
|
||||||
|
|
||||||
g_coloredMenus = colored_menus()
|
g_coloredMenus = colored_menus()
|
||||||
}
|
}
|
||||||
|
|
||||||
public cmdCancelVote(id,level,cid) {
|
public cmdCancelVote(id, level, cid)
|
||||||
if (!cmd_access(id,level,cid,0))
|
{
|
||||||
|
if (!cmd_access(id, level, cid, 0))
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
if ( task_exists( 99889988 , 1 ) ) {
|
|
||||||
new authid[32],name[32]
|
if (task_exists(99889988, 1))
|
||||||
get_user_authid(id,authid,31)
|
{
|
||||||
get_user_name(id,name,31)
|
new authid[32], name[32]
|
||||||
log_amx("Vote: ^"%s<%d><%s><>^" cancel vote session", name,get_user_userid(id),authid)
|
|
||||||
new players[32],pnum,lTag[16],activity = get_cvar_num("amx_show_activity")
|
get_user_authid(id, authid, 31)
|
||||||
get_players(players,pnum,"c")
|
get_user_name(id, name, 31)
|
||||||
for (new i=0;i<pnum;i++) {
|
log_amx("Vote: ^"%s<%d><%s><>^" cancel vote session", name, get_user_userid(id), authid)
|
||||||
format(lTag,15,"%L",players[i],is_user_admin(id) ? "ADMIN" : "PLAYER")
|
|
||||||
switch (activity) {
|
new players[32], pnum, lTag[16], activity = get_cvar_num("amx_show_activity")
|
||||||
case 2: client_print(players[i],print_chat,"%L", LANG_PLAYER, "ADMIN_CANC_VOTE_2", lTag, name)
|
get_players(players, pnum, "c")
|
||||||
case 1: client_print(players[i],print_chat,"%L", LANG_PLAYER, "ADMIN_CANC_VOTE_1", lTag)
|
|
||||||
|
for (new i = 0; i < pnum;i ++)
|
||||||
|
{
|
||||||
|
format(lTag, 15, "%L", players[i], is_user_admin(id) ? "ADMIN" : "PLAYER")
|
||||||
|
switch (activity)
|
||||||
|
{
|
||||||
|
case 2: client_print(players[i], print_chat, "%L", LANG_PLAYER, "ADMIN_CANC_VOTE_2", lTag, name)
|
||||||
|
case 1: client_print(players[i], print_chat, "%L", LANG_PLAYER, "ADMIN_CANC_VOTE_1", lTag)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console_print(id, "%L", id, "VOTING_CANC" )
|
|
||||||
|
console_print(id, "%L", id, "VOTING_CANC")
|
||||||
client_print(0,print_chat,"%L",LANG_PLAYER,"VOTING_CANC")
|
client_print(0,print_chat,"%L",LANG_PLAYER,"VOTING_CANC")
|
||||||
remove_task( 99889988 , 1 )
|
remove_task(99889988, 1)
|
||||||
set_cvar_float( "amx_last_voting" , get_gametime() )
|
set_cvar_float("amx_last_voting", get_gametime())
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
console_print(id, "%L", id, "NO_VOTE_CANC" )
|
console_print(id, "%L", id, "NO_VOTE_CANC")
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
@ -98,316 +109,413 @@ public cmdCancelVote(id,level,cid) {
|
|||||||
public delayedExec(cmd[])
|
public delayedExec(cmd[])
|
||||||
server_cmd(cmd)
|
server_cmd(cmd)
|
||||||
|
|
||||||
public autoRefuse() {
|
public autoRefuse()
|
||||||
log_amx("Vote: %L","en","RES_REF")
|
{
|
||||||
client_print(0,print_chat,"%L",LANG_PLAYER,"RES_REF")
|
log_amx("Vote: %L", "en", "RES_REF")
|
||||||
|
client_print(0, print_chat, "%L", LANG_PLAYER, "RES_REF")
|
||||||
}
|
}
|
||||||
|
|
||||||
public actionResult(id,key) {
|
public actionResult(id, key)
|
||||||
remove_task( 4545454 )
|
{
|
||||||
switch (key) {
|
remove_task(4545454)
|
||||||
case 0: {
|
|
||||||
set_task(2.0,"delayedExec",0,g_Execute,g_execLen)
|
switch (key)
|
||||||
log_amx("Vote: %L","en","RES_ACCEPTED")
|
{
|
||||||
client_print(0,print_chat,"%L",LANG_PLAYER,"RES_ACCEPTED")
|
case 0:
|
||||||
|
{
|
||||||
|
set_task(2.0, "delayedExec", 0, g_Execute, g_execLen)
|
||||||
|
log_amx("Vote: %L", "en", "RES_ACCEPTED")
|
||||||
|
client_print(0, print_chat, "%L", LANG_PLAYER, "RES_ACCEPTED")
|
||||||
}
|
}
|
||||||
case 1: autoRefuse()
|
case 1: autoRefuse()
|
||||||
}
|
}
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
public checkVotes() {
|
public checkVotes()
|
||||||
|
{
|
||||||
new best = 0
|
new best = 0
|
||||||
if ( !g_yesNoVote ) {
|
|
||||||
|
if (!g_yesNoVote)
|
||||||
|
{
|
||||||
for (new a = 0; a < 4; ++a)
|
for (new a = 0; a < 4; ++a)
|
||||||
if (g_voteCount[a] > g_voteCount[best])
|
if (g_voteCount[a] > g_voteCount[best])
|
||||||
|
|
||||||
best = a
|
best = a
|
||||||
}
|
}
|
||||||
|
|
||||||
new votesNum = g_voteCount[0] + g_voteCount[1] + g_voteCount[2] + g_voteCount[3]
|
new votesNum = g_voteCount[0] + g_voteCount[1] + g_voteCount[2] + g_voteCount[3]
|
||||||
new iRatio = votesNum ? floatround( g_voteRatio * float( votesNum ) ,floatround_ceil) : 1
|
new iRatio = votesNum ? floatround(g_voteRatio * float(votesNum), floatround_ceil) : 1
|
||||||
new iResult = g_voteCount[best]
|
new iResult = g_voteCount[best]
|
||||||
new players[32],pnum,i
|
new players[32], pnum, i
|
||||||
get_players(players,pnum,"c")
|
|
||||||
if ( iResult < iRatio ) {
|
get_players(players, pnum, "c")
|
||||||
|
|
||||||
|
if (iResult < iRatio)
|
||||||
|
{
|
||||||
new lVotingFailed[64]
|
new lVotingFailed[64]
|
||||||
for (i=0;i<pnum;i++) {
|
|
||||||
format(lVotingFailed,63,"%L",players[i],"VOTING_FAILED")
|
for (i = 0; i < pnum; i++)
|
||||||
|
{
|
||||||
|
format(lVotingFailed, 63, "%L", players[i], "VOTING_FAILED")
|
||||||
if (g_yesNoVote)
|
if (g_yesNoVote)
|
||||||
client_print(players[i],print_chat,"%L",players[i],"VOTING_RES_1",
|
client_print(players[i], print_chat, "%L", players[i], "VOTING_RES_1", lVotingFailed, g_voteCount[0], g_voteCount[1], iRatio)
|
||||||
lVotingFailed,g_voteCount[0],g_voteCount[1],iRatio)
|
|
||||||
else
|
else
|
||||||
client_print(players[i],print_chat,"%L",players[i],"VOTING_RES_2",lVotingFailed,iResult,iRatio )
|
client_print(players[i], print_chat, "%L", players[i], "VOTING_RES_2", lVotingFailed, iResult, iRatio)
|
||||||
}
|
}
|
||||||
format(lVotingFailed,63,"%L","en","VOTING_FAILED")
|
|
||||||
log_amx("Vote: %s (got ^"%d^") (needed ^"%d^")",lVotingFailed,iResult,iRatio)
|
format(lVotingFailed, 63, "%L", "en", "VOTING_FAILED")
|
||||||
|
log_amx("Vote: %s (got ^"%d^") (needed ^"%d^")", lVotingFailed, iResult, iRatio)
|
||||||
|
|
||||||
return PLUGIN_CONTINUE
|
return PLUGIN_CONTINUE
|
||||||
}
|
}
|
||||||
g_execLen = format(g_Execute,255,g_Answer,g_optionName[best]) + 1
|
|
||||||
if (g_execResult) {
|
g_execLen = format(g_Execute, 255, g_Answer, g_optionName[best]) + 1
|
||||||
|
|
||||||
|
if (g_execResult)
|
||||||
|
{
|
||||||
g_execResult = false
|
g_execResult = false
|
||||||
if ( is_user_connected(g_voteCaller) ) {
|
|
||||||
new menuBody[512],lTheResult[32],lYes[16],lNo[16]
|
if (is_user_connected(g_voteCaller))
|
||||||
format(lTheResult,31,"%L",g_voteCaller,"THE_RESULT")
|
{
|
||||||
format(lYes,15,"%L",g_voteCaller,"YES")
|
new menuBody[512], lTheResult[32], lYes[16], lNo[16]
|
||||||
format(lNo,15,"%L",g_voteCaller,"NO")
|
|
||||||
new len = format(menuBody,511,g_coloredMenus ? "\y%s: \w%s^n^n" : "%s: %s^n^n", lTheResult, g_Execute )
|
format(lTheResult, 31, "%L", g_voteCaller, "THE_RESULT")
|
||||||
len += format( menuBody[len] ,511 - len, g_coloredMenus ? "\y%L^n\w" : "%L^n", g_voteCaller, "WANT_CONTINUE" )
|
format(lYes, 15, "%L", g_voteCaller, "YES")
|
||||||
format( menuBody[len] ,511 - len, "^n1. %s^n2. %s",lYes,lNo)
|
format(lNo, 15, "%L", g_voteCaller, "NO")
|
||||||
show_menu( g_voteCaller ,0x03 ,menuBody, 10, "The result: " )
|
|
||||||
set_task(10.0,"autoRefuse",4545454)
|
new len = format(menuBody, 511, g_coloredMenus ? "\y%s: \w%s^n^n" : "%s: %s^n^n", lTheResult, g_Execute)
|
||||||
|
|
||||||
|
len += format(menuBody[len], 511 - len, g_coloredMenus ? "\y%L^n\w" : "%L^n", g_voteCaller, "WANT_CONTINUE")
|
||||||
|
format(menuBody[len], 511 - len, "^n1. %s^n2. %s", lYes, lNo)
|
||||||
|
show_menu(g_voteCaller, 0x03, menuBody, 10, "The result: ")
|
||||||
|
set_task(10.0, "autoRefuse", 4545454)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
set_task(2.0,"delayedExec",0,g_Execute,g_execLen)
|
set_task(2.0, "delayedExec", 0, g_Execute, g_execLen)
|
||||||
}
|
}
|
||||||
|
|
||||||
new lVotingSuccess[32]
|
new lVotingSuccess[32]
|
||||||
for (i=0;i<pnum;i++) {
|
|
||||||
format(lVotingSuccess,31,"%L",players[i],"VOTING_SUCCESS")
|
for (i = 0; i < pnum; i++)
|
||||||
client_print(players[i],print_chat,"%L",players[i],"VOTING_RES_3",lVotingSuccess,iResult,iRatio,g_Execute)
|
{
|
||||||
|
format(lVotingSuccess, 31, "%L", players[i], "VOTING_SUCCESS")
|
||||||
|
client_print(players[i], print_chat, "%L", players[i], "VOTING_RES_3", lVotingSuccess, iResult, iRatio, g_Execute)
|
||||||
}
|
}
|
||||||
format(lVotingSuccess,31,"%L","en","VOTING_SUCCESS")
|
|
||||||
log_amx("Vote: %s (got ^"%d^") (needed ^"%d^") (result ^"%s^")", lVotingSuccess, iResult , iRatio , g_Execute )
|
format(lVotingSuccess, 31, "%L", "en", "VOTING_SUCCESS")
|
||||||
|
log_amx("Vote: %s (got ^"%d^") (needed ^"%d^") (result ^"%s^")", lVotingSuccess, iResult, iRatio, g_Execute)
|
||||||
|
|
||||||
return PLUGIN_CONTINUE
|
return PLUGIN_CONTINUE
|
||||||
}
|
}
|
||||||
|
|
||||||
public voteCount(id,key) {
|
public voteCount(id, key)
|
||||||
if ( get_cvar_num("amx_vote_answers") ) {
|
{
|
||||||
|
if (get_cvar_num("amx_vote_answers"))
|
||||||
|
{
|
||||||
new name[32]
|
new name[32]
|
||||||
get_user_name(id,name,31)
|
get_user_name(id, name, 31)
|
||||||
|
|
||||||
if (g_yesNoVote)
|
if (g_yesNoVote)
|
||||||
client_print(0,print_chat,"%L",LANG_PLAYER,key ? "VOTED_AGAINST" : "VOTED_FOR",name)
|
client_print(0, print_chat, "%L", LANG_PLAYER, key ? "VOTED_AGAINST" : "VOTED_FOR", name)
|
||||||
else
|
else
|
||||||
client_print(0,print_chat,"%L",LANG_PLAYER,"VOTED_FOR_OPT",name,key+1)
|
client_print(0, print_chat, "%L", LANG_PLAYER, "VOTED_FOR_OPT", name, key + 1)
|
||||||
}
|
}
|
||||||
++g_voteCount[key]
|
++g_voteCount[key]
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
public cmdVoteMap(id,level,cid) {
|
public cmdVoteMap(id, level, cid)
|
||||||
if (!cmd_access(id,level,cid,2))
|
{
|
||||||
|
if (!cmd_access(id, level, cid, 2))
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
|
|
||||||
new Float:voting = get_cvar_float("amx_last_voting")
|
new Float:voting = get_cvar_float("amx_last_voting")
|
||||||
if (voting > get_gametime()) {
|
if (voting > get_gametime())
|
||||||
|
{
|
||||||
console_print(id, "%L", id, "ALREADY_VOTING")
|
console_print(id, "%L", id, "ALREADY_VOTING")
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime()) {
|
|
||||||
|
if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime())
|
||||||
|
{
|
||||||
console_print(id, "%L", id, "VOTING_NOT_ALLOW")
|
console_print(id, "%L", id, "VOTING_NOT_ALLOW")
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
new argc = read_argc()
|
new argc = read_argc()
|
||||||
if (argc > 5) argc = 5
|
if (argc > 5) argc = 5
|
||||||
|
|
||||||
g_validMaps = 0
|
g_validMaps = 0
|
||||||
g_optionName[0][0] = 0
|
g_optionName[0][0] = 0
|
||||||
g_optionName[1][0] = 0
|
g_optionName[1][0] = 0
|
||||||
g_optionName[2][0] = 0
|
g_optionName[2][0] = 0
|
||||||
g_optionName[3][0] = 0
|
g_optionName[3][0] = 0
|
||||||
for (new i = 1; i < argc; ++i) {
|
|
||||||
read_argv(i,g_optionName[g_validMaps],31)
|
for (new i = 1; i < argc; ++i)
|
||||||
|
{
|
||||||
|
read_argv(i, g_optionName[g_validMaps], 31)
|
||||||
|
|
||||||
if (is_map_valid(g_optionName[g_validMaps]))
|
if (is_map_valid(g_optionName[g_validMaps]))
|
||||||
g_validMaps++
|
g_validMaps++
|
||||||
}
|
}
|
||||||
if (g_validMaps == 0) {
|
|
||||||
|
if (g_validMaps == 0)
|
||||||
|
{
|
||||||
new lMaps[16]
|
new lMaps[16]
|
||||||
format(lMaps,15,"%L",id,(argc==2)?"MAP_IS":"MAPS_ARE")
|
|
||||||
console_print(id,"%L",id,"GIVEN_NOT_VALID",lMaps)
|
format(lMaps, 15, "%L", id, (argc == 2) ? "MAP_IS" : "MAPS_ARE")
|
||||||
|
console_print(id, "%L", id, "GIVEN_NOT_VALID", lMaps)
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
new menu_msg[256], len = 0
|
new menu_msg[256], len = 0
|
||||||
new keys = 0
|
new keys = 0
|
||||||
if (g_validMaps > 1) {
|
|
||||||
|
if (g_validMaps > 1)
|
||||||
|
{
|
||||||
keys = MENU_KEY_0
|
keys = MENU_KEY_0
|
||||||
len = format(menu_msg,255,g_coloredMenus ? "\y%L: \w^n^n" : "%L: ^n^n",LANG_SERVER,"CHOOSE_MAP")
|
len = format(menu_msg, 255, g_coloredMenus ? "\y%L: \w^n^n" : "%L: ^n^n", LANG_SERVER, "CHOOSE_MAP")
|
||||||
new temp[128]
|
new temp[128]
|
||||||
for (new a = 0; a < g_validMaps; ++a) {
|
|
||||||
format(temp,127,"%d. %s^n",a+1,g_optionName[a])
|
for (new a = 0; a < g_validMaps; ++a)
|
||||||
len += copy(menu_msg[len],255-len,temp)
|
{
|
||||||
|
format(temp, 127, "%d. %s^n", a+1, g_optionName[a])
|
||||||
|
len += copy(menu_msg[len], 255-len, temp)
|
||||||
keys |= (1<<a)
|
keys |= (1<<a)
|
||||||
}
|
}
|
||||||
format(menu_msg[len],255-len,"^n0. %L",LANG_SERVER,"NONE")
|
|
||||||
|
format(menu_msg[len], 255-len, "^n0. %L", LANG_SERVER, "NONE")
|
||||||
g_yesNoVote = 0
|
g_yesNoVote = 0
|
||||||
}
|
} else {
|
||||||
else {
|
new lChangeMap[32], lYes[16], lNo[16]
|
||||||
new lChangeMap[32],lYes[16],lNo[16]
|
|
||||||
format(lChangeMap,31,"%L",LANG_SERVER,"CHANGE_MAP_TO")
|
format(lChangeMap, 31, "%L", LANG_SERVER, "CHANGE_MAP_TO")
|
||||||
format(lYes,15,"%L",LANG_SERVER,"YES")
|
format(lYes, 15, "%L", LANG_SERVER, "YES")
|
||||||
format(lNo,15,"%L",LANG_SERVER,"NO")
|
format(lNo, 15, "%L", LANG_SERVER, "NO")
|
||||||
format(menu_msg,255,g_coloredMenus ? "\y%s %s?\w^n^n1. %s^n2. %s"
|
format(menu_msg, 255, g_coloredMenus ? "\y%s %s?\w^n^n1. %s^n2. %s" : "%s %s?^n^n1. %s^n2. %s", lChangeMap, g_optionName[0], lYes, lNo)
|
||||||
: "%s %s?^n^n1. %s^n2. %s",lChangeMap,g_optionName[0],lYes,lNo)
|
|
||||||
keys = MENU_KEY_1|MENU_KEY_2
|
keys = MENU_KEY_1|MENU_KEY_2
|
||||||
g_yesNoVote = 1
|
g_yesNoVote = 1
|
||||||
}
|
}
|
||||||
new authid[32],name[32]
|
|
||||||
get_user_authid(id,authid,31)
|
|
||||||
get_user_name(id,name,31)
|
|
||||||
if (argc==2)
|
|
||||||
log_amx("Vote: ^"%s<%d><%s><>^" vote map (map ^"%s^")",
|
|
||||||
name,get_user_userid(id),authid,g_optionName[0])
|
|
||||||
else
|
|
||||||
log_amx("Vote: ^"%s<%d><%s><>^" vote maps (map#1 ^"%s^") (map#2 ^"%s^") (map#3 ^"%s^") (map#4 ^"%s^")",
|
|
||||||
name,get_user_userid(id),authid,g_optionName[0],g_optionName[1],g_optionName[2],g_optionName[3])
|
|
||||||
|
|
||||||
new lTag[16],activity = get_cvar_num("amx_show_activity")
|
new authid[32], name[32]
|
||||||
if (activity>0) {
|
|
||||||
new players[32],pnum
|
get_user_authid(id, authid, 31)
|
||||||
get_players(players,pnum,"c")
|
get_user_name(id, name, 31)
|
||||||
for (new i=0;i<pnum;i++) {
|
|
||||||
format(lTag,15,"%L",players[i],is_user_admin(id)?"ADMIN":"PLAYER")
|
if (argc == 2)
|
||||||
switch (activity) {
|
log_amx("Vote: ^"%s<%d><%s><>^" vote map (map ^"%s^")", name, get_user_userid(id), authid, g_optionName[0])
|
||||||
case 2: client_print(players[i],print_chat,"%L",
|
else
|
||||||
players[i],"ADMIN_VOTE_MAP_2",lTag,name)
|
log_amx("Vote: ^"%s<%d><%s><>^" vote maps (map#1 ^"%s^") (map#2 ^"%s^") (map#3 ^"%s^") (map#4 ^"%s^")", name, get_user_userid(id), authid, g_optionName[0], g_optionName[1], g_optionName[2], g_optionName[3])
|
||||||
case 1: client_print(players[i],print_chat,"%L",
|
|
||||||
players[i],"ADMIN_VOTE_MAP_1",lTag)
|
new lTag[16], activity = get_cvar_num("amx_show_activity")
|
||||||
|
|
||||||
|
if (activity > 0)
|
||||||
|
{
|
||||||
|
new players[32], pnum
|
||||||
|
|
||||||
|
get_players(players, pnum, "c")
|
||||||
|
for (new i = 0; i < pnum; i++)
|
||||||
|
{
|
||||||
|
format(lTag, 15, "%L", players[i], is_user_admin(id) ? "ADMIN" : "PLAYER")
|
||||||
|
|
||||||
|
switch (activity)
|
||||||
|
{
|
||||||
|
case 2: client_print(players[i], print_chat, "%L", players[i], "ADMIN_VOTE_MAP_2", lTag, name)
|
||||||
|
case 1: client_print(players[i], print_chat, "%L", players[i], "ADMIN_VOTE_MAP_1", lTag)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_execResult = true
|
g_execResult = true
|
||||||
new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0
|
new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0
|
||||||
set_cvar_float("amx_last_voting", get_gametime() + vote_time )
|
|
||||||
|
set_cvar_float("amx_last_voting", get_gametime() + vote_time)
|
||||||
g_voteRatio = get_cvar_float("amx_votemap_ratio")
|
g_voteRatio = get_cvar_float("amx_votemap_ratio")
|
||||||
g_Answer = "changelevel %s"
|
g_Answer = "changelevel %s"
|
||||||
show_menu(0,keys,menu_msg,floatround(vote_time),(g_validMaps > 1)?"Choose map: ":"Change map to ")
|
show_menu(0, keys, menu_msg, floatround(vote_time), (g_validMaps > 1) ? "Choose map: " : "Change map to ")
|
||||||
set_task(vote_time,"checkVotes" , 99889988 )
|
set_task(vote_time, "checkVotes", 99889988)
|
||||||
g_voteCaller = id
|
g_voteCaller = id
|
||||||
console_print(id, "%L", id, "VOTING_STARTED")
|
console_print(id, "%L", id, "VOTING_STARTED")
|
||||||
g_voteCount = { 0,0, 0,0 }
|
g_voteCount = {0, 0, 0, 0}
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
public cmdVote(id,level,cid) {
|
public cmdVote(id, level, cid)
|
||||||
if (!cmd_access(id,level,cid,4))
|
{
|
||||||
|
if (!cmd_access(id, level, cid, 4))
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
|
|
||||||
new Float:voting = get_cvar_float("amx_last_voting")
|
new Float:voting = get_cvar_float("amx_last_voting")
|
||||||
if (voting > get_gametime()) {
|
if (voting > get_gametime())
|
||||||
console_print(id, "%L", id, "ALREADY_VOTING")
|
|
||||||
return PLUGIN_HANDLED
|
|
||||||
}
|
|
||||||
if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime()) {
|
|
||||||
console_print(id, "%L", id, "VOTING_NOT_ALLOW")
|
|
||||||
return PLUGIN_HANDLED
|
|
||||||
}
|
|
||||||
new quest[48]
|
|
||||||
read_argv(1,quest,47)
|
|
||||||
if ((contain(quest,"sv_password")!=-1)||(contain(quest,"rcon_password")!=-1)||
|
|
||||||
(contain(quest,"kick")!=-1)||(contain(quest,"addip")!=-1)||(contain(quest,"ban")!=-1))
|
|
||||||
{
|
{
|
||||||
console_print(id,"%L",id,"VOTING_FORBIDDEN")
|
|
||||||
return PLUGIN_HANDLED
|
|
||||||
}
|
|
||||||
read_argv(2,g_optionName[0],31)
|
|
||||||
read_argv(3,g_optionName[1],31)
|
|
||||||
|
|
||||||
new authid[32],name[32]
|
|
||||||
get_user_authid(id,authid,31)
|
|
||||||
get_user_name(id,name,31)
|
|
||||||
log_amx("Vote: ^"%s<%d><%s><>^" vote custom (question ^"%s^") (option#1 ^"%s^") (option#2 ^"%s^")",
|
|
||||||
name,get_user_userid(id),authid,quest,g_optionName[0],g_optionName[1])
|
|
||||||
|
|
||||||
new activity = get_cvar_num("amx_show_activity")
|
|
||||||
if (activity>0) {
|
|
||||||
new players[32],pnum,lTag[16]
|
|
||||||
get_players(players,pnum,"c")
|
|
||||||
for (new i=0;i<pnum;i++) {
|
|
||||||
format(lTag,15,"%L",players[i],is_user_admin(id)?"ADMIN":"PLAYER")
|
|
||||||
switch (activity) {
|
|
||||||
case 2: client_print(players[i],print_chat,"%L",players[i],"ADMIN_VOTE_CUS_2",lTag,name)
|
|
||||||
case 1: client_print(players[i],print_chat,"%L",players[i],"ADMIN_VOTE_CUS_1",lTag)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
new menu_msg[256],lVote[16]
|
|
||||||
format(lVote,15,"%L",LANG_SERVER,"VOTE")
|
|
||||||
new keys = MENU_KEY_1|MENU_KEY_2
|
|
||||||
format(menu_msg,255, g_coloredMenus ? "\y%s: %s\w^n^n1. %s^n2. %s"
|
|
||||||
: "%s: %s^n^n1. %s^n2. %s",lVote,quest,g_optionName[0],g_optionName[1])
|
|
||||||
g_execResult = false
|
|
||||||
new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0
|
|
||||||
set_cvar_float("amx_last_voting", get_gametime() + vote_time )
|
|
||||||
g_voteRatio = get_cvar_float("amx_vote_ratio")
|
|
||||||
format(g_Answer,127,"%s - %%s",quest)
|
|
||||||
show_menu(0,keys,menu_msg,floatround(vote_time),"Vote: ")
|
|
||||||
set_task(vote_time,"checkVotes" , 99889988 )
|
|
||||||
g_voteCaller = id
|
|
||||||
console_print(id, "%L", id, "VOTING_STARTED")
|
|
||||||
g_voteCount = {0,0,0,0}
|
|
||||||
g_yesNoVote = 0
|
|
||||||
return PLUGIN_HANDLED
|
|
||||||
}
|
|
||||||
|
|
||||||
public cmdVoteKickBan(id,level,cid) {
|
|
||||||
if (!cmd_access(id,level,cid,2))
|
|
||||||
return PLUGIN_HANDLED
|
|
||||||
new Float:voting = get_cvar_float("amx_last_voting")
|
|
||||||
if (voting > get_gametime()) {
|
|
||||||
console_print(id, "%L", id, "ALREADY_VOTING")
|
console_print(id, "%L", id, "ALREADY_VOTING")
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime()) {
|
|
||||||
|
if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime())
|
||||||
|
{
|
||||||
console_print(id, "%L", id, "VOTING_NOT_ALLOW")
|
console_print(id, "%L", id, "VOTING_NOT_ALLOW")
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
new quest[48]
|
||||||
|
read_argv(1, quest, 47)
|
||||||
|
|
||||||
|
if ((contain(quest, "sv_password") != -1) || (contain(quest, "rcon_password") != -1) || (contain(quest, "kick") != -1) ||
|
||||||
|
(contain(quest, "addip") != -1) || (contain(quest, "ban") != -1))
|
||||||
|
{
|
||||||
|
console_print(id, "%L", id, "VOTING_FORBIDDEN")
|
||||||
|
return PLUGIN_HANDLED
|
||||||
|
}
|
||||||
|
|
||||||
|
read_argv(2, g_optionName[0], 31)
|
||||||
|
read_argv(3, g_optionName[1], 31)
|
||||||
|
|
||||||
|
new authid[32], name[32]
|
||||||
|
|
||||||
|
get_user_authid(id, authid, 31)
|
||||||
|
get_user_name(id, name, 31)
|
||||||
|
log_amx("Vote: ^"%s<%d><%s><>^" vote custom (question ^"%s^") (option#1 ^"%s^") (option#2 ^"%s^")", name, get_user_userid(id), authid, quest, g_optionName[0], g_optionName[1])
|
||||||
|
|
||||||
|
new activity = get_cvar_num("amx_show_activity")
|
||||||
|
|
||||||
|
if (activity > 0)
|
||||||
|
{
|
||||||
|
new players[32], pnum, lTag[16]
|
||||||
|
|
||||||
|
get_players(players, pnum, "c")
|
||||||
|
for (new i = 0; i < pnum; i++)
|
||||||
|
{
|
||||||
|
format(lTag, 15, "%L", players[i], is_user_admin(id) ? "ADMIN" : "PLAYER")
|
||||||
|
|
||||||
|
switch (activity)
|
||||||
|
{
|
||||||
|
case 2: client_print(players[i], print_chat, "%L", players[i], "ADMIN_VOTE_CUS_2", lTag, name)
|
||||||
|
case 1: client_print(players[i], print_chat, "%L", players[i], "ADMIN_VOTE_CUS_1", lTag)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
new menu_msg[256], lVote[16]
|
||||||
|
|
||||||
|
format(lVote, 15, "%L", LANG_SERVER, "VOTE")
|
||||||
|
new keys = MENU_KEY_1|MENU_KEY_2
|
||||||
|
|
||||||
|
format(menu_msg, 255, g_coloredMenus ? "\y%s: %s\w^n^n1. %s^n2. %s" : "%s: %s^n^n1. %s^n2. %s", lVote, quest, g_optionName[0], g_optionName[1])
|
||||||
|
g_execResult = false
|
||||||
|
|
||||||
|
new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0
|
||||||
|
|
||||||
|
set_cvar_float("amx_last_voting", get_gametime() + vote_time)
|
||||||
|
g_voteRatio = get_cvar_float("amx_vote_ratio")
|
||||||
|
format(g_Answer, 127, "%s - %%s", quest)
|
||||||
|
show_menu(0, keys, menu_msg, floatround(vote_time), "Vote: ")
|
||||||
|
set_task(vote_time, "checkVotes", 99889988)
|
||||||
|
g_voteCaller = id
|
||||||
|
console_print(id, "%L", id, "VOTING_STARTED")
|
||||||
|
g_voteCount = {0, 0, 0, 0}
|
||||||
|
g_yesNoVote = 0
|
||||||
|
|
||||||
|
return PLUGIN_HANDLED
|
||||||
|
}
|
||||||
|
|
||||||
|
public cmdVoteKickBan(id, level, cid)
|
||||||
|
{
|
||||||
|
if (!cmd_access(id, level, cid, 2))
|
||||||
|
return PLUGIN_HANDLED
|
||||||
|
|
||||||
|
new Float:voting = get_cvar_float("amx_last_voting")
|
||||||
|
if (voting > get_gametime())
|
||||||
|
{
|
||||||
|
console_print(id, "%L", id, "ALREADY_VOTING")
|
||||||
|
return PLUGIN_HANDLED
|
||||||
|
}
|
||||||
|
|
||||||
|
if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime())
|
||||||
|
{
|
||||||
|
console_print(id, "%L", id, "VOTING_NOT_ALLOW")
|
||||||
|
return PLUGIN_HANDLED
|
||||||
|
}
|
||||||
|
|
||||||
new cmd[32]
|
new cmd[32]
|
||||||
read_argv(0,cmd,31)
|
|
||||||
new voteban = equal(cmd,"amx_voteban")
|
read_argv(0, cmd, 31)
|
||||||
|
|
||||||
|
new voteban = equal(cmd, "amx_voteban")
|
||||||
new arg[32]
|
new arg[32]
|
||||||
read_argv(1,arg,31)
|
read_argv(1, arg, 31)
|
||||||
new player = cmd_target(id,arg,1)
|
|
||||||
if (!player) return PLUGIN_HANDLED
|
new player = cmd_target(id, arg, 1)
|
||||||
if (voteban && is_user_bot(player)) {
|
|
||||||
|
if (!player)
|
||||||
|
return PLUGIN_HANDLED
|
||||||
|
|
||||||
|
if (voteban && is_user_bot(player))
|
||||||
|
{
|
||||||
new imname[32]
|
new imname[32]
|
||||||
get_user_name(player,imname,31)
|
|
||||||
console_print(id,"%L",id,"ACTION_PERFORMED",imname)
|
get_user_name(player, imname, 31)
|
||||||
|
console_print(id, "%L", id, "ACTION_PERFORMED", imname)
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
new keys = MENU_KEY_1|MENU_KEY_2
|
new keys = MENU_KEY_1|MENU_KEY_2
|
||||||
new menu_msg[256],lYes[16],lNo[16],lKickBan[16]
|
new menu_msg[256], lYes[16], lNo[16], lKickBan[16]
|
||||||
format(lYes,15,"%L",LANG_SERVER,"YES")
|
|
||||||
format(lNo,15,"%L",LANG_SERVER,"NO")
|
format(lYes, 15, "%L", LANG_SERVER, "YES")
|
||||||
format(lKickBan,15,"%L",LANG_SERVER,voteban?"BAN":"KICK")
|
format(lNo, 15, "%L", LANG_SERVER, "NO")
|
||||||
|
format(lKickBan, 15, "%L", LANG_SERVER, voteban ? "BAN" : "KICK")
|
||||||
ucfirst(lKickBan)
|
ucfirst(lKickBan)
|
||||||
get_user_name(player,arg,31)
|
get_user_name(player, arg, 31)
|
||||||
format(menu_msg,255,g_coloredMenus ?
|
format(menu_msg, 255, g_coloredMenus ? "\y%s %s?\w^n^n1. %s^n2. %s" : "%s %s?^n^n1. %s^n2. %s", lKickBan, arg, lYes, lNo)
|
||||||
"\y%s %s?\w^n^n1. %s^n2. %s" :
|
|
||||||
"%s %s?^n^n1. %s^n2. %s",
|
|
||||||
lKickBan, arg, lYes, lNo)
|
|
||||||
g_yesNoVote = 1
|
g_yesNoVote = 1
|
||||||
|
|
||||||
if (voteban)
|
if (voteban)
|
||||||
get_user_authid(player,g_optionName[0],31)
|
get_user_authid(player, g_optionName[0], 31)
|
||||||
else
|
else
|
||||||
num_to_str(get_user_userid(player),g_optionName[0],31)
|
num_to_str(get_user_userid(player), g_optionName[0], 31)
|
||||||
new authid[32],name[32]
|
|
||||||
get_user_authid(id,authid,31)
|
new authid[32], name[32]
|
||||||
get_user_name(id,name,31)
|
|
||||||
log_amx("Vote: ^"%s<%d><%s><>^" vote %s (target ^"%s^")",
|
get_user_authid(id, authid, 31)
|
||||||
name,get_user_userid(id),authid,voteban ? "ban" : "kick",arg)
|
get_user_name(id, name, 31)
|
||||||
|
log_amx("Vote: ^"%s<%d><%s><>^" vote %s (target ^"%s^")", name, get_user_userid(id), authid, voteban ? "ban" : "kick", arg)
|
||||||
|
|
||||||
new activity = get_cvar_num("amx_show_activity")
|
new activity = get_cvar_num("amx_show_activity")
|
||||||
if (activity>0) {
|
if (activity > 0)
|
||||||
new players[32],pnum,lTag[16]
|
{
|
||||||
get_players(players,pnum,"c")
|
new players[32], pnum, lTag[16]
|
||||||
for (new i=0;i<pnum;i++) {
|
|
||||||
format(lTag,15,"%L",players[i],is_user_admin(id)?"ADMIN":"USER")
|
get_players(players, pnum, "c")
|
||||||
format(lKickBan,15,"%L",players[i],voteban?"BAN":"KICK")
|
for (new i = 0; i < pnum; i++)
|
||||||
switch (activity) {
|
{
|
||||||
case 2: client_print(players[i],print_chat,"%L",
|
format(lTag, 15, "%L", players[i], is_user_admin(id) ? "ADMIN" : "USER")
|
||||||
players[i],"ADMIN_VOTE_FOR_2",lTag,name,lKickBan,arg)
|
format(lKickBan, 15, "%L", players[i], voteban ? "BAN" : "KICK")
|
||||||
case 1: client_print(players[i],print_chat,"%L",
|
|
||||||
players[i],"ADMIN_VOTE_FOR_1",lTag,lKickBan,arg)
|
switch (activity)
|
||||||
|
{
|
||||||
|
case 2: client_print(players[i], print_chat, "%L", players[i], "ADMIN_VOTE_FOR_2", lTag, name, lKickBan, arg)
|
||||||
|
case 1: client_print(players[i], print_chat, "%L", players[i], "ADMIN_VOTE_FOR_1", lTag, lKickBan, arg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_execResult = true
|
g_execResult = true
|
||||||
|
|
||||||
new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0
|
new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0
|
||||||
set_cvar_float("amx_last_voting", get_gametime() + vote_time )
|
|
||||||
|
set_cvar_float("amx_last_voting", get_gametime() + vote_time)
|
||||||
g_voteRatio = get_cvar_float(voteban ? "amx_voteban_ratio" : "amx_votekick_ratio")
|
g_voteRatio = get_cvar_float(voteban ? "amx_voteban_ratio" : "amx_votekick_ratio")
|
||||||
g_Answer = voteban ? "banid 30.0 %s kick" : "kick #%s"
|
g_Answer = voteban ? "banid 30.0 %s kick" : "kick #%s"
|
||||||
show_menu(0,keys,menu_msg,floatround(vote_time),voteban?"Ban ":"Kick ")
|
show_menu(0, keys, menu_msg, floatround(vote_time), voteban ? "Ban " : "Kick ")
|
||||||
set_task(vote_time,"checkVotes" , 99889988 )
|
set_task(vote_time, "checkVotes", 99889988)
|
||||||
g_voteCaller = id
|
g_voteCaller = id
|
||||||
console_print(id, "%L", id, "VOTING_STARTED")
|
console_print(id, "%L", id, "VOTING_STARTED")
|
||||||
g_voteCount = {0,0,0,0}
|
g_voteCount = {0, 0, 0, 0}
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
@ -37,30 +37,35 @@
|
|||||||
new Float:g_Flooding[33] = {0.0, ...}
|
new Float:g_Flooding[33] = {0.0, ...}
|
||||||
new g_Flood[33] = {0, ...}
|
new g_Flood[33] = {0, ...}
|
||||||
|
|
||||||
public plugin_init() {
|
public plugin_init()
|
||||||
register_plugin("Anti Flood",AMXX_VERSION_STR,"AMXX Dev Team")
|
{
|
||||||
|
register_plugin("Anti Flood", AMXX_VERSION_STR, "AMXX Dev Team")
|
||||||
register_dictionary("antiflood.txt")
|
register_dictionary("antiflood.txt")
|
||||||
register_clcmd("say","chkFlood")
|
register_clcmd("say", "chkFlood")
|
||||||
register_clcmd("say_team","chkFlood")
|
register_clcmd("say_team", "chkFlood")
|
||||||
register_cvar("amx_flood_time","0.75")
|
register_cvar("amx_flood_time", "0.75")
|
||||||
}
|
}
|
||||||
|
|
||||||
public chkFlood(id) {
|
public chkFlood(id)
|
||||||
|
{
|
||||||
new Float:maxChat = get_cvar_float("amx_flood_time")
|
new Float:maxChat = get_cvar_float("amx_flood_time")
|
||||||
|
|
||||||
if ( maxChat ) {
|
if (maxChat)
|
||||||
|
{
|
||||||
new Float:nexTime = get_gametime()
|
new Float:nexTime = get_gametime()
|
||||||
|
|
||||||
if ( g_Flooding[id] > nexTime ) {
|
if (g_Flooding[id] > nexTime)
|
||||||
if (g_Flood[id] >= 3) {
|
{
|
||||||
client_print( id , print_notify , "** %L **", id, "STOP_FLOOD" )
|
if (g_Flood[id] >= 3)
|
||||||
g_Flooding[ id ] = nexTime + maxChat + 3.0
|
{
|
||||||
|
client_print(id, print_notify, "** %L **", id, "STOP_FLOOD")
|
||||||
|
g_Flooding[id] = nexTime + maxChat + 3.0
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
g_Flood[id]++
|
g_Flood[id]++
|
||||||
}
|
}
|
||||||
else {
|
else if (g_Flood[id])
|
||||||
if (g_Flood[id])
|
{
|
||||||
g_Flood[id]--
|
g_Flood[id]--
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,25 +39,29 @@
|
|||||||
|
|
||||||
#define MAX_CMDS_LAYERS 3
|
#define MAX_CMDS_LAYERS 3
|
||||||
|
|
||||||
new g_cmdMenuName[ MAX_CMDS_LAYERS ][] = {
|
new g_cmdMenuName[MAX_CMDS_LAYERS][] =
|
||||||
|
{
|
||||||
"CMD_MENU",
|
"CMD_MENU",
|
||||||
"CONF_MENU",
|
"CONF_MENU",
|
||||||
"SPE_MENU"
|
"SPE_MENU"
|
||||||
}
|
}
|
||||||
|
|
||||||
new g_cmdMenuCmd[ MAX_CMDS_LAYERS ][] = {
|
new g_cmdMenuCmd[MAX_CMDS_LAYERS][] =
|
||||||
|
{
|
||||||
"amx_cmdmenu",
|
"amx_cmdmenu",
|
||||||
"amx_cfgmenu",
|
"amx_cfgmenu",
|
||||||
"amx_speechmenu"
|
"amx_speechmenu"
|
||||||
}
|
}
|
||||||
|
|
||||||
new g_cmdMenuCfg[ MAX_CMDS_LAYERS ][] = {
|
new g_cmdMenuCfg[MAX_CMDS_LAYERS][] =
|
||||||
|
{
|
||||||
"cmds.ini",
|
"cmds.ini",
|
||||||
"configs.ini",
|
"configs.ini",
|
||||||
"speech.ini"
|
"speech.ini"
|
||||||
}
|
}
|
||||||
|
|
||||||
new g_cmdMenuHelp[ MAX_CMDS_LAYERS ][] = {
|
new g_cmdMenuHelp[MAX_CMDS_LAYERS][] =
|
||||||
|
{
|
||||||
"- displays commands menu",
|
"- displays commands menu",
|
||||||
"- displays configs menu",
|
"- displays configs menu",
|
||||||
"- displays speech menu"
|
"- displays speech menu"
|
||||||
@ -86,24 +90,28 @@ new g_menuLayer[33]
|
|||||||
|
|
||||||
new g_coloredMenus
|
new g_coloredMenus
|
||||||
|
|
||||||
public plugin_init() {
|
public plugin_init()
|
||||||
register_plugin("Commands Menu",AMXX_VERSION_STR,"AMXX Dev Team")
|
{
|
||||||
|
register_plugin("Commands Menu", AMXX_VERSION_STR, "AMXX Dev Team")
|
||||||
register_dictionary("cmdmenu.txt")
|
register_dictionary("cmdmenu.txt")
|
||||||
register_dictionary("common.txt")
|
register_dictionary("common.txt")
|
||||||
|
|
||||||
new configsDir[64],config[64]
|
new configsDir[64], config[64]
|
||||||
get_configsdir(configsDir, 63)
|
get_configsdir(configsDir, 63)
|
||||||
for (new a = 0; a < MAX_CMDS_LAYERS; ++a) {
|
|
||||||
|
for (new a = 0; a < MAX_CMDS_LAYERS; ++a)
|
||||||
|
{
|
||||||
new MenuName[64]
|
new MenuName[64]
|
||||||
format(MenuName,63,"%L","en",g_cmdMenuName[a])
|
|
||||||
register_menucmd(register_menuid( MenuName ),1023,"actionCmdMenu")
|
format(MenuName, 63, "%L", "en", g_cmdMenuName[a])
|
||||||
register_clcmd( g_cmdMenuCmd[ a ] ,"cmdCmdMenu",ADMIN_MENU, g_cmdMenuHelp[ a ] )
|
register_menucmd(register_menuid(MenuName), 1023, "actionCmdMenu")
|
||||||
format(config,63,"%s/%s",configsDir,g_cmdMenuCfg[a])
|
register_clcmd(g_cmdMenuCmd[a], "cmdCmdMenu", ADMIN_MENU, g_cmdMenuHelp[a])
|
||||||
loadCmdSettings(config,a)
|
format(config, 63, "%s/%s", configsDir, g_cmdMenuCfg[a])
|
||||||
|
loadCmdSettings(config, a)
|
||||||
}
|
}
|
||||||
|
|
||||||
register_menucmd(register_menuid("Cvars Menu"),1023,"actionCvarMenu")
|
register_menucmd(register_menuid("Cvars Menu"), 1023, "actionCvarMenu")
|
||||||
register_clcmd("amx_cvarmenu","cmdCvarMenu",ADMIN_CVAR,"- displays cvars menu")
|
register_clcmd("amx_cvarmenu", "cmdCvarMenu", ADMIN_CVAR, "- displays cvars menu")
|
||||||
|
|
||||||
new cvars_ini_file[64];
|
new cvars_ini_file[64];
|
||||||
format(cvars_ini_file, 63, "%s/%s", configsDir, "cvars.ini");
|
format(cvars_ini_file, 63, "%s/%s", configsDir, "cvars.ini");
|
||||||
@ -114,28 +122,36 @@ public plugin_init() {
|
|||||||
|
|
||||||
/* Commands menu */
|
/* Commands menu */
|
||||||
|
|
||||||
public actionCmdMenu(id,key) {
|
public actionCmdMenu(id, key)
|
||||||
switch (key) {
|
{
|
||||||
case 8: displayCmdMenu(id,++g_menuPosition[id])
|
switch (key)
|
||||||
case 9: displayCmdMenu(id,--g_menuPosition[id])
|
{
|
||||||
default:{
|
case 8: displayCmdMenu(id, ++g_menuPosition[id])
|
||||||
new option = g_menuSelect[ id ][ g_menuPosition[id] * 8 + key ]
|
case 9: displayCmdMenu(id, --g_menuPosition[id])
|
||||||
new flags = g_cmdMisc[ option ][ 1 ]
|
default:
|
||||||
if ( flags & 1)
|
{
|
||||||
server_cmd( g_cmdCmd[ option ] )
|
new option = g_menuSelect[id][g_menuPosition[id] * 8 + key]
|
||||||
else if ( flags & 2)
|
new flags = g_cmdMisc[option][1]
|
||||||
client_cmd(id, g_cmdCmd[ option ] )
|
|
||||||
else if ( flags & 4)
|
if (flags & 1)
|
||||||
client_cmd(0, g_cmdCmd[ option ] )
|
server_cmd(g_cmdCmd[option])
|
||||||
if ( flags & 8 ) displayCmdMenu(id,g_menuPosition[id])
|
else if (flags & 2)
|
||||||
|
client_cmd(id, g_cmdCmd[option])
|
||||||
|
else if (flags & 4)
|
||||||
|
client_cmd(0, g_cmdCmd[option])
|
||||||
|
|
||||||
|
if (flags & 8)
|
||||||
|
displayCmdMenu(id, g_menuPosition[id])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
displayCmdMenu(id, pos)
|
||||||
displayCmdMenu(id,pos) {
|
{
|
||||||
if (pos < 0) return
|
if (pos < 0)
|
||||||
|
return
|
||||||
|
|
||||||
new menuBody[512]
|
new menuBody[512]
|
||||||
new b = 0
|
new b = 0
|
||||||
@ -144,150 +160,159 @@ displayCmdMenu(id,pos) {
|
|||||||
if (start >= g_menuSelectNum[id])
|
if (start >= g_menuSelectNum[id])
|
||||||
start = pos = g_menuPosition[id] = 0
|
start = pos = g_menuPosition[id] = 0
|
||||||
|
|
||||||
new len = format(menuBody,511,g_coloredMenus ?
|
new len = format(menuBody, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, g_cmdMenuName[g_menuLayer[id]], pos + 1, (g_menuSelectNum[id] / 8 + ((g_menuSelectNum[id] % 8) ? 1 : 0)))
|
||||||
"\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n" , id, g_cmdMenuName[ g_menuLayer[id] ],
|
|
||||||
pos+1,( g_menuSelectNum[id] / 8 + ((g_menuSelectNum[id] % 8) ? 1 : 0 )) )
|
|
||||||
|
|
||||||
new end = start + 8
|
new end = start + 8
|
||||||
new keys = MENU_KEY_0
|
new keys = MENU_KEY_0
|
||||||
|
|
||||||
if (end > g_menuSelectNum[id])
|
if (end > g_menuSelectNum[id])
|
||||||
end = g_menuSelectNum[id]
|
end = g_menuSelectNum[id]
|
||||||
|
|
||||||
for(new a = start; a < end; ++a) {
|
for (new a = start; a < end; ++a)
|
||||||
if ( g_cmdCmd[ g_menuSelect[id][ a ] ][0] == '-' ) {
|
{
|
||||||
if ( g_coloredMenus )
|
if (g_cmdCmd[g_menuSelect[id][a]][0] == '-')
|
||||||
len += format(menuBody[len],511-len,"\d%s^n\w",g_cmdName[ g_menuSelect[id][ a ] ] )
|
{
|
||||||
|
if (g_coloredMenus)
|
||||||
|
len += format(menuBody[len], 511-len, "\d%s^n\w", g_cmdName[g_menuSelect[id][a]])
|
||||||
else
|
else
|
||||||
len += format(menuBody[len],511-len,"%s^n",g_cmdName[ g_menuSelect[id][ a ] ] )
|
len += format(menuBody[len], 511-len, "%s^n", g_cmdName[g_menuSelect[id][a]])
|
||||||
++b
|
++b
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
keys |= (1<<b)
|
keys |= (1<<b)
|
||||||
len += format(menuBody[len],511-len,"%d. %s^n",++b, g_cmdName[ g_menuSelect[id][ a ] ] )
|
len += format(menuBody[len], 511-len, "%d. %s^n", ++b, g_cmdName[g_menuSelect[id][a]])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (end != g_menuSelectNum[id]) {
|
if (end != g_menuSelectNum[id])
|
||||||
format(menuBody[len],511-len,"^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT" )
|
{
|
||||||
|
format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
|
||||||
keys |= MENU_KEY_9
|
keys |= MENU_KEY_9
|
||||||
}
|
}
|
||||||
else format(menuBody[len],511-len,"^n0. %L", id, pos ? "BACK" : "EXIT" )
|
else
|
||||||
|
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
|
||||||
|
|
||||||
new MenuName[64]
|
new MenuName[64]
|
||||||
format(MenuName,63,"%L","en",g_cmdMenuName[g_menuLayer[id]])
|
|
||||||
show_menu(id,keys,menuBody,-1,MenuName)
|
format(MenuName, 63, "%L", "en", g_cmdMenuName[g_menuLayer[id]])
|
||||||
|
show_menu(id, keys, menuBody, -1, MenuName)
|
||||||
}
|
}
|
||||||
|
|
||||||
public cmdCmdMenu(id,level,cid) {
|
public cmdCmdMenu(id, level, cid)
|
||||||
if (!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
|
{
|
||||||
|
if (!cmd_access(id, level, cid, 1))
|
||||||
|
return PLUGIN_HANDLED
|
||||||
|
|
||||||
new szCmd[32]
|
new szCmd[32]
|
||||||
read_argv(0, szCmd, 31)
|
read_argv(0, szCmd, 31)
|
||||||
|
|
||||||
new lvl = 0
|
new lvl = 0
|
||||||
|
|
||||||
while( lvl < MAX_CMDS_LAYERS ) {
|
while (lvl < MAX_CMDS_LAYERS)
|
||||||
if ( equal( g_cmdMenuCmd[ lvl ], szCmd ) )
|
{
|
||||||
|
if (equal(g_cmdMenuCmd[lvl], szCmd))
|
||||||
break
|
break
|
||||||
|
|
||||||
++lvl
|
++lvl
|
||||||
}
|
}
|
||||||
|
|
||||||
g_menuLayer[ id ] = lvl
|
g_menuLayer[id] = lvl
|
||||||
|
|
||||||
new flags = get_user_flags(id)
|
new flags = get_user_flags(id)
|
||||||
|
|
||||||
g_menuSelectNum[id] = 0
|
g_menuSelectNum[id] = 0
|
||||||
|
|
||||||
new a = lvl * MAX_CMDS
|
new a = lvl * MAX_CMDS
|
||||||
new d , c = 0
|
new d, c = 0
|
||||||
|
|
||||||
while( c < g_cmdNum[ lvl ] ) {
|
while (c < g_cmdNum[lvl])
|
||||||
|
{
|
||||||
d = a + c
|
d = a + c
|
||||||
|
|
||||||
if ( g_cmdMisc[ d ][0] & flags ) {
|
if (g_cmdMisc[d][0] & flags)
|
||||||
g_menuSelect[id][ g_menuSelectNum[id]++ ] = d
|
{
|
||||||
|
g_menuSelect[id][g_menuSelectNum[id]++] = d
|
||||||
}
|
}
|
||||||
|
|
||||||
++c
|
++c
|
||||||
}
|
}
|
||||||
|
|
||||||
displayCmdMenu(id,g_menuPosition[id] = 0)
|
displayCmdMenu(id, g_menuPosition[id] = 0)
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loadCmdSettings(szFilename[], level)
|
||||||
loadCmdSettings( szFilename[], level ) {
|
{
|
||||||
if ( !file_exists ( szFilename ) )
|
if (!file_exists(szFilename))
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
new text[256], szFlags[32], szAccess[32]
|
new text[256], szFlags[32], szAccess[32]
|
||||||
new a, pos = 0, c, d = level * MAX_CMDS
|
new a, pos = 0, c, d = level * MAX_CMDS
|
||||||
|
|
||||||
while ( g_cmdNum[ level ] < MAX_CMDS && read_file (szFilename,pos++,text,255,a) ) {
|
while (g_cmdNum[level] < MAX_CMDS && read_file(szFilename, pos++, text, 255, a))
|
||||||
if ( text[0] == ';' ) continue
|
{
|
||||||
|
if (text[0] == ';') continue
|
||||||
|
c = d + g_cmdNum[level]
|
||||||
|
|
||||||
c = d + g_cmdNum[ level ]
|
if (parse(text, g_cmdName[c], 31, g_cmdCmd[c], 63, szFlags, 31, szAccess, 31) > 3)
|
||||||
|
{
|
||||||
if ( parse( text , g_cmdName[ c ] , 31 ,
|
while (replace(g_cmdCmd[c], 63, "\'", "^""))
|
||||||
g_cmdCmd[ c ] ,63,szFlags,31,szAccess,31 ) > 3 ) {
|
{
|
||||||
while ( replace( g_cmdCmd[ c ] ,63,"\'","^"") ) {
|
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
g_cmdMisc[ c ][ 1 ] = read_flags ( szFlags )
|
g_cmdMisc[c][1] = read_flags(szFlags)
|
||||||
g_cmdMisc[ c ][ 0 ] = read_flags ( szAccess )
|
g_cmdMisc[c][0] = read_flags(szAccess)
|
||||||
g_cmdNum[ level ]++
|
g_cmdNum[level]++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Cvars menu */
|
/* Cvars menu */
|
||||||
|
|
||||||
public actionCvarMenu(id,key) {
|
public actionCvarMenu(id, key)
|
||||||
switch (key){
|
{
|
||||||
case 8: displayCvarMenu(id,++g_menuPosition[id])
|
switch (key)
|
||||||
case 9: displayCvarMenu(id,--g_menuPosition[id])
|
{
|
||||||
default: {
|
case 8: displayCvarMenu(id, ++g_menuPosition[id])
|
||||||
new option = g_menuSelect[ id ][ g_menuPosition[id] * 8 + key ]
|
case 9: displayCvarMenu(id, --g_menuPosition[id])
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
new option = g_menuSelect[id][g_menuPosition[id] * 8 + key]
|
||||||
new szValue[32]
|
new szValue[32]
|
||||||
get_cvar_string( g_cvarNames[ option ], szValue ,31)
|
|
||||||
|
|
||||||
new end = g_cvarMisc[ option ][ 2 ]
|
get_cvar_string(g_cvarNames[option], szValue, 31)
|
||||||
new start = g_cvarMisc[ option ][ 1 ]
|
|
||||||
|
|
||||||
for (new i = start ; ; ++i ) {
|
new end = g_cvarMisc[option][2]
|
||||||
if ( i < end ) {
|
new start = g_cvarMisc[option][1]
|
||||||
if ( equal( szValue , g_cvarCmd[ i ] ) )
|
|
||||||
|
for (new i = start; ; ++i)
|
||||||
|
{
|
||||||
|
if (i < end)
|
||||||
|
{
|
||||||
|
if (equal(szValue, g_cvarCmd[i]))
|
||||||
{
|
{
|
||||||
if (++i >= end)
|
if (++i >= end)
|
||||||
{
|
{
|
||||||
i = start
|
i = start
|
||||||
}
|
}
|
||||||
set_cvar_string( g_cvarNames[ option ], g_cvarCmd[ i ] )
|
|
||||||
|
set_cvar_string(g_cvarNames[option], g_cvarCmd[i])
|
||||||
|
break
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
set_cvar_string(g_cvarNames[option], g_cvarCmd[start])
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
displayCvarMenu(id, g_menuPosition[id])
|
||||||
set_cvar_string( g_cvarNames[ option ], g_cvarCmd[ start ] )
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
displayCvarMenu(id, g_menuPosition[id] )
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
displayCvarMenu(id, pos)
|
||||||
displayCvarMenu(id,pos) {
|
{
|
||||||
if (pos < 0) return
|
if (pos < 0)
|
||||||
|
return
|
||||||
|
|
||||||
new menuBody[512]
|
new menuBody[512]
|
||||||
new b = 0
|
new b = 0
|
||||||
@ -296,9 +321,7 @@ displayCvarMenu(id,pos) {
|
|||||||
if (start >= g_menuSelectNum[id])
|
if (start >= g_menuSelectNum[id])
|
||||||
start = pos = g_menuPosition[id] = 0
|
start = pos = g_menuPosition[id] = 0
|
||||||
|
|
||||||
new len = format(menuBody,511, g_coloredMenus ?
|
new len = format(menuBody, 511, g_coloredMenus ? "\yCvars Menu\R%d/%d^n\w^n" : "Cvars Menu %d/%d^n^n", pos + 1, (g_menuSelectNum[id] / 8 + ((g_menuSelectNum[id] % 8) ? 1 : 0)))
|
||||||
"\yCvars Menu\R%d/%d^n\w^n" : "Cvars Menu %d/%d^n^n",
|
|
||||||
pos+1,( g_menuSelectNum[id] / 8 + ((g_menuSelectNum[id] % 8) ? 1 : 0 )) )
|
|
||||||
|
|
||||||
new end = start + 8
|
new end = start + 8
|
||||||
new keys = MENU_KEY_0
|
new keys = MENU_KEY_0
|
||||||
@ -307,76 +330,84 @@ displayCvarMenu(id,pos) {
|
|||||||
if (end > g_menuSelectNum[id])
|
if (end > g_menuSelectNum[id])
|
||||||
end = g_menuSelectNum[id]
|
end = g_menuSelectNum[id]
|
||||||
|
|
||||||
for(new a = start; a < end; ++a) {
|
for (new a = start; a < end; ++a)
|
||||||
get_cvar_string( g_cvarNames[ g_menuSelect[id][ a ] ],szValue,31)
|
{
|
||||||
|
get_cvar_string(g_cvarNames[g_menuSelect[id][a]], szValue, 31)
|
||||||
keys |= (1<<b)
|
keys |= (1<<b)
|
||||||
++b
|
++b
|
||||||
if ( g_coloredMenus )
|
|
||||||
len += format(menuBody[len],511-len,"%d. %s\R%s^n\w", b, g_cvarNames[ g_menuSelect[id][ a ] ], szValue )
|
if (g_coloredMenus)
|
||||||
|
len += format(menuBody[len], 511-len, "%d. %s\R%s^n\w", b, g_cvarNames[g_menuSelect[id][a]], szValue)
|
||||||
else
|
else
|
||||||
len += format(menuBody[len],511-len,"%d. %s %s^n", b, g_cvarNames[ g_menuSelect[id][ a ] ], szValue )
|
len += format(menuBody[len], 511-len, "%d. %s %s^n", b, g_cvarNames[g_menuSelect[id][a]], szValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (end != g_menuSelectNum[id]) {
|
if (end != g_menuSelectNum[id])
|
||||||
format(menuBody[len],511-len,"^n9. %L...^n0. %L",id,"MORE",id,pos ? "BACK" : "EXIT")
|
{
|
||||||
|
format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
|
||||||
keys |= MENU_KEY_9
|
keys |= MENU_KEY_9
|
||||||
}
|
}
|
||||||
else format(menuBody[len],511-len,"^n0. %L", id, pos ? "BACK" : "EXIT")
|
else
|
||||||
show_menu(id,keys,menuBody)
|
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
|
||||||
|
|
||||||
|
show_menu(id, keys, menuBody)
|
||||||
}
|
}
|
||||||
|
|
||||||
public cmdCvarMenu(id,level,cid) {
|
public cmdCvarMenu(id, level, cid)
|
||||||
if (!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
|
{
|
||||||
|
if (!cmd_access(id, level, cid, 1))
|
||||||
|
return PLUGIN_HANDLED
|
||||||
|
|
||||||
new flags = get_user_flags(id)
|
new flags = get_user_flags(id)
|
||||||
|
|
||||||
g_menuSelectNum[id] = 0
|
g_menuSelectNum[id] = 0
|
||||||
|
|
||||||
for(new a = 0; a < g_cvarNum; ++a)
|
for (new a = 0; a < g_cvarNum; ++a)
|
||||||
if ( g_cvarMisc[ a ][0] & flags )
|
if (g_cvarMisc[a][0] & flags)
|
||||||
g_menuSelect[id][ g_menuSelectNum[id]++ ] = a
|
g_menuSelect[id][g_menuSelectNum[id]++] = a
|
||||||
|
|
||||||
displayCvarMenu(id,g_menuPosition[id] = 0)
|
displayCvarMenu(id, g_menuPosition[id] = 0)
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
loadCvarSettings( szFilename[] ) {
|
loadCvarSettings(szFilename[])
|
||||||
if ( !file_exists ( szFilename ) )
|
{
|
||||||
|
if (!file_exists(szFilename))
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
new text[256], szValues[12][32]
|
new text[256], szValues[12][32]
|
||||||
new inum , a, pos = 0
|
new inum, a, pos = 0
|
||||||
new cvar_values = MAX_CVARS * 5
|
new cvar_values = MAX_CVARS * 5
|
||||||
// a b c d
|
|
||||||
while ( g_cvarNum < MAX_CVARS && read_file (szFilename,pos++,text,255,a) ) {
|
|
||||||
if ( text[0] == ';' ) continue
|
|
||||||
|
|
||||||
inum = parse( text , g_cvarNames[ g_cvarNum ] , 31 ,
|
// a b c d
|
||||||
szValues[0] ,31 , szValues[1] ,31 , szValues[2] ,31 ,
|
while (g_cvarNum < MAX_CVARS && read_file(szFilename, pos++, text, 255, a))
|
||||||
szValues[3] ,31 , szValues[4] ,31 , szValues[5] ,31 ,
|
{
|
||||||
szValues[6] ,31 , szValues[7] ,31 , szValues[8] ,31 ,
|
if (text[0] == ';') continue
|
||||||
szValues[9] ,31 , szValues[10] ,31 , szValues[11] ,31 )
|
|
||||||
|
inum = parse(text, g_cvarNames[g_cvarNum], 31,
|
||||||
|
szValues[0], 31, szValues[1], 31, szValues[2], 31,
|
||||||
|
szValues[3], 31, szValues[4], 31, szValues[5], 31,
|
||||||
|
szValues[6], 31, szValues[7], 31, szValues[8], 31,
|
||||||
|
szValues[9], 31, szValues[10], 31, szValues[11], 31)
|
||||||
|
|
||||||
inum -= 2
|
inum -= 2
|
||||||
|
if (inum < 2) continue
|
||||||
|
g_cvarMisc[g_cvarNum][1] = g_cvarCmdNum
|
||||||
|
|
||||||
if ( inum < 2 ) continue
|
for (a = 0; a < inum && g_cvarCmdNum < cvar_values; ++a)
|
||||||
|
{
|
||||||
g_cvarMisc[ g_cvarNum ][1] = g_cvarCmdNum
|
while (replace(szValues[a], 31, "\'", "^""))
|
||||||
|
{
|
||||||
for ( a = 0 ; a < inum && g_cvarCmdNum < cvar_values ; ++a ) {
|
|
||||||
while ( replace( szValues[ a ] ,31 , "\'" , "^"" ) ) {
|
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
copy ( g_cvarCmd[ g_cvarCmdNum ] , 31 , szValues[ a ] )
|
copy(g_cvarCmd[g_cvarCmdNum], 31, szValues[a])
|
||||||
g_cvarCmdNum++
|
g_cvarCmdNum++
|
||||||
}
|
}
|
||||||
|
|
||||||
g_cvarMisc[ g_cvarNum ][2] = g_cvarCmdNum
|
g_cvarMisc[g_cvarNum][2] = g_cvarCmdNum
|
||||||
g_cvarMisc[ g_cvarNum ][0] = read_flags( szValues[ inum ] )
|
g_cvarMisc[g_cvarNum][0] = read_flags(szValues[inum])
|
||||||
g_cvarNum++
|
g_cvarNum++
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
|
@ -45,56 +45,79 @@ new g_Messages[MAX_MESSAGES][384]
|
|||||||
new g_MessagesNum
|
new g_MessagesNum
|
||||||
new g_Current
|
new g_Current
|
||||||
|
|
||||||
public plugin_init() {
|
public plugin_init()
|
||||||
register_plugin("Info. Messages",AMXX_VERSION_STR,"AMXX Dev Team")
|
{
|
||||||
|
register_plugin("Info. Messages", AMXX_VERSION_STR, "AMXX Dev Team")
|
||||||
register_dictionary("imessage.txt")
|
register_dictionary("imessage.txt")
|
||||||
register_dictionary("common.txt")
|
register_dictionary("common.txt")
|
||||||
register_srvcmd("amx_imessage","setMessage")
|
register_srvcmd("amx_imessage", "setMessage")
|
||||||
register_cvar("amx_freq_imessage","10")
|
register_cvar("amx_freq_imessage", "10")
|
||||||
|
|
||||||
new lastinfo[8]
|
new lastinfo[8]
|
||||||
get_localinfo("lastinfomsg",lastinfo,7)
|
get_localinfo("lastinfomsg", lastinfo, 7)
|
||||||
g_Current = str_to_num(lastinfo)
|
g_Current = str_to_num(lastinfo)
|
||||||
set_localinfo("lastinfomsg","")
|
set_localinfo("lastinfomsg", "")
|
||||||
}
|
}
|
||||||
|
|
||||||
public infoMessage() {
|
public infoMessage()
|
||||||
|
{
|
||||||
if (g_Current >= g_MessagesNum)
|
if (g_Current >= g_MessagesNum)
|
||||||
g_Current = 0
|
g_Current = 0
|
||||||
set_hudmessage(g_Values[g_Current][0], g_Values[g_Current][1], g_Values[g_Current][2],
|
|
||||||
X_POS, Y_POS, 0, 0.5, HOLD_TIME , 2.0, 2.0, 1)
|
set_hudmessage(g_Values[g_Current][0], g_Values[g_Current][1], g_Values[g_Current][2], X_POS, Y_POS, 0, 0.5, HOLD_TIME, 2.0, 2.0, 1)
|
||||||
show_hudmessage(0,g_Messages[g_Current])
|
show_hudmessage(0, g_Messages[g_Current])
|
||||||
client_print(0,print_console,g_Messages[g_Current])
|
client_print(0, print_console, g_Messages[g_Current])
|
||||||
++g_Current
|
++g_Current
|
||||||
|
|
||||||
new Float:freq_im = get_cvar_float("amx_freq_imessage")
|
new Float:freq_im = get_cvar_float("amx_freq_imessage")
|
||||||
if ( freq_im > 0.0 ) set_task( freq_im ,"infoMessage",12345)
|
|
||||||
|
if (freq_im > 0.0)
|
||||||
|
set_task(freq_im, "infoMessage", 12345)
|
||||||
}
|
}
|
||||||
|
|
||||||
public setMessage() {
|
public setMessage()
|
||||||
if (g_MessagesNum >= MAX_MESSAGES) {
|
{
|
||||||
server_print("%L",LANG_SERVER,"INF_REACH")
|
if (g_MessagesNum >= MAX_MESSAGES)
|
||||||
|
{
|
||||||
|
server_print("%L", LANG_SERVER, "INF_REACH")
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
remove_task(12345)
|
remove_task(12345)
|
||||||
read_argv(1,g_Messages[g_MessagesNum],380)
|
read_argv(1, g_Messages[g_MessagesNum], 380)
|
||||||
|
|
||||||
new hostname[64]
|
new hostname[64]
|
||||||
get_cvar_string("hostname",hostname,63)
|
|
||||||
replace(g_Messages[g_MessagesNum],380,"%hostname%",hostname)
|
get_cvar_string("hostname", hostname, 63)
|
||||||
while(replace(g_Messages[g_MessagesNum],380,"\n","^n")){}
|
replace(g_Messages[g_MessagesNum], 380, "%hostname%", hostname)
|
||||||
|
|
||||||
|
while (replace(g_Messages[g_MessagesNum], 380, "\n", "^n")) {}
|
||||||
|
|
||||||
new mycol[12]
|
new mycol[12]
|
||||||
read_argv(2,mycol,11) // RRRGGGBBB
|
|
||||||
|
read_argv(2, mycol, 11) // RRRGGGBBB
|
||||||
g_Values[g_MessagesNum][2] = str_to_num(mycol[6])
|
g_Values[g_MessagesNum][2] = str_to_num(mycol[6])
|
||||||
|
|
||||||
mycol[6] = 0
|
mycol[6] = 0
|
||||||
g_Values[g_MessagesNum][1] = str_to_num(mycol[3])
|
g_Values[g_MessagesNum][1] = str_to_num(mycol[3])
|
||||||
|
|
||||||
mycol[3] = 0
|
mycol[3] = 0
|
||||||
g_Values[g_MessagesNum][0] = str_to_num(mycol[0])
|
g_Values[g_MessagesNum][0] = str_to_num(mycol[0])
|
||||||
|
|
||||||
g_MessagesNum++
|
g_MessagesNum++
|
||||||
|
|
||||||
new Float:freq_im = get_cvar_float("amx_freq_imessage")
|
new Float:freq_im = get_cvar_float("amx_freq_imessage")
|
||||||
if ( freq_im > 0.0 ) set_task( freq_im ,"infoMessage",12345)
|
|
||||||
|
if (freq_im > 0.0)
|
||||||
|
set_task(freq_im, "infoMessage", 12345)
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
public plugin_end() {
|
public plugin_end()
|
||||||
|
{
|
||||||
new lastinfo[8]
|
new lastinfo[8]
|
||||||
num_to_str(g_Current,lastinfo,7)
|
|
||||||
set_localinfo("lastinfomsg",lastinfo)
|
num_to_str(g_Current, lastinfo, 7)
|
||||||
|
set_localinfo("lastinfomsg", lastinfo)
|
||||||
}
|
}
|
@ -42,7 +42,7 @@ new g_mapName[MAX_MAPS][32]
|
|||||||
new g_mapNums
|
new g_mapNums
|
||||||
|
|
||||||
new g_nextName[SELECTMAPS]
|
new g_nextName[SELECTMAPS]
|
||||||
new g_voteCount[SELECTMAPS+2]
|
new g_voteCount[SELECTMAPS + 2]
|
||||||
new g_mapVoteNum
|
new g_mapVoteNum
|
||||||
new g_teamScore[2]
|
new g_teamScore[2]
|
||||||
new g_lastMap[32]
|
new g_lastMap[32]
|
||||||
@ -50,163 +50,204 @@ new g_lastMap[32]
|
|||||||
new g_coloredMenus
|
new g_coloredMenus
|
||||||
new bool:g_selected = false
|
new bool:g_selected = false
|
||||||
|
|
||||||
public plugin_init() {
|
public plugin_init()
|
||||||
register_plugin("Nextmap Chooser",AMXX_VERSION_STR,"AMXX Dev Team")
|
{
|
||||||
|
register_plugin("Nextmap Chooser", AMXX_VERSION_STR, "AMXX Dev Team")
|
||||||
register_dictionary("mapchooser.txt")
|
register_dictionary("mapchooser.txt")
|
||||||
register_dictionary("common.txt")
|
register_dictionary("common.txt")
|
||||||
new MenuName[64]
|
|
||||||
format(MenuName,63,"%L","en","CHOOSE_NEXTM")
|
|
||||||
register_menucmd(register_menuid(MenuName),(-1^(-1<<(SELECTMAPS+2))),"countVote")
|
|
||||||
register_cvar("amx_extendmap_max","90")
|
|
||||||
register_cvar("amx_extendmap_step","15")
|
|
||||||
|
|
||||||
if ( cstrike_running() )
|
new MenuName[64]
|
||||||
|
|
||||||
|
format(MenuName, 63, "%L", "en", "CHOOSE_NEXTM")
|
||||||
|
register_menucmd(register_menuid(MenuName), (-1^(-1<<(SELECTMAPS+2))), "countVote")
|
||||||
|
register_cvar("amx_extendmap_max", "90")
|
||||||
|
register_cvar("amx_extendmap_step", "15")
|
||||||
|
|
||||||
|
if (cstrike_running())
|
||||||
register_event("TeamScore", "team_score", "a")
|
register_event("TeamScore", "team_score", "a")
|
||||||
|
|
||||||
get_localinfo("lastMap",g_lastMap,31)
|
get_localinfo("lastMap", g_lastMap, 31)
|
||||||
set_localinfo("lastMap","")
|
set_localinfo("lastMap", "")
|
||||||
|
|
||||||
new maps_ini_file[64]
|
new maps_ini_file[64]
|
||||||
get_configsdir(maps_ini_file, 63);
|
get_configsdir(maps_ini_file, 63);
|
||||||
format(maps_ini_file, 63, "%s/maps.ini", maps_ini_file);
|
format(maps_ini_file, 63, "%s/maps.ini", maps_ini_file);
|
||||||
|
|
||||||
if (!file_exists(maps_ini_file))
|
if (!file_exists(maps_ini_file))
|
||||||
get_cvar_string("mapcyclefile", maps_ini_file, 63)
|
get_cvar_string("mapcyclefile", maps_ini_file, 63)
|
||||||
if ( loadSettings(maps_ini_file) )
|
if (loadSettings(maps_ini_file))
|
||||||
set_task(15.0,"voteNextmap",987456,"",0,"b")
|
set_task(15.0, "voteNextmap", 987456, "", 0, "b")
|
||||||
|
|
||||||
g_coloredMenus = colored_menus()
|
g_coloredMenus = colored_menus()
|
||||||
}
|
}
|
||||||
|
|
||||||
public checkVotes() {
|
public checkVotes()
|
||||||
|
{
|
||||||
new b = 0
|
new b = 0
|
||||||
|
|
||||||
for (new a = 0; a < g_mapVoteNum; ++a)
|
for (new a = 0; a < g_mapVoteNum; ++a)
|
||||||
if (g_voteCount[b] < g_voteCount[a])
|
if (g_voteCount[b] < g_voteCount[a])
|
||||||
b = a
|
b = a
|
||||||
if ( g_voteCount[SELECTMAPS] > g_voteCount[b] ) {
|
|
||||||
|
if (g_voteCount[SELECTMAPS] > g_voteCount[b])
|
||||||
|
{
|
||||||
new mapname[32]
|
new mapname[32]
|
||||||
get_mapname(mapname,31)
|
|
||||||
|
get_mapname(mapname, 31)
|
||||||
new Float:steptime = get_cvar_float("amx_extendmap_step")
|
new Float:steptime = get_cvar_float("amx_extendmap_step")
|
||||||
set_cvar_float("mp_timelimit", get_cvar_float("mp_timelimit") + steptime )
|
set_cvar_float("mp_timelimit", get_cvar_float("mp_timelimit") + steptime)
|
||||||
client_print(0,print_chat,"%L", LANG_PLAYER, "CHO_FIN_EXT", steptime )
|
client_print(0, print_chat, "%L", LANG_PLAYER, "CHO_FIN_EXT", steptime)
|
||||||
log_amx("Vote: Voting for the nextmap finished. Map %s will be extended to next %.0f minutes",
|
log_amx("Vote: Voting for the nextmap finished. Map %s will be extended to next %.0f minutes", mapname, steptime)
|
||||||
mapname , steptime )
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if ( g_voteCount[b] && g_voteCount[SELECTMAPS+1] <= g_voteCount[b] )
|
|
||||||
set_cvar_string("amx_nextmap", g_mapName[g_nextName[b]] )
|
if (g_voteCount[b] && g_voteCount[SELECTMAPS + 1] <= g_voteCount[b])
|
||||||
|
set_cvar_string("amx_nextmap", g_mapName[g_nextName[b]])
|
||||||
|
|
||||||
new smap[32]
|
new smap[32]
|
||||||
get_cvar_string("amx_nextmap",smap,31)
|
|
||||||
client_print(0,print_chat,"%L", LANG_PLAYER, "CHO_FIN_NEXT", smap )
|
get_cvar_string("amx_nextmap", smap, 31)
|
||||||
|
client_print(0, print_chat, "%L", LANG_PLAYER, "CHO_FIN_NEXT", smap)
|
||||||
log_amx("Vote: Voting for the nextmap finished. The nextmap will be %s", smap)
|
log_amx("Vote: Voting for the nextmap finished. The nextmap will be %s", smap)
|
||||||
}
|
}
|
||||||
|
|
||||||
public countVote(id,key) {
|
public countVote(id, key)
|
||||||
if ( get_cvar_float("amx_vote_answers") ) {
|
{
|
||||||
|
if (get_cvar_float("amx_vote_answers"))
|
||||||
|
{
|
||||||
new name[32]
|
new name[32]
|
||||||
get_user_name(id,name,31)
|
get_user_name(id, name, 31)
|
||||||
if ( key == SELECTMAPS )
|
|
||||||
client_print(0,print_chat,"%L", LANG_PLAYER, "CHOSE_EXT", name )
|
if (key == SELECTMAPS)
|
||||||
else if ( key < SELECTMAPS )
|
client_print(0, print_chat, "%L", LANG_PLAYER, "CHOSE_EXT", name)
|
||||||
client_print(0,print_chat,"%L", LANG_PLAYER, "X_CHOSE_X", name, g_mapName[g_nextName[key]] )
|
else if (key < SELECTMAPS)
|
||||||
|
client_print(0, print_chat, "%L", LANG_PLAYER, "X_CHOSE_X", name, g_mapName[g_nextName[key]])
|
||||||
}
|
}
|
||||||
++g_voteCount[key]
|
++g_voteCount[key]
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
bool:isInMenu(id) {
|
bool:isInMenu(id)
|
||||||
for (new a=0; a<g_mapVoteNum; ++a)
|
{
|
||||||
if (id==g_nextName[a])
|
for (new a = 0; a < g_mapVoteNum; ++a)
|
||||||
|
if (id == g_nextName[a])
|
||||||
return true
|
return true
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
public voteNextmap() {
|
public voteNextmap()
|
||||||
|
{
|
||||||
new winlimit = get_cvar_num("mp_winlimit")
|
new winlimit = get_cvar_num("mp_winlimit")
|
||||||
new maxrounds = get_cvar_num("mp_maxrounds")
|
new maxrounds = get_cvar_num("mp_maxrounds")
|
||||||
if ( winlimit ) {
|
|
||||||
|
if (winlimit)
|
||||||
|
{
|
||||||
new c = winlimit - 2
|
new c = winlimit - 2
|
||||||
if ( (c > g_teamScore[0]) && (c > g_teamScore[1]) ) {
|
|
||||||
|
if ((c > g_teamScore[0]) && (c > g_teamScore[1]))
|
||||||
|
{
|
||||||
g_selected = false
|
g_selected = false
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( maxrounds ) {
|
else if (maxrounds)
|
||||||
if ( (maxrounds - 2) > (g_teamScore[0] + g_teamScore[1]) ){
|
{
|
||||||
|
if ((maxrounds - 2) > (g_teamScore[0] + g_teamScore[1]))
|
||||||
|
{
|
||||||
g_selected = false
|
g_selected = false
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
new timeleft = get_timeleft()
|
new timeleft = get_timeleft()
|
||||||
if (timeleft<1||timeleft>129){
|
|
||||||
|
if (timeleft < 1 || timeleft > 129)
|
||||||
|
{
|
||||||
g_selected = false
|
g_selected = false
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_selected)
|
if (g_selected)
|
||||||
return
|
return
|
||||||
|
|
||||||
g_selected = true
|
g_selected = true
|
||||||
new menu[512], a, mkeys = (1<<SELECTMAPS+1)
|
|
||||||
new pos = format(menu,511,g_coloredMenus ? "\y%L:\w^n^n" : "%L:^n^n", LANG_SERVER, "CHOOSE_NEXTM")
|
new menu[512], a, mkeys = (1<<SELECTMAPS + 1)
|
||||||
|
new pos = format(menu, 511, g_coloredMenus ? "\y%L:\w^n^n" : "%L:^n^n", LANG_SERVER, "CHOOSE_NEXTM")
|
||||||
new dmax = (g_mapNums > SELECTMAPS) ? SELECTMAPS : g_mapNums
|
new dmax = (g_mapNums > SELECTMAPS) ? SELECTMAPS : g_mapNums
|
||||||
for(g_mapVoteNum = 0;g_mapVoteNum<dmax;++g_mapVoteNum){
|
|
||||||
a=random_num(0,g_mapNums-1)
|
for (g_mapVoteNum = 0; g_mapVoteNum < dmax; ++g_mapVoteNum)
|
||||||
while( isInMenu(a) )
|
{
|
||||||
|
a = random_num(0, g_mapNums - 1)
|
||||||
|
|
||||||
|
while (isInMenu(a))
|
||||||
if (++a >= g_mapNums) a = 0
|
if (++a >= g_mapNums) a = 0
|
||||||
|
|
||||||
g_nextName[g_mapVoteNum] = a
|
g_nextName[g_mapVoteNum] = a
|
||||||
pos += format(menu[pos],511,"%d. %s^n",g_mapVoteNum+1,g_mapName[a])
|
pos += format(menu[pos], 511, "%d. %s^n", g_mapVoteNum + 1, g_mapName[a])
|
||||||
mkeys |= (1<<g_mapVoteNum)
|
mkeys |= (1<<g_mapVoteNum)
|
||||||
g_voteCount[g_mapVoteNum] = 0
|
g_voteCount[g_mapVoteNum] = 0
|
||||||
}
|
}
|
||||||
menu[pos++]='^n'
|
|
||||||
g_voteCount[SELECTMAPS] = 0
|
|
||||||
g_voteCount[SELECTMAPS+1] = 0
|
|
||||||
new mapname[32]
|
|
||||||
get_mapname(mapname,31)
|
|
||||||
|
|
||||||
if ( (winlimit + maxrounds)==0 && (get_cvar_float("mp_timelimit") < get_cvar_float("amx_extendmap_max"))) {
|
menu[pos++] = '^n'
|
||||||
pos += format(menu[pos],511,"%d. %L^n",SELECTMAPS+1,LANG_SERVER,"EXTED_MAP",mapname)
|
g_voteCount[SELECTMAPS] = 0
|
||||||
|
g_voteCount[SELECTMAPS + 1] = 0
|
||||||
|
|
||||||
|
new mapname[32]
|
||||||
|
get_mapname(mapname, 31)
|
||||||
|
|
||||||
|
if ((winlimit + maxrounds) == 0 && (get_cvar_float("mp_timelimit") < get_cvar_float("amx_extendmap_max")))
|
||||||
|
{
|
||||||
|
pos += format(menu[pos], 511, "%d. %L^n", SELECTMAPS + 1, LANG_SERVER, "EXTED_MAP", mapname)
|
||||||
mkeys |= (1<<SELECTMAPS)
|
mkeys |= (1<<SELECTMAPS)
|
||||||
}
|
}
|
||||||
|
|
||||||
format(menu[pos],511,"%d. %L",SELECTMAPS+2,LANG_SERVER,"NONE")
|
format(menu[pos], 511, "%d. %L", SELECTMAPS+2, LANG_SERVER, "NONE")
|
||||||
new MenuName[64]
|
new MenuName[64]
|
||||||
format(MenuName,63,"%L","en","CHOOSE_NEXTM")
|
|
||||||
show_menu(0,mkeys,menu,15,MenuName)
|
format(MenuName, 63, "%L", "en", "CHOOSE_NEXTM")
|
||||||
set_task(15.0,"checkVotes")
|
show_menu(0, mkeys, menu, 15, MenuName)
|
||||||
client_print(0,print_chat,"%L",LANG_SERVER,"TIME_CHOOSE")
|
set_task(15.0, "checkVotes")
|
||||||
client_cmd(0,"spk Gman/Gman_Choose2")
|
client_print(0, print_chat, "%L", LANG_SERVER, "TIME_CHOOSE")
|
||||||
|
client_cmd(0, "spk Gman/Gman_Choose2")
|
||||||
log_amx("Vote: Voting for the nextmap started")
|
log_amx("Vote: Voting for the nextmap started")
|
||||||
}
|
}
|
||||||
|
|
||||||
loadSettings(filename[]) {
|
loadSettings(filename[])
|
||||||
if (!file_exists(filename)) return 0
|
{
|
||||||
|
if (!file_exists(filename))
|
||||||
|
return 0
|
||||||
|
|
||||||
new szText[32]
|
new szText[32]
|
||||||
new a, pos = 0
|
new a, pos = 0
|
||||||
new currentMap[32]
|
new currentMap[32]
|
||||||
get_mapname(currentMap,31)
|
|
||||||
|
|
||||||
while ( (g_mapNums < MAX_MAPS) && read_file(filename,pos++,szText,31,a) ) {
|
get_mapname(currentMap, 31)
|
||||||
if ( szText[0] != ';'
|
|
||||||
&& parse(szText, g_mapName[g_mapNums] ,31 )
|
while ((g_mapNums < MAX_MAPS) && read_file(filename, pos++, szText, 31, a))
|
||||||
&& is_map_valid( g_mapName[g_mapNums] )
|
{
|
||||||
&& !equali( g_mapName[g_mapNums] ,g_lastMap)
|
if (szText[0] != ';' && parse(szText, g_mapName[g_mapNums], 31) && is_map_valid(g_mapName[g_mapNums])
|
||||||
&& !equali( g_mapName[g_mapNums] ,currentMap) )
|
&& !equali(g_mapName[g_mapNums], g_lastMap) && !equali(g_mapName[g_mapNums], currentMap))
|
||||||
++g_mapNums
|
++g_mapNums
|
||||||
}
|
}
|
||||||
|
|
||||||
return g_mapNums
|
return g_mapNums
|
||||||
}
|
}
|
||||||
|
|
||||||
public team_score() {
|
public team_score()
|
||||||
|
{
|
||||||
new team[2]
|
new team[2]
|
||||||
read_data(1,team,1)
|
|
||||||
g_teamScore[ (team[0]=='C') ? 0 : 1 ] = read_data(2)
|
read_data(1, team, 1)
|
||||||
|
g_teamScore[(team[0]=='C') ? 0 : 1] = read_data(2)
|
||||||
}
|
}
|
||||||
|
|
||||||
public plugin_end() {
|
public plugin_end()
|
||||||
|
{
|
||||||
new current_map[32]
|
new current_map[32]
|
||||||
get_mapname(current_map,31 )
|
|
||||||
set_localinfo("lastMap",current_map)
|
get_mapname(current_map, 31)
|
||||||
|
set_localinfo("lastMap", current_map)
|
||||||
}
|
}
|
||||||
|
@ -50,343 +50,392 @@ new g_coloredMenus
|
|||||||
|
|
||||||
new g_choosed
|
new g_choosed
|
||||||
|
|
||||||
public plugin_init() {
|
public plugin_init()
|
||||||
register_plugin("Maps Menu",AMXX_VERSION_STR,"AMXX Dev Team")
|
{
|
||||||
|
register_plugin("Maps Menu", AMXX_VERSION_STR, "AMXX Dev Team")
|
||||||
register_dictionary("mapsmenu.txt")
|
register_dictionary("mapsmenu.txt")
|
||||||
register_dictionary("common.txt")
|
register_dictionary("common.txt")
|
||||||
register_clcmd("amx_mapmenu","cmdMapsMenu",ADMIN_MAP,"- displays changelevel menu")
|
register_clcmd("amx_mapmenu", "cmdMapsMenu", ADMIN_MAP, "- displays changelevel menu")
|
||||||
register_clcmd("amx_votemapmenu","cmdVoteMapMenu",ADMIN_MAP,"- displays votemap menu")
|
register_clcmd("amx_votemapmenu", "cmdVoteMapMenu", ADMIN_MAP, "- displays votemap menu")
|
||||||
|
|
||||||
register_menucmd(register_menuid("Changelevel Menu"),1023,"actionMapsMenu")
|
register_menucmd(register_menuid("Changelevel Menu"), 1023, "actionMapsMenu")
|
||||||
register_menucmd(register_menuid("Which map do you want?"),527,"voteCount")
|
register_menucmd(register_menuid("Which map do you want?"), 527, "voteCount")
|
||||||
register_menucmd(register_menuid("Change map to"),527,"voteCount")
|
register_menucmd(register_menuid("Change map to"), 527, "voteCount")
|
||||||
register_menucmd(register_menuid("Votemap Menu"),1023,"actionVoteMapMenu")
|
register_menucmd(register_menuid("Votemap Menu"), 1023, "actionVoteMapMenu")
|
||||||
register_menucmd(register_menuid("The winner: ") ,3,"actionResult")
|
register_menucmd(register_menuid("The winner: "), 3, "actionResult")
|
||||||
|
|
||||||
new maps_ini_file[64];
|
new maps_ini_file[64];
|
||||||
get_configsdir(maps_ini_file, 63);
|
get_configsdir(maps_ini_file, 63);
|
||||||
format(maps_ini_file, 63, "%s/maps.ini", maps_ini_file);
|
format(maps_ini_file, 63, "%s/maps.ini", maps_ini_file);
|
||||||
|
|
||||||
if (!file_exists(maps_ini_file))
|
if (!file_exists(maps_ini_file))
|
||||||
format(maps_ini_file, 63, "mapcycle.txt")
|
format(maps_ini_file, 63, "mapcycle.txt")
|
||||||
|
|
||||||
load_settings(maps_ini_file)
|
load_settings(maps_ini_file)
|
||||||
|
|
||||||
g_coloredMenus = colored_menus()
|
g_coloredMenus = colored_menus()
|
||||||
}
|
}
|
||||||
|
|
||||||
public autoRefuse() {
|
public autoRefuse()
|
||||||
log_amx("Vote: %L" , "en", "RESULT_REF")
|
{
|
||||||
client_print(0,print_chat, "%L", LANG_PLAYER, "RESULT_REF")
|
log_amx("Vote: %L", "en", "RESULT_REF")
|
||||||
|
client_print(0, print_chat, "%L", LANG_PLAYER, "RESULT_REF")
|
||||||
}
|
}
|
||||||
|
|
||||||
public actionResult(id,key) {
|
public actionResult(id, key)
|
||||||
remove_task( 4545454 )
|
{
|
||||||
switch (key){
|
remove_task(4545454)
|
||||||
case 0: {
|
|
||||||
|
switch (key)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
{
|
||||||
new _modName[10]
|
new _modName[10]
|
||||||
get_modname(_modName,9)
|
get_modname(_modName, 9)
|
||||||
if (!equal(_modName,"zp")) {
|
|
||||||
|
if (!equal(_modName, "zp"))
|
||||||
|
{
|
||||||
message_begin(MSG_ALL, SVC_INTERMISSION)
|
message_begin(MSG_ALL, SVC_INTERMISSION)
|
||||||
message_end()
|
message_end()
|
||||||
}
|
}
|
||||||
set_task(2.0,"delayedChange",0, g_mapName[ g_choosed ] , strlen(g_mapName[ g_choosed ]) + 1 )
|
|
||||||
log_amx("Vote: %L" , "en", "RESULT_ACC")
|
set_task(2.0, "delayedChange", 0, g_mapName[g_choosed], strlen(g_mapName[g_choosed]) + 1)
|
||||||
client_print(0,print_chat, "%L", LANG_PLAYER, "RESULT_ACC")
|
log_amx("Vote: %L", "en", "RESULT_ACC")
|
||||||
|
client_print(0, print_chat, "%L", LANG_PLAYER, "RESULT_ACC")
|
||||||
}
|
}
|
||||||
case 1: autoRefuse()
|
case 1: autoRefuse()
|
||||||
}
|
}
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
public checkVotes( id ) {
|
public checkVotes(id)
|
||||||
|
{
|
||||||
id -= 34567
|
id -= 34567
|
||||||
new num, ppl[32],a = 0
|
new num, ppl[32], a = 0
|
||||||
get_players(ppl,num,"c")
|
|
||||||
|
get_players(ppl, num, "c")
|
||||||
if (num == 0) num = 1
|
if (num == 0) num = 1
|
||||||
g_choosed = -1
|
g_choosed = -1
|
||||||
for (new i = 0; i < g_voteSelectedNum[id]; ++i)
|
|
||||||
if ( g_voteCount[a] < g_voteCount[i] )
|
|
||||||
a = i
|
|
||||||
if ( 100 * g_voteCount[a] / num > 50 ) {
|
|
||||||
g_choosed = g_voteSelected[id][a]
|
|
||||||
client_print(0,print_chat, "%L %s", LANG_PLAYER, "VOTE_SUCCESS", g_mapName[ g_choosed ] )
|
|
||||||
log_amx("Vote: %L %s", "en", "VOTE_SUCCESS", g_mapName[ g_choosed ] )
|
|
||||||
}
|
|
||||||
if ( g_choosed != -1 ) {
|
|
||||||
if ( is_user_connected( id ) ) {
|
|
||||||
new menuBody[512]
|
|
||||||
new len = format(menuBody,511,g_coloredMenus ? "\y%L: \w%s^n^n" : "%L: %s^n^n", id, "THE_WINNER", g_mapName[ g_choosed ] )
|
|
||||||
len += format( menuBody[len] ,511 - len, g_coloredMenus ? "\y%L^n\w" : "%L^n", id, "WANT_CONT" )
|
|
||||||
format( menuBody[len], 511-len, "^n1. %L^n2. %L",id,"YES",id,"NO")
|
|
||||||
|
|
||||||
show_menu( id, 0x03, menuBody, 10, "The winner: ")
|
for (new i = 0; i < g_voteSelectedNum[id]; ++i)
|
||||||
set_task(10.0,"autoRefuse",4545454)
|
if (g_voteCount[a] < g_voteCount[i])
|
||||||
|
a = i
|
||||||
|
|
||||||
|
if (100 * g_voteCount[a] / num > 50)
|
||||||
|
{
|
||||||
|
g_choosed = g_voteSelected[id][a]
|
||||||
|
client_print(0, print_chat, "%L %s", LANG_PLAYER, "VOTE_SUCCESS", g_mapName[g_choosed])
|
||||||
|
log_amx("Vote: %L %s", "en", "VOTE_SUCCESS", g_mapName[g_choosed])
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
|
if (g_choosed != -1)
|
||||||
|
{
|
||||||
|
if (is_user_connected(id))
|
||||||
|
{
|
||||||
|
new menuBody[512]
|
||||||
|
new len = format(menuBody, 511, g_coloredMenus ? "\y%L: \w%s^n^n" : "%L: %s^n^n", id, "THE_WINNER", g_mapName[g_choosed])
|
||||||
|
|
||||||
|
len += format(menuBody[len], 511 - len, g_coloredMenus ? "\y%L^n\w" : "%L^n", id, "WANT_CONT")
|
||||||
|
format(menuBody[len], 511-len, "^n1. %L^n2. %L", id, "YES", id, "NO")
|
||||||
|
|
||||||
|
show_menu(id, 0x03, menuBody, 10, "The winner: ")
|
||||||
|
set_task(10.0, "autoRefuse", 4545454)
|
||||||
|
} else {
|
||||||
new _modName[10]
|
new _modName[10]
|
||||||
get_modname(_modName,9)
|
get_modname(_modName, 9)
|
||||||
if (!equal(_modName,"zp")) {
|
|
||||||
|
if (!equal(_modName, "zp"))
|
||||||
|
{
|
||||||
message_begin(MSG_ALL, SVC_INTERMISSION)
|
message_begin(MSG_ALL, SVC_INTERMISSION)
|
||||||
message_end()
|
message_end()
|
||||||
}
|
}
|
||||||
set_task(2.0,"delayedChange",0, g_mapName[ g_choosed ] , strlen(g_mapName[ g_choosed ]) + 1 )
|
|
||||||
|
set_task(2.0, "delayedChange", 0, g_mapName[g_choosed], strlen(g_mapName[g_choosed]) + 1)
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
client_print(0, print_chat, "%L", LANG_PLAYER, "VOTE_FAILED")
|
||||||
client_print(0,print_chat, "%L", LANG_PLAYER, "VOTE_FAILED" )
|
|
||||||
log_amx("Vote: %L", "en", "VOTE_FAILED")
|
log_amx("Vote: %L", "en", "VOTE_FAILED")
|
||||||
}
|
}
|
||||||
|
|
||||||
remove_task(34567 + id)
|
remove_task(34567 + id)
|
||||||
}
|
}
|
||||||
|
|
||||||
public voteCount(id,key) {
|
public voteCount(id, key)
|
||||||
if (key > 3) {
|
{
|
||||||
client_print(0,print_chat,"%L",LANG_PLAYER,"VOT_CANC")
|
if (key > 3)
|
||||||
|
{
|
||||||
|
client_print(0, print_chat, "%L", LANG_PLAYER, "VOT_CANC")
|
||||||
remove_task(34567 + id)
|
remove_task(34567 + id)
|
||||||
set_cvar_float( "amx_last_voting" , get_gametime() )
|
set_cvar_float("amx_last_voting", get_gametime())
|
||||||
log_amx("Vote: Cancel vote session")
|
log_amx("Vote: Cancel vote session")
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
if (get_cvar_float("amx_vote_answers")) {
|
|
||||||
|
if (get_cvar_float("amx_vote_answers"))
|
||||||
|
{
|
||||||
new name[32]
|
new name[32]
|
||||||
get_user_name(id,name,31)
|
|
||||||
client_print(0,print_chat,"%L", LANG_PLAYER, "X_VOTED_FOR", name , key + 1 )
|
get_user_name(id, name, 31)
|
||||||
|
client_print(0, print_chat, "%L", LANG_PLAYER, "X_VOTED_FOR", name, key + 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
++g_voteCount[key]
|
++g_voteCount[key]
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
isMapSelected( id , pos ) {
|
isMapSelected(id, pos)
|
||||||
for ( new a = 0 ; a < g_voteSelectedNum[ id ]; ++a )
|
{
|
||||||
if ( g_voteSelected[ id ][ a ] == pos )
|
for (new a = 0; a < g_voteSelectedNum[id]; ++a)
|
||||||
|
if (g_voteSelected[id][a] == pos)
|
||||||
return 1
|
return 1
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
displayVoteMapsMenu(id,pos) {
|
displayVoteMapsMenu(id, pos)
|
||||||
|
{
|
||||||
if (pos < 0)
|
if (pos < 0)
|
||||||
return
|
return
|
||||||
|
|
||||||
new menuBody[512], b = 0 , start = pos * 7
|
new menuBody[512], b = 0, start = pos * 7
|
||||||
|
|
||||||
if (start >= g_mapNums)
|
if (start >= g_mapNums)
|
||||||
start = pos = g_menuPosition[id] = 0
|
start = pos = g_menuPosition[id] = 0
|
||||||
|
|
||||||
new len = format(menuBody,511, g_coloredMenus ?
|
new len = format(menuBody, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "VOTEMAP_MENU", pos + 1, (g_mapNums / 7 + ((g_mapNums % 7) ? 1 : 0)))
|
||||||
"\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n",
|
|
||||||
id,"VOTEMAP_MENU",pos+1,( g_mapNums / 7 + (( g_mapNums % 7) ? 1 : 0 )) )
|
|
||||||
|
|
||||||
new end = start + 7, keys = MENU_KEY_0
|
new end = start + 7, keys = MENU_KEY_0
|
||||||
|
|
||||||
if (end > g_mapNums)
|
if (end > g_mapNums)
|
||||||
end = g_mapNums
|
end = g_mapNums
|
||||||
|
|
||||||
for (new a = start; a < end; ++a) {
|
for (new a = start; a < end; ++a)
|
||||||
if ( g_voteSelectedNum[id]==4 || isMapSelected( id , pos * 7 + b ) ) {
|
{
|
||||||
|
if (g_voteSelectedNum[id] == 4 || isMapSelected(id, pos * 7 + b))
|
||||||
|
{
|
||||||
++b
|
++b
|
||||||
if ( g_coloredMenus)
|
|
||||||
len += format(menuBody[len],511-len,"\d%d. %s^n\w", b ,g_mapName[ a ])
|
if (g_coloredMenus)
|
||||||
|
len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, g_mapName[a])
|
||||||
else
|
else
|
||||||
len += format(menuBody[len],511-len,"#. %s^n", g_mapName[ a ])
|
len += format(menuBody[len], 511-len, "#. %s^n", g_mapName[a])
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
keys |= (1<<b)
|
keys |= (1<<b)
|
||||||
len += format(menuBody[len],511-len,"%d. %s^n", ++b ,g_mapName[ a ])
|
len += format(menuBody[len], 511-len, "%d. %s^n", ++b, g_mapName[a])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( g_voteSelectedNum[id] ) {
|
if (g_voteSelectedNum[id])
|
||||||
|
{
|
||||||
keys |= MENU_KEY_8
|
keys |= MENU_KEY_8
|
||||||
len += format(menuBody[len],511-len,"^n8. %L^n",id,"START_VOT")
|
len += format(menuBody[len], 511-len, "^n8. %L^n", id, "START_VOT")
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
len += format(menuBody[len],511-len, g_coloredMenus ?
|
len += format(menuBody[len], 511-len, g_coloredMenus ? "^n\d8. %L^n\w" : "^n#. %L^n", id, "START_VOT")
|
||||||
"^n\d8. %L^n\w" : "^n#. %L^n",id,"START_VOT")
|
|
||||||
|
|
||||||
if (end != g_mapNums) {
|
if (end != g_mapNums)
|
||||||
len += format(menuBody[len],511-len,"^n9. %L...^n0. %L^n", id, "MORE", id, pos ? "BACK" : "EXIT")
|
{
|
||||||
|
len += format(menuBody[len], 511-len, "^n9. %L...^n0. %L^n", id, "MORE", id, pos ? "BACK" : "EXIT")
|
||||||
keys |= MENU_KEY_9
|
keys |= MENU_KEY_9
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
len += format(menuBody[len],511-len,"^n0. %L^n", id, pos ? "BACK" : "EXIT")
|
len += format(menuBody[len], 511-len, "^n0. %L^n", id, pos ? "BACK" : "EXIT")
|
||||||
|
|
||||||
if (g_voteSelectedNum[id])
|
if (g_voteSelectedNum[id])
|
||||||
len += format(menuBody[len],511-len, g_coloredMenus ? "^n\y%L:^n\w" : "^n%L:^n",id,"SEL_MAPS")
|
len += format(menuBody[len], 511-len, g_coloredMenus ? "^n\y%L:^n\w" : "^n%L:^n", id, "SEL_MAPS")
|
||||||
else
|
else
|
||||||
len += format(menuBody[len],511-len, "^n^n")
|
len += format(menuBody[len], 511-len, "^n^n")
|
||||||
|
|
||||||
for (new c = 0; c < 4; c++) {
|
for (new c = 0; c < 4; c++)
|
||||||
if ( c < g_voteSelectedNum[id] )
|
{
|
||||||
len += format(menuBody[len],511-len,"%s^n", g_mapName[ g_voteSelected[id][ c ] ] )
|
if (c < g_voteSelectedNum[id])
|
||||||
|
len += format(menuBody[len], 511-len, "%s^n", g_mapName[g_voteSelected[id][c]])
|
||||||
else
|
else
|
||||||
len += format(menuBody[len],511-len,"^n" )
|
len += format(menuBody[len], 511-len, "^n")
|
||||||
}
|
}
|
||||||
|
|
||||||
new menuName[64]
|
new menuName[64]
|
||||||
format(menuName,63,"%L","en","VOTEMAP_MENU")
|
format(menuName, 63, "%L", "en", "VOTEMAP_MENU")
|
||||||
|
|
||||||
show_menu(id,keys,menuBody,-1,menuName)
|
show_menu(id, keys, menuBody, -1, menuName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public cmdVoteMapMenu(id, level, cid)
|
||||||
public cmdVoteMapMenu(id,level,cid) {
|
{
|
||||||
if (!cmd_access(id,level,cid,1))
|
if (!cmd_access(id, level, cid, 1))
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
|
|
||||||
if ( get_cvar_float("amx_last_voting") > get_gametime() ) {
|
if (get_cvar_float("amx_last_voting") > get_gametime())
|
||||||
client_print(id,print_chat,"%L",id,"ALREADY_VOT")
|
{
|
||||||
|
client_print(id, print_chat, "%L", id, "ALREADY_VOT")
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
g_voteSelectedNum[id] = 0
|
g_voteSelectedNum[id] = 0
|
||||||
|
|
||||||
if ( g_mapNums ) {
|
if (g_mapNums)
|
||||||
displayVoteMapsMenu(id,g_menuPosition[id] = 0)
|
{
|
||||||
}
|
displayVoteMapsMenu(id, g_menuPosition[id] = 0)
|
||||||
else {
|
} else {
|
||||||
console_print(id,"%L",id,"NO_MAPS_MENU")
|
console_print(id, "%L", id, "NO_MAPS_MENU")
|
||||||
client_print(id,print_chat,"%L",id,"NO_MAPS_MENU")
|
client_print(id, print_chat, "%L", id, "NO_MAPS_MENU")
|
||||||
}
|
}
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
public cmdMapsMenu(id,level,cid) {
|
public cmdMapsMenu(id, level, cid)
|
||||||
if (!cmd_access(id,level,cid,1))
|
{
|
||||||
|
if (!cmd_access(id, level, cid, 1))
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
|
|
||||||
if ( g_mapNums ) {
|
if (g_mapNums)
|
||||||
displayMapsMenu(id,g_menuPosition[id] = 0)
|
{
|
||||||
}
|
displayMapsMenu(id, g_menuPosition[id] = 0)
|
||||||
else {
|
} else {
|
||||||
console_print(id,"%L",id,"NO_MAPS_MENU")
|
console_print(id, "%L", id, "NO_MAPS_MENU")
|
||||||
client_print(id,print_chat,"%L",id,"NO_MAPS_MENU")
|
client_print(id, print_chat, "%L", id, "NO_MAPS_MENU")
|
||||||
}
|
}
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
public delayedChange(mapname[])
|
public delayedChange(mapname[])
|
||||||
server_cmd("changelevel %s",mapname)
|
server_cmd("changelevel %s", mapname)
|
||||||
|
|
||||||
|
public actionVoteMapMenu(id, key)
|
||||||
public actionVoteMapMenu(id,key) {
|
{
|
||||||
switch (key) {
|
switch (key)
|
||||||
case 7: {
|
{
|
||||||
|
case 7:
|
||||||
|
{
|
||||||
new Float:voting = get_cvar_float("amx_last_voting")
|
new Float:voting = get_cvar_float("amx_last_voting")
|
||||||
if ( voting > get_gametime() ) {
|
|
||||||
client_print(id,print_chat,"%L",id,"ALREADY_VOT")
|
if (voting > get_gametime())
|
||||||
return PLUGIN_HANDLED
|
{
|
||||||
}
|
client_print(id, print_chat, "%L", id, "ALREADY_VOT")
|
||||||
if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime()) {
|
|
||||||
client_print(id,print_chat,"%L",id,"VOT_NOW_ALLOW")
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
g_voteCount = { 0 , 0 , 0 , 0 , 0 }
|
if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime())
|
||||||
|
{
|
||||||
|
client_print(id, print_chat, "%L", id, "VOT_NOW_ALLOW")
|
||||||
|
return PLUGIN_HANDLED
|
||||||
|
}
|
||||||
|
|
||||||
|
g_voteCount = {0, 0, 0, 0, 0}
|
||||||
|
|
||||||
new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0
|
new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0
|
||||||
set_cvar_float("amx_last_voting", get_gametime() + vote_time )
|
set_cvar_float("amx_last_voting", get_gametime() + vote_time)
|
||||||
new iVoteTime = floatround( vote_time )
|
new iVoteTime = floatround(vote_time)
|
||||||
|
|
||||||
set_task( vote_time , "checkVotes",34567 + id)
|
set_task(vote_time, "checkVotes", 34567 + id)
|
||||||
|
|
||||||
new menuBody[512]
|
new menuBody[512]
|
||||||
new players[32]
|
new players[32]
|
||||||
new pnum, keys, len
|
new pnum, keys, len
|
||||||
|
|
||||||
get_players(players,pnum)
|
get_players(players, pnum)
|
||||||
|
|
||||||
if ( g_voteSelectedNum[id] > 1 ) {
|
if (g_voteSelectedNum[id] > 1)
|
||||||
len = format(menuBody,511,g_coloredMenus ?
|
{
|
||||||
"\y%L^n\w^n" : "%L^n^n", id, "WHICH_MAP")
|
len = format(menuBody, 511, g_coloredMenus ? "\y%L^n\w^n" : "%L^n^n", id, "WHICH_MAP")
|
||||||
for (new c = 0; c < g_voteSelectedNum[id] ; ++c) {
|
|
||||||
len += format(menuBody[len],511,"%d. %s^n", c + 1 , g_mapName[ g_voteSelected[id][ c ] ] )
|
for (new c = 0; c < g_voteSelectedNum[id]; ++c)
|
||||||
|
{
|
||||||
|
len += format(menuBody[len], 511, "%d. %s^n", c + 1, g_mapName[g_voteSelected[id][c]])
|
||||||
keys |= (1<<c)
|
keys |= (1<<c)
|
||||||
}
|
}
|
||||||
|
|
||||||
keys |= (1<<8)
|
keys |= (1<<8)
|
||||||
len += format(menuBody[len],511,"^n9. None^n")
|
len += format(menuBody[len], 511, "^n9. None^n")
|
||||||
}
|
} else {
|
||||||
else {
|
len = format(menuBody, 511, g_coloredMenus ? "\y%L^n%s?^n\w^n1. %L^n2. %L^n" : "%L^n%s?^n^n1. %L^n2. %L^n", id, "CHANGE_MAP_TO", g_mapName[g_voteSelected[id][0]], id, "YES", id, "NO")
|
||||||
len = format(menuBody,511, g_coloredMenus ? "\y%L^n%s?^n\w^n1. %L^n2. %L^n"
|
|
||||||
: "%L^n%s?^n^n1. %L^n2. %L^n", id, "CHANGE_MAP_TO", g_mapName[ g_voteSelected[id][ 0 ] ],
|
|
||||||
id, "YES", id, "NO")
|
|
||||||
keys = MENU_KEY_1|MENU_KEY_2
|
keys = MENU_KEY_1|MENU_KEY_2
|
||||||
}
|
}
|
||||||
|
|
||||||
new menuName[64]
|
new menuName[64]
|
||||||
format(menuName,63,"%L","en","WHICH_MAP")
|
format(menuName, 63, "%L", "en", "WHICH_MAP")
|
||||||
|
|
||||||
for (new b = 0; b < pnum; ++b)
|
for (new b = 0; b < pnum; ++b)
|
||||||
if ( players[b] != id )
|
if (players[b] != id)
|
||||||
show_menu(players[b],keys,menuBody, iVoteTime, menuName)
|
show_menu(players[b], keys, menuBody, iVoteTime, menuName)
|
||||||
|
|
||||||
format(menuBody[len],511,"^n0. %L",id,"CANC_VOTE")
|
format(menuBody[len], 511, "^n0. %L", id, "CANC_VOTE")
|
||||||
keys |= MENU_KEY_0
|
keys |= MENU_KEY_0
|
||||||
show_menu(id,keys,menuBody, iVoteTime, menuName)
|
show_menu(id, keys, menuBody, iVoteTime, menuName)
|
||||||
|
|
||||||
new authid[32],name[32]
|
new authid[32], name[32]
|
||||||
get_user_authid(id,authid,31)
|
|
||||||
get_user_name(id,name,31)
|
|
||||||
|
|
||||||
switch (get_cvar_num("amx_show_activity")) {
|
get_user_authid(id, authid, 31)
|
||||||
case 2: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_V_MAP_2",name)
|
get_user_name(id, name, 31)
|
||||||
case 1: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_V_MAP_1")
|
|
||||||
|
switch (get_cvar_num("amx_show_activity"))
|
||||||
|
{
|
||||||
|
case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_V_MAP_2", name)
|
||||||
|
case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_V_MAP_1")
|
||||||
}
|
}
|
||||||
|
|
||||||
log_amx("Vote: ^"%s<%d><%s><>^" vote maps (map#1 ^"%s^") (map#2 ^"%s^") (map#3 ^"%s^") (map#4 ^"%s^")",
|
log_amx("Vote: ^"%s<%d><%s><>^" vote maps (map#1 ^"%s^") (map#2 ^"%s^") (map#3 ^"%s^") (map#4 ^"%s^")",
|
||||||
name,get_user_userid(id),authid,
|
name, get_user_userid(id), authid,
|
||||||
g_voteSelectedNum[id] > 0 ? g_mapName[ g_voteSelected[id][ 0 ] ] : "" ,
|
g_voteSelectedNum[id] > 0 ? g_mapName[g_voteSelected[id][0]] : "",
|
||||||
g_voteSelectedNum[id] > 1 ? g_mapName[ g_voteSelected[id][ 1 ] ] : "" ,
|
g_voteSelectedNum[id] > 1 ? g_mapName[g_voteSelected[id][1]] : "",
|
||||||
g_voteSelectedNum[id] > 2 ? g_mapName[ g_voteSelected[id][ 2 ] ] : "",
|
g_voteSelectedNum[id] > 2 ? g_mapName[g_voteSelected[id][2]] : "",
|
||||||
g_voteSelectedNum[id] > 3 ? g_mapName[ g_voteSelected[id][ 3 ] ] : "")
|
g_voteSelectedNum[id] > 3 ? g_mapName[g_voteSelected[id][3]] : "")
|
||||||
|
}
|
||||||
|
case 8: displayVoteMapsMenu(id, ++g_menuPosition[id])
|
||||||
|
case 9: displayVoteMapsMenu(id, --g_menuPosition[id])
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
g_voteSelected[id][g_voteSelectedNum[id]++] = g_menuPosition[id] * 7 + key
|
||||||
|
displayVoteMapsMenu(id, g_menuPosition[id])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
case 8: displayVoteMapsMenu(id,++g_menuPosition[id])
|
|
||||||
case 9: displayVoteMapsMenu(id,--g_menuPosition[id])
|
|
||||||
default: {
|
|
||||||
g_voteSelected[id][ g_voteSelectedNum[id]++ ] = g_menuPosition[id] * 7 + key
|
|
||||||
|
|
||||||
displayVoteMapsMenu(id,g_menuPosition[id])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public actionMapsMenu(id, key)
|
||||||
public actionMapsMenu(id,key) {
|
{
|
||||||
switch (key) {
|
switch (key)
|
||||||
case 8: displayMapsMenu(id,++g_menuPosition[id])
|
{
|
||||||
case 9: displayMapsMenu(id,--g_menuPosition[id])
|
case 8: displayMapsMenu(id, ++g_menuPosition[id])
|
||||||
|
case 9: displayMapsMenu(id, --g_menuPosition[id])
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
new a = g_menuPosition[id] * 8 + key
|
new a = g_menuPosition[id] * 8 + key
|
||||||
|
|
||||||
new _modName[10]
|
new _modName[10]
|
||||||
get_modname(_modName,9)
|
|
||||||
if (!equal(_modName,"zp")) {
|
get_modname(_modName, 9)
|
||||||
|
if (!equal(_modName, "zp"))
|
||||||
|
{
|
||||||
message_begin(MSG_ALL, SVC_INTERMISSION)
|
message_begin(MSG_ALL, SVC_INTERMISSION)
|
||||||
message_end()
|
message_end()
|
||||||
}
|
}
|
||||||
new authid[32],name[32]
|
|
||||||
get_user_authid(id,authid,31)
|
|
||||||
get_user_name(id,name,31)
|
|
||||||
|
|
||||||
switch (get_cvar_num("amx_show_activity")) {
|
new authid[32], name[32]
|
||||||
case 2: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_CHANGEL_2",name,g_mapName[ a ])
|
|
||||||
case 1: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_CHANGEL_1",g_mapName[ a ])
|
get_user_authid(id, authid, 31)
|
||||||
|
get_user_name(id, name, 31)
|
||||||
|
|
||||||
|
switch (get_cvar_num("amx_show_activity"))
|
||||||
|
{
|
||||||
|
case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_CHANGEL_2", name, g_mapName[a])
|
||||||
|
case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_CHANGEL_1", g_mapName[a])
|
||||||
}
|
}
|
||||||
|
|
||||||
log_amx("Cmd: ^"%s<%d><%s><>^" changelevel ^"%s^"",
|
log_amx("Cmd: ^"%s<%d><%s><>^" changelevel ^"%s^"", name, get_user_userid(id), authid, g_mapName[a])
|
||||||
name,get_user_userid(id),authid, g_mapName[ a ] )
|
set_task(2.0, "delayedChange", 0, g_mapName[a], strlen(g_mapName[a]) + 1)
|
||||||
|
/* displayMapsMenu(id, g_menuPosition[id]) */
|
||||||
set_task(2.0,"delayedChange",0, g_mapName[ a ] , strlen(g_mapName[ a ]) + 1 )
|
|
||||||
|
|
||||||
/* displayMapsMenu(id,g_menuPosition[id]) */
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
displayMapsMenu(id,pos) {
|
displayMapsMenu(id, pos)
|
||||||
|
{
|
||||||
if (pos < 0)
|
if (pos < 0)
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -397,46 +446,46 @@ displayMapsMenu(id,pos) {
|
|||||||
if (start >= g_mapNums)
|
if (start >= g_mapNums)
|
||||||
start = pos = g_menuPosition[id] = 0
|
start = pos = g_menuPosition[id] = 0
|
||||||
|
|
||||||
new len = format(menuBody,511, g_coloredMenus ?
|
new len = format(menuBody, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "CHANGLE_MENU", pos + 1, (g_mapNums / 8 + ((g_mapNums % 8) ? 1 : 0)))
|
||||||
"\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n",
|
|
||||||
id,"CHANGLE_MENU",pos+1,( g_mapNums / 8 + (( g_mapNums % 8) ? 1 : 0 )) )
|
|
||||||
|
|
||||||
new end = start + 8
|
new end = start + 8
|
||||||
new keys = MENU_KEY_0
|
new keys = MENU_KEY_0
|
||||||
|
|
||||||
if (end > g_mapNums)
|
if (end > g_mapNums)
|
||||||
end = g_mapNums
|
end = g_mapNums
|
||||||
|
|
||||||
for (new a = start; a < end; ++a) {
|
for (new a = start; a < end; ++a)
|
||||||
|
{
|
||||||
keys |= (1<<b)
|
keys |= (1<<b)
|
||||||
len += format(menuBody[len],511-len,"%d. %s^n",++b,g_mapName[ a ])
|
len += format(menuBody[len], 511-len, "%d. %s^n", ++b, g_mapName[a])
|
||||||
}
|
}
|
||||||
|
|
||||||
if (end != g_mapNums) {
|
if (end != g_mapNums)
|
||||||
format(menuBody[len],511-len,"^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
|
{
|
||||||
|
format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
|
||||||
keys |= MENU_KEY_9
|
keys |= MENU_KEY_9
|
||||||
}
|
}
|
||||||
else format(menuBody[len],511-len,"^n0. %L", id, pos ? "BACK" : "EXIT")
|
else
|
||||||
|
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
|
||||||
|
|
||||||
new menuName[64]
|
new menuName[64]
|
||||||
format(menuName,63,"%L","en","CHANGLE_MENU")
|
format(menuName, 63, "%L", "en", "CHANGLE_MENU")
|
||||||
|
|
||||||
show_menu(id,keys,menuBody,-1,menuName)
|
show_menu(id, keys, menuBody, -1, menuName)
|
||||||
}
|
}
|
||||||
|
|
||||||
load_settings(filename[]) {
|
load_settings(filename[])
|
||||||
|
{
|
||||||
if (!file_exists(filename))
|
if (!file_exists(filename))
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
new text[256]
|
new text[256]
|
||||||
new a , pos = 0
|
new a, pos = 0
|
||||||
|
|
||||||
while ( g_mapNums < MAX_MAPS && read_file(filename,pos++,text,255,a) ) {
|
while (g_mapNums < MAX_MAPS && read_file(filename, pos++, text, 255, a))
|
||||||
if ( text[0] == ';' ) continue
|
{
|
||||||
|
if (text[0] == ';') continue
|
||||||
if ( parse(text,g_mapName[g_mapNums],31) < 1 ) continue
|
if (parse(text, g_mapName[g_mapNums], 31) < 1) continue
|
||||||
|
if (!is_map_valid(g_mapName[g_mapNums])) continue
|
||||||
if ( !is_map_valid( g_mapName[g_mapNums] ) ) continue
|
|
||||||
|
|
||||||
g_mapNums++
|
g_mapNums++
|
||||||
}
|
}
|
||||||
|
@ -63,55 +63,68 @@ new g_clientMenuPlugin[MAXMENUS][STRINGSIZE]
|
|||||||
// menuCmd: Command that should be executed to start menu
|
// menuCmd: Command that should be executed to start menu
|
||||||
// menuAccess: Access required for menu
|
// menuAccess: Access required for menu
|
||||||
// menuPlugin: The exact case-insensitive name of plugin holding the menu command
|
// menuPlugin: The exact case-insensitive name of plugin holding the menu command
|
||||||
public AddMenu(const menuBody[], const menuCmd[], const menuAccess, const menuPlugin[]) {
|
public AddMenu(const menuBody[], const menuCmd[], const menuAccess, const menuPlugin[])
|
||||||
if (g_menusNumber + 1 == MAXMENUS) {
|
{
|
||||||
|
if (g_menusNumber + 1 == MAXMENUS)
|
||||||
|
{
|
||||||
log_amx("Error: Plugin ^"%s^" tried to add a menu item to Menu Front-End plugin with maximum menu items reached!", menuPlugin)
|
log_amx("Error: Plugin ^"%s^" tried to add a menu item to Menu Front-End plugin with maximum menu items reached!", menuPlugin)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
copy(g_menuBody[g_menusNumber], STRINGLENGTH, menuBody)
|
copy(g_menuBody[g_menusNumber], STRINGLENGTH, menuBody)
|
||||||
g_menuBodyPhrase[g_menusNumber] = false
|
g_menuBodyPhrase[g_menusNumber] = false
|
||||||
|
|
||||||
copy(g_menuCmd[g_menusNumber], STRINGLENGTH, menuCmd)
|
copy(g_menuCmd[g_menusNumber], STRINGLENGTH, menuCmd)
|
||||||
g_menuAccess[g_menusNumber] = menuAccess
|
g_menuAccess[g_menusNumber] = menuAccess
|
||||||
|
|
||||||
copy(g_menuPlugin[g_menusNumber], STRINGLENGTH, menuPlugin)
|
copy(g_menuPlugin[g_menusNumber], STRINGLENGTH, menuPlugin)
|
||||||
|
|
||||||
g_menusNumber++
|
g_menusNumber++
|
||||||
|
|
||||||
server_print("Menu item %d added to Menus Front-End: ^"%s^" from plugin ^"%s^"", g_menusNumber, menuBody, menuPlugin)
|
server_print("Menu item %d added to Menus Front-End: ^"%s^" from plugin ^"%s^"", g_menusNumber, menuBody, menuPlugin)
|
||||||
}
|
}
|
||||||
public AddMenuLang(const menuBody[], const menuCmd[], const menuAccess, const menuPlugin[]) {
|
|
||||||
if (g_menusNumber + 1 == MAXMENUS) {
|
public AddMenuLang(const menuBody[], const menuCmd[], const menuAccess, const menuPlugin[])
|
||||||
|
{
|
||||||
|
if (g_menusNumber + 1 == MAXMENUS)
|
||||||
|
{
|
||||||
log_amx("Error: Plugin ^"%s^" tried to add a menu item to Menu Front-End plugin with maximum menu items reached!", menuPlugin)
|
log_amx("Error: Plugin ^"%s^" tried to add a menu item to Menu Front-End plugin with maximum menu items reached!", menuPlugin)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
copy(g_menuBody[g_menusNumber], STRINGLENGTH, menuBody)
|
copy(g_menuBody[g_menusNumber], STRINGLENGTH, menuBody)
|
||||||
g_menuBodyPhrase[g_menusNumber] = true
|
g_menuBodyPhrase[g_menusNumber] = true
|
||||||
|
|
||||||
copy(g_menuCmd[g_menusNumber], STRINGLENGTH, menuCmd)
|
copy(g_menuCmd[g_menusNumber], STRINGLENGTH, menuCmd)
|
||||||
g_menuAccess[g_menusNumber] = menuAccess
|
g_menuAccess[g_menusNumber] = menuAccess
|
||||||
|
|
||||||
copy(g_menuPlugin[g_menusNumber], STRINGLENGTH, menuPlugin)
|
copy(g_menuPlugin[g_menusNumber], STRINGLENGTH, menuPlugin)
|
||||||
g_menusNumber++
|
g_menusNumber++
|
||||||
|
|
||||||
//server_print("Menu item %d added to Menus Front-End: ^"%s^" (LANG) from plugin ^"%s^"", g_menusNumber, menuBody, menuPlugin)
|
//server_print("Menu item %d added to Menus Front-End: ^"%s^" (LANG) from plugin ^"%s^"", g_menusNumber, menuBody, menuPlugin)
|
||||||
}
|
}
|
||||||
public AddClientMenu(const menuBody[], const menuCmd[], const menuAccess, const menuPlugin[]) {
|
|
||||||
if (g_clientMenusNumber + 1 == MAXMENUS) {
|
public AddClientMenu(const menuBody[], const menuCmd[], const menuAccess, const menuPlugin[])
|
||||||
|
{
|
||||||
|
if (g_clientMenusNumber + 1 == MAXMENUS)
|
||||||
|
{
|
||||||
log_amx("Error: Plugin ^"%s^" tried to add a menu item to Menu Front-End plugin with maximum menu items reached!", menuPlugin)
|
log_amx("Error: Plugin ^"%s^" tried to add a menu item to Menu Front-End plugin with maximum menu items reached!", menuPlugin)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
copy(g_clientMenuBody[g_clientMenusNumber], STRINGLENGTH, menuBody)
|
copy(g_clientMenuBody[g_clientMenusNumber], STRINGLENGTH, menuBody)
|
||||||
g_clientMenuBodyPhrase[g_clientMenusNumber] = false
|
g_clientMenuBodyPhrase[g_clientMenusNumber] = false
|
||||||
|
|
||||||
copy(g_clientMenuCmd[g_clientMenusNumber], STRINGLENGTH, menuCmd)
|
copy(g_clientMenuCmd[g_clientMenusNumber], STRINGLENGTH, menuCmd)
|
||||||
g_clientMenuAccess[g_clientMenusNumber] = menuAccess
|
g_clientMenuAccess[g_clientMenusNumber] = menuAccess
|
||||||
|
|
||||||
copy(g_clientMenuPlugin[g_clientMenusNumber], STRINGLENGTH, menuPlugin)
|
copy(g_clientMenuPlugin[g_clientMenusNumber], STRINGLENGTH, menuPlugin)
|
||||||
|
|
||||||
g_clientMenusNumber++
|
g_clientMenusNumber++
|
||||||
|
|
||||||
server_print("Client menu item %d added to Client Menus Front-End: ^"%s^" from plugin ^"%s^"", g_clientMenusNumber, menuBody, menuPlugin)
|
server_print("Client menu item %d added to Client Menus Front-End: ^"%s^" from plugin ^"%s^"", g_clientMenusNumber, menuBody, menuPlugin)
|
||||||
}
|
}
|
||||||
|
|
||||||
AddDefaultMenus() {
|
AddDefaultMenus()
|
||||||
|
{
|
||||||
AddMenuLang("KICK_PLAYER", "amx_kickmenu", ADMIN_KICK, "Players Menu")
|
AddMenuLang("KICK_PLAYER", "amx_kickmenu", ADMIN_KICK, "Players Menu")
|
||||||
AddMenuLang("BAN_PLAYER", "amx_banmenu", ADMIN_BAN, "Players Menu")
|
AddMenuLang("BAN_PLAYER", "amx_banmenu", ADMIN_BAN, "Players Menu")
|
||||||
AddMenuLang("SLAP_SLAY", "amx_slapmenu", ADMIN_SLAY, "Players Menu")
|
AddMenuLang("SLAP_SLAY", "amx_slapmenu", ADMIN_SLAY, "Players Menu")
|
||||||
@ -130,24 +143,32 @@ AddDefaultMenus() {
|
|||||||
AddMenuLang("TELE_PLAYER", "amx_teleportmenu", ADMIN_LEVEL_A, "Teleport Menu")
|
AddMenuLang("TELE_PLAYER", "amx_teleportmenu", ADMIN_LEVEL_A, "Teleport Menu")
|
||||||
}
|
}
|
||||||
|
|
||||||
public actionMenu(id,key) {
|
public actionMenu(id, key)
|
||||||
switch (key) {
|
{
|
||||||
case 8: displayMenu(id,++g_menuPosition[id])
|
switch (key)
|
||||||
case 9: displayMenu(id,--g_menuPosition[id])
|
{
|
||||||
default: client_cmd(id, g_menuCmd[ g_menuPosition[id] * 8 + key ] )
|
case 8: displayMenu(id, ++g_menuPosition[id])
|
||||||
}
|
case 9: displayMenu(id, --g_menuPosition[id])
|
||||||
return PLUGIN_HANDLED
|
default: client_cmd(id, g_menuCmd[g_menuPosition[id] * 8 + key])
|
||||||
}
|
|
||||||
public clientActionMenu(id,key) {
|
|
||||||
switch (key) {
|
|
||||||
case 8: clientDisplayMenu(id, ++g_clientMenuPosition[id])
|
|
||||||
case 9: clientDisplayMenu(id, --g_clientMenuPosition[id])
|
|
||||||
default: client_cmd(id, g_clientMenuCmd[ g_clientMenuPosition[id] * 8 + key ])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
displayMenu(id, pos) {
|
public clientActionMenu(id, key)
|
||||||
|
{
|
||||||
|
switch (key)
|
||||||
|
{
|
||||||
|
case 8: clientDisplayMenu(id, ++g_clientMenuPosition[id])
|
||||||
|
case 9: clientDisplayMenu(id, --g_clientMenuPosition[id])
|
||||||
|
default: client_cmd(id, g_clientMenuCmd[g_clientMenuPosition[id] * 8 + key])
|
||||||
|
}
|
||||||
|
|
||||||
|
return PLUGIN_HANDLED
|
||||||
|
}
|
||||||
|
|
||||||
|
displayMenu(id, pos)
|
||||||
|
{
|
||||||
if (pos < 0)
|
if (pos < 0)
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -155,127 +176,139 @@ displayMenu(id, pos) {
|
|||||||
new b = 0
|
new b = 0
|
||||||
new start = pos * MENUITEMSPERPAGE
|
new start = pos * MENUITEMSPERPAGE
|
||||||
|
|
||||||
if ( start >= g_menusNumber ) // MENUS_NUMBER
|
if (start >= g_menusNumber) // MENUS_NUMBER
|
||||||
start = pos = g_menuPosition[id] = 0
|
start = pos = g_menuPosition[id] = 0
|
||||||
|
|
||||||
new len = format(menuBody,511,
|
new len = format(menuBody, 511,
|
||||||
g_coloredMenus ? "\yAMX Mod X Menu\R%d/%d^n\w^n" : "AMX Mod X Menu %d/%d^n^n" , pos+1, (g_menusNumber / MENUITEMSPERPAGE) + (((g_menusNumber % MENUITEMSPERPAGE) > 0) ? 1 : 0))
|
|
||||||
|
g_coloredMenus ? "\yAMX Mod X Menu\R%d/%d^n\w^n" : "AMX Mod X Menu %d/%d^n^n" , pos + 1, (g_menusNumber / MENUITEMSPERPAGE) + (((g_menusNumber % MENUITEMSPERPAGE) > 0) ? 1 : 0))
|
||||||
|
|
||||||
new end = start + MENUITEMSPERPAGE
|
new end = start + MENUITEMSPERPAGE
|
||||||
new keys = MENU_KEY_0
|
new keys = MENU_KEY_0
|
||||||
|
|
||||||
if (end > g_menusNumber ) // MENUS_NUMBER
|
if (end > g_menusNumber) // MENUS_NUMBER
|
||||||
end = g_menusNumber // MENUS_NUMBER
|
end = g_menusNumber // MENUS_NUMBER
|
||||||
|
|
||||||
new flags = get_user_flags(id)
|
new flags = get_user_flags(id)
|
||||||
|
|
||||||
for (new a = start; a < end; ++a) {
|
for (new a = start; a < end; ++a)
|
||||||
if ( (flags & g_menuAccess[a]) && ( is_plugin_loaded(g_menuPlugin[a])!=-1 ) ) {
|
{
|
||||||
|
if ((flags & g_menuAccess[a]) && (is_plugin_loaded(g_menuPlugin[a]) != -1))
|
||||||
|
{
|
||||||
keys |= (1<<b)
|
keys |= (1<<b)
|
||||||
|
|
||||||
if (g_menuBodyPhrase[a])
|
if (g_menuBodyPhrase[a])
|
||||||
len += format(menuBody[len],511-len,"%d. %L^n",++b, id, g_menuBody[ a ] )
|
len += format(menuBody[len], 511-len, "%d. %L^n", ++b, id, g_menuBody[a])
|
||||||
else
|
else
|
||||||
len += format(menuBody[len],511-len,"%d. %s^n",++b, g_menuBody[ a ] )
|
len += format(menuBody[len], 511-len, "%d. %s^n", ++b, g_menuBody[a])
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
++b
|
++b
|
||||||
if ( g_coloredMenus ) {
|
|
||||||
|
if (g_coloredMenus)
|
||||||
|
{
|
||||||
if (g_menuBodyPhrase[a])
|
if (g_menuBodyPhrase[a])
|
||||||
len += format(menuBody[len],511-len, "\d%d. %L^n\w",b, id, g_menuBody[ a ] )
|
len += format(menuBody[len], 511-len, "\d%d. %L^n\w", b, id, g_menuBody[a])
|
||||||
else
|
else
|
||||||
len += format(menuBody[len],511-len, "\d%d. %s^n\w",b, g_menuBody[ a ] )
|
len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, g_menuBody[a])
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (g_menuBodyPhrase[a])
|
if (g_menuBodyPhrase[a])
|
||||||
len += format(menuBody[len],511-len, "#. %L^n", id, g_menuBody[ a ] )
|
len += format(menuBody[len], 511-len, "#. %L^n", id, g_menuBody[a])
|
||||||
else
|
else
|
||||||
len += format(menuBody[len],511-len, "#. %s^n", g_menuBody[ a ] )
|
len += format(menuBody[len], 511-len, "#. %s^n", g_menuBody[a])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (end != g_menusNumber ) { // MENUS_NUMBER
|
if (end != g_menusNumber) // MENUS_NUMBER
|
||||||
format(menuBody[len],511-len,"^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
|
{
|
||||||
|
format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
|
||||||
keys |= MENU_KEY_9
|
keys |= MENU_KEY_9
|
||||||
}
|
} else {
|
||||||
else {
|
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
|
||||||
format(menuBody[len],511-len,"^n0. %L", id, pos ? "BACK" : "EXIT")
|
|
||||||
}
|
|
||||||
|
|
||||||
show_menu(id,keys,menuBody)
|
|
||||||
}
|
|
||||||
clientDisplayMenu(id,pos) {
|
|
||||||
if (pos < 0)
|
|
||||||
return
|
|
||||||
|
|
||||||
new menuBody[512]
|
|
||||||
new b = 0
|
|
||||||
new start = pos * MENUITEMSPERPAGE
|
|
||||||
|
|
||||||
if ( start >= g_clientMenusNumber ) // MENUS_NUMBER
|
|
||||||
start = pos = g_clientMenuPosition[id] = 0
|
|
||||||
|
|
||||||
new len = format(menuBody,511,
|
|
||||||
g_coloredMenus ? "\yAMX Mod X Client Menu\R%d/%d^n\w^n" : "AMX Mod X Client Menu %d/%d^n^n" , pos+1, (g_clientMenusNumber / MENUITEMSPERPAGE) + (((g_clientMenusNumber % MENUITEMSPERPAGE) > 0) ? 1 : 0))
|
|
||||||
|
|
||||||
new end = start + MENUITEMSPERPAGE
|
|
||||||
new keys = MENU_KEY_0
|
|
||||||
|
|
||||||
if (end > g_clientMenusNumber ) // MENUS_NUMBER
|
|
||||||
end = g_clientMenusNumber // MENUS_NUMBER
|
|
||||||
|
|
||||||
new flags = get_user_flags(id)
|
|
||||||
|
|
||||||
for (new a = start; a < end; ++a) {
|
|
||||||
if ( (flags & g_clientMenuAccess[a]) && ( is_plugin_loaded(g_clientMenuPlugin[a])!=-1 ) ) {
|
|
||||||
keys |= (1<<b)
|
|
||||||
if (g_clientMenuBodyPhrase[a])
|
|
||||||
len += format(menuBody[len],511-len,"%d. %L^n",++b, id, g_clientMenuBody[ a ] )
|
|
||||||
else
|
|
||||||
len += format(menuBody[len],511-len,"%d. %s^n",++b, g_clientMenuBody[ a ] )
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
++b
|
|
||||||
if ( g_coloredMenus ) {
|
|
||||||
if (g_clientMenuBodyPhrase[a])
|
|
||||||
len += format(menuBody[len],511-len, "\d%d. %L^n\w",b, id, g_clientMenuBody[ a ] )
|
|
||||||
else
|
|
||||||
len += format(menuBody[len],511-len, "\d%d. %s^n\w",b, g_clientMenuBody[ a ] )
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (g_clientMenuBodyPhrase[a])
|
|
||||||
len += format(menuBody[len],511-len, "#. %L^n", id, g_clientMenuBody[ a ] )
|
|
||||||
else
|
|
||||||
len += format(menuBody[len],511-len, "#. %s^n", g_clientMenuBody[ a ] )
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (end != g_clientMenusNumber ) { // MENUS_NUMBER
|
|
||||||
format(menuBody[len],511-len,"^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
|
|
||||||
keys |= MENU_KEY_9
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
format(menuBody[len],511-len,"^n0. %L", id, pos ? "BACK" : "EXIT")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
show_menu(id, keys, menuBody)
|
show_menu(id, keys, menuBody)
|
||||||
}
|
}
|
||||||
|
|
||||||
public cmdMenu(id,level,cid) {
|
clientDisplayMenu(id, pos)
|
||||||
if (cmd_access(id,level,cid,1))
|
{
|
||||||
|
if (pos < 0)
|
||||||
|
return
|
||||||
|
|
||||||
|
new menuBody[512]
|
||||||
|
new b = 0
|
||||||
|
new start = pos * MENUITEMSPERPAGE
|
||||||
|
|
||||||
|
if (start >= g_clientMenusNumber) // MENUS_NUMBER
|
||||||
|
start = pos = g_clientMenuPosition[id] = 0
|
||||||
|
|
||||||
|
new len = format(menuBody, 511, g_coloredMenus ? "\yAMX Mod X Client Menu\R%d/%d^n\w^n" : "AMX Mod X Client Menu %d/%d^n^n" , pos + 1, (g_clientMenusNumber / MENUITEMSPERPAGE) + (((g_clientMenusNumber % MENUITEMSPERPAGE) > 0) ? 1 : 0))
|
||||||
|
|
||||||
|
new end = start + MENUITEMSPERPAGE
|
||||||
|
new keys = MENU_KEY_0
|
||||||
|
|
||||||
|
if (end > g_clientMenusNumber) // MENUS_NUMBER
|
||||||
|
end = g_clientMenusNumber // MENUS_NUMBER
|
||||||
|
|
||||||
|
new flags = get_user_flags(id)
|
||||||
|
|
||||||
|
for (new a = start; a < end; ++a)
|
||||||
|
{
|
||||||
|
if ((flags & g_clientMenuAccess[a]) && (is_plugin_loaded(g_clientMenuPlugin[a]) != -1))
|
||||||
|
{
|
||||||
|
keys |= (1<<b)
|
||||||
|
|
||||||
|
if (g_clientMenuBodyPhrase[a])
|
||||||
|
len += format(menuBody[len], 511-len, "%d. %L^n", ++b, id, g_clientMenuBody[a])
|
||||||
|
else
|
||||||
|
len += format(menuBody[len], 511-len, "%d. %s^n", ++b, g_clientMenuBody[a])
|
||||||
|
} else {
|
||||||
|
++b
|
||||||
|
|
||||||
|
if (g_coloredMenus)
|
||||||
|
{
|
||||||
|
if (g_clientMenuBodyPhrase[a])
|
||||||
|
len += format(menuBody[len], 511-len, "\d%d. %L^n\w", b, id, g_clientMenuBody[a])
|
||||||
|
else
|
||||||
|
len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, g_clientMenuBody[a])
|
||||||
|
} else {
|
||||||
|
if (g_clientMenuBodyPhrase[a])
|
||||||
|
len += format(menuBody[len], 511-len, "#. %L^n", id, g_clientMenuBody[a])
|
||||||
|
else
|
||||||
|
len += format(menuBody[len], 511-len, "#. %s^n", g_clientMenuBody[a])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (end != g_clientMenusNumber) // MENUS_NUMBER
|
||||||
|
{
|
||||||
|
format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
|
||||||
|
keys |= MENU_KEY_9
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
|
||||||
|
}
|
||||||
|
|
||||||
|
show_menu(id, keys, menuBody)
|
||||||
|
}
|
||||||
|
|
||||||
|
public cmdMenu(id, level, cid)
|
||||||
|
{
|
||||||
|
if (cmd_access(id, level, cid, 1))
|
||||||
displayMenu(id, g_menuPosition[id] = 0)
|
displayMenu(id, g_menuPosition[id] = 0)
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
public clientCmdMenu(id,level,cid) {
|
public clientCmdMenu(id, level, cid)
|
||||||
|
{
|
||||||
if (cmd_access(id, level, cid, 1))
|
if (cmd_access(id, level, cid, 1))
|
||||||
clientDisplayMenu(id, g_clientMenuPosition[id] = 0)
|
clientDisplayMenu(id, g_clientMenuPosition[id] = 0)
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
public addmenuitem_cmd(id, level, cid) {
|
public addmenuitem_cmd(id, level, cid)
|
||||||
|
{
|
||||||
if (!cmd_access(id, level, cid, 5))
|
if (!cmd_access(id, level, cid, 5))
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
|
|
||||||
@ -287,12 +320,13 @@ public addmenuitem_cmd(id, level, cid) {
|
|||||||
menuAccess = read_flags(flags)
|
menuAccess = read_flags(flags)
|
||||||
read_argv(4, menuPlugin, STRINGLENGTH)
|
read_argv(4, menuPlugin, STRINGLENGTH)
|
||||||
|
|
||||||
|
|
||||||
AddMenu(menuBody, menuCmd, menuAccess, menuPlugin)
|
AddMenu(menuBody, menuCmd, menuAccess, menuPlugin)
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
public addclientmenuitem_cmd(id, level, cid) {
|
|
||||||
|
public addclientmenuitem_cmd(id, level, cid)
|
||||||
|
{
|
||||||
if (!cmd_access(id, level, cid, 5))
|
if (!cmd_access(id, level, cid, 5))
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
|
|
||||||
@ -304,15 +338,14 @@ public addclientmenuitem_cmd(id, level, cid) {
|
|||||||
menuAccess = read_flags(flags)
|
menuAccess = read_flags(flags)
|
||||||
read_argv(4, menuPlugin, STRINGLENGTH)
|
read_argv(4, menuPlugin, STRINGLENGTH)
|
||||||
|
|
||||||
|
|
||||||
AddClientMenu(menuBody, menuCmd, menuAccess, menuPlugin)
|
AddClientMenu(menuBody, menuCmd, menuAccess, menuPlugin)
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
public plugin_init() {
|
public plugin_init()
|
||||||
register_plugin("Menus Front-End",AMXX_VERSION_STR,"AMXX Dev Team")
|
{
|
||||||
|
register_plugin("Menus Front-End", AMXX_VERSION_STR, "AMXX Dev Team")
|
||||||
register_dictionary("menufront.txt")
|
register_dictionary("menufront.txt")
|
||||||
register_dictionary("common.txt")
|
register_dictionary("common.txt")
|
||||||
|
|
||||||
|
@ -43,26 +43,29 @@ new g_coloredMenus
|
|||||||
|
|
||||||
public plugin_init()
|
public plugin_init()
|
||||||
{
|
{
|
||||||
register_plugin("Multi-Lingual System",AMXX_VERSION_STR,"AMXX Dev Team")
|
register_plugin("Multi-Lingual System", AMXX_VERSION_STR, "AMXX Dev Team")
|
||||||
register_dictionary("multilingual.txt")
|
register_dictionary("multilingual.txt")
|
||||||
register_dictionary("common.txt")
|
register_dictionary("common.txt")
|
||||||
register_dictionary("languages.txt")
|
register_dictionary("languages.txt")
|
||||||
register_cvar("amx_language","en",FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_SPONLY)
|
|
||||||
|
register_cvar("amx_language", "en", FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_SPONLY)
|
||||||
//Set to zero to disable client effects
|
//Set to zero to disable client effects
|
||||||
register_cvar("amx_client_languages", "1")
|
register_cvar("amx_client_languages", "1")
|
||||||
register_concmd("amx_setlang","cmdLang",ADMIN_CFG,"<language>")
|
register_concmd("amx_setlang", "cmdLang", ADMIN_CFG, "<language>")
|
||||||
register_clcmd("amx_langmenu","cmdLangMenu",ADMIN_ALL)
|
register_clcmd("amx_langmenu", "cmdLangMenu", ADMIN_ALL)
|
||||||
register_menu("Language Menu",1023,"actionMenu")
|
register_menu("Language Menu", 1023, "actionMenu")
|
||||||
|
|
||||||
new lang[3]
|
new lang[3]
|
||||||
if ( vaultdata_exists("server_language") ) {
|
|
||||||
get_vaultdata("server_language",lang,2)
|
if (vaultdata_exists("server_language"))
|
||||||
|
{
|
||||||
|
get_vaultdata("server_language", lang, 2)
|
||||||
|
} else {
|
||||||
|
copy(lang, 2, "en")
|
||||||
|
set_vaultdata("server_language", lang)
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
copy(lang,2,"en")
|
set_cvar_string("amx_language", lang)
|
||||||
set_vaultdata("server_language",lang)
|
|
||||||
}
|
|
||||||
set_cvar_string("amx_language",lang)
|
|
||||||
|
|
||||||
g_langNum = get_langsnum()
|
g_langNum = get_langsnum()
|
||||||
g_serverLang = get_lang_id(lang)
|
g_serverLang = get_lang_id(lang)
|
||||||
@ -70,42 +73,46 @@ public plugin_init()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined DISPLAY_MSG
|
#if defined DISPLAY_MSG
|
||||||
public client_putinserver(id) {
|
public client_putinserver(id)
|
||||||
|
{
|
||||||
if (get_cvar_num("amx_client_languages") && !is_user_bot(id))
|
if (get_cvar_num("amx_client_languages") && !is_user_bot(id))
|
||||||
set_task(10.0,"dispInfo",id)
|
set_task(10.0, "dispInfo", id)
|
||||||
}
|
}
|
||||||
|
|
||||||
public client_disconnect(id) {
|
public client_disconnect(id)
|
||||||
|
{
|
||||||
remove_task(id)
|
remove_task(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
public dispInfo(id)
|
public dispInfo(id)
|
||||||
{
|
{
|
||||||
if (get_cvar_num("amx_client_languages"))
|
if (get_cvar_num("amx_client_languages"))
|
||||||
client_print(id,print_chat,"%L",id,"TYPE_LANGMENU")
|
client_print(id, print_chat, "%L", id, "TYPE_LANGMENU")
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public cmdLang(id,level,cid) {
|
public cmdLang(id, level, cid)
|
||||||
if (!cmd_access(id,level,cid,2))
|
{
|
||||||
|
if (!cmd_access(id, level, cid, 2))
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
|
|
||||||
new arg[3]
|
new arg[3]
|
||||||
read_argv(1,arg,2)
|
read_argv(1, arg, 2)
|
||||||
|
|
||||||
if ( !lang_exists(arg) ) {
|
if (!lang_exists(arg))
|
||||||
console_print(id,"[AMXX] %L",id,"LANG_NOT_EXISTS")
|
{
|
||||||
|
console_print(id, "[AMXX] %L", id, "LANG_NOT_EXISTS")
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
set_vaultdata("server_language",arg)
|
set_vaultdata("server_language", arg)
|
||||||
set_cvar_string("amx_language",arg)
|
set_cvar_string("amx_language", arg)
|
||||||
g_serverLang = get_lang_id(arg)
|
g_serverLang = get_lang_id(arg)
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
public cmdLangMenu(id,level,cid)
|
public cmdLangMenu(id, level, cid)
|
||||||
{
|
{
|
||||||
new buffer[3]
|
new buffer[3]
|
||||||
|
|
||||||
@ -115,8 +122,7 @@ public cmdLangMenu(id,level,cid)
|
|||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
get_user_info(id,"lang",buffer,2)
|
get_user_info(id, "lang", buffer, 2)
|
||||||
|
|
||||||
g_menuLang[id][0] = get_lang_id(buffer)
|
g_menuLang[id][0] = get_lang_id(buffer)
|
||||||
g_menuLang[id][1] = g_serverLang
|
g_menuLang[id][1] = g_serverLang
|
||||||
|
|
||||||
@ -129,79 +135,94 @@ showMenu(id)
|
|||||||
{
|
{
|
||||||
if (!get_cvar_num("amx_client_languages"))
|
if (!get_cvar_num("amx_client_languages"))
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
new menuBody[512],pLang[3]
|
|
||||||
|
|
||||||
get_lang(g_menuLang[id][0],pLang)
|
new menuBody[512], pLang[3]
|
||||||
|
|
||||||
new len = format( menuBody,511,(g_coloredMenus ? "\y%L\w^n^n" : "%L^n^n"),id,"LANG_MENU" )
|
get_lang(g_menuLang[id][0], pLang)
|
||||||
len += format( menuBody[len],511-len,(g_coloredMenus ? "1. %L\R\r%L\w^n" : "1. %L %L^n"),id,"PERSO_LANG",pLang,"LANG_NAME" )
|
|
||||||
|
|
||||||
if ( access(id,ADMIN_CFG) ) {
|
new len = format(menuBody, 511, (g_coloredMenus ? "\y%L\w^n^n" : "%L^n^n"), id, "LANG_MENU")
|
||||||
|
|
||||||
|
len += format(menuBody[len], 511-len, (g_coloredMenus ? "1. %L\R\r%L\w^n" : "1. %L %L^n"), id, "PERSO_LANG", pLang, "LANG_NAME")
|
||||||
|
|
||||||
|
if (access(id, ADMIN_CFG))
|
||||||
|
{
|
||||||
new sLang[3]
|
new sLang[3]
|
||||||
get_lang(g_menuLang[id][1],sLang)
|
|
||||||
len += format( menuBody[len],511-len,(g_coloredMenus ? "2. %L\R\r%L\w^n^n" : "2. %L %L^n^n"),id,"SERVER_LANG",sLang,"LANG_NAME" )
|
|
||||||
len += format( menuBody[len],511-len,"3. %L",id,"SAVE_LANG" )
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
len += format( menuBody[len],511-len,"^n2. %L",id,"SAVE_LANG" )
|
|
||||||
}
|
|
||||||
format( menuBody[len],511-len,"^n^n0. %L",id,"EXIT" )
|
|
||||||
|
|
||||||
show_menu(id,MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3,menuBody,-1,"Language Menu")
|
get_lang(g_menuLang[id][1], sLang)
|
||||||
|
len += format(menuBody[len], 511-len, (g_coloredMenus ? "2. %L\R\r%L\w^n^n" : "2. %L %L^n^n"), id, "SERVER_LANG", sLang, "LANG_NAME")
|
||||||
|
len += format(menuBody[len], 511-len, "3. %L", id, "SAVE_LANG")
|
||||||
|
} else {
|
||||||
|
len += format(menuBody[len], 511-len, "^n2. %L", id, "SAVE_LANG")
|
||||||
|
}
|
||||||
|
|
||||||
|
format(menuBody[len], 511-len, "^n^n0. %L", id, "EXIT")
|
||||||
|
|
||||||
|
show_menu(id, MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3, menuBody, -1, "Language Menu")
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
public actionMenu(id,key) {
|
public actionMenu(id, key)
|
||||||
|
{
|
||||||
if (!get_cvar_num("amx_client_languages"))
|
if (!get_cvar_num("amx_client_languages"))
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
new isAdmin = access(id,ADMIN_CFG)
|
new isAdmin = access(id, ADMIN_CFG)
|
||||||
|
|
||||||
if ( key==0 ) {
|
if (key == 0)
|
||||||
if ( g_menuLang[id][0]<(g_langNum-1) )
|
{
|
||||||
|
if (g_menuLang[id][0] < (g_langNum-1))
|
||||||
g_menuLang[id][0]++
|
g_menuLang[id][0]++
|
||||||
else
|
else
|
||||||
g_menuLang[id][0] = 0
|
g_menuLang[id][0] = 0
|
||||||
|
|
||||||
showMenu(id)
|
showMenu(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isAdmin && (key==1) ) {
|
if (isAdmin && (key == 1))
|
||||||
if ( g_menuLang[id][1]<(g_langNum-1) )
|
{
|
||||||
|
if (g_menuLang[id][1] < (g_langNum - 1))
|
||||||
g_menuLang[id][1]++
|
g_menuLang[id][1]++
|
||||||
else
|
else
|
||||||
g_menuLang[id][1] = 0
|
g_menuLang[id][1] = 0
|
||||||
|
|
||||||
showMenu(id)
|
showMenu(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
new pLang[3],pLang_old[3],sLang[3],sLang_old[3],lName[64]
|
new pLang[3], pLang_old[3], sLang[3], sLang_old[3], lName[64]
|
||||||
get_lang(g_menuLang[id][0],pLang)
|
|
||||||
get_lang(g_menuLang[id][1],sLang)
|
|
||||||
get_user_info(id,"lang",pLang_old,2)
|
|
||||||
get_lang(g_serverLang,sLang_old)
|
|
||||||
|
|
||||||
if ( isAdmin && (key==2) && !equali(sLang,sLang_old) ) {
|
get_lang(g_menuLang[id][0], pLang)
|
||||||
set_vaultdata("server_language",sLang)
|
get_lang(g_menuLang[id][1], sLang)
|
||||||
set_cvar_string("amx_language",sLang)
|
get_user_info(id, "lang", pLang_old, 2)
|
||||||
|
get_lang(g_serverLang, sLang_old)
|
||||||
|
|
||||||
|
if (isAdmin && (key == 2) && !equali(sLang, sLang_old))
|
||||||
|
{
|
||||||
|
set_vaultdata("server_language", sLang)
|
||||||
|
set_cvar_string("amx_language", sLang)
|
||||||
g_serverLang = g_menuLang[id][1]
|
g_serverLang = g_menuLang[id][1]
|
||||||
format(lName,63,"%L",sLang,"LANG_NAME")
|
format(lName, 63, "%L", sLang, "LANG_NAME")
|
||||||
client_print(id,print_chat,"%L",pLang,"SET_LANG_SERVER",lName)
|
client_print(id, print_chat, "%L", pLang, "SET_LANG_SERVER", lName)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !equali(pLang,pLang_old) && ( ( isAdmin && (key==2) ) || ( !isAdmin && (key==1) ) ) ) {
|
if (!equali(pLang, pLang_old) && ((isAdmin && (key == 2)) || (!isAdmin && (key == 1))))
|
||||||
client_cmd(id,"setinfo ^"lang^" ^"%s^"",pLang)
|
{
|
||||||
format(lName,63,"%L",pLang,"LANG_NAME")
|
client_cmd(id, "setinfo ^"lang^" ^"%s^"", pLang)
|
||||||
client_print(id,print_chat,"%L",pLang,"SET_LANG_USER",lName)
|
format(lName, 63, "%L", pLang, "LANG_NAME")
|
||||||
|
client_print(id, print_chat, "%L", pLang, "SET_LANG_USER", lName)
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
get_lang_id(lang[]) {
|
get_lang_id(lang[])
|
||||||
|
{
|
||||||
new tLang[3]
|
new tLang[3]
|
||||||
for (new i=0;i<g_langNum;i++) {
|
|
||||||
get_lang(i,tLang)
|
for (new i = 0; i < g_langNum; i++)
|
||||||
if ( equali(tLang,lang) )
|
{
|
||||||
|
get_lang(i, tLang)
|
||||||
|
if (equali(tLang, lang))
|
||||||
return i
|
return i
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,118 +43,150 @@ new g_nextMap[32]
|
|||||||
new g_mapCycle[32]
|
new g_mapCycle[32]
|
||||||
new g_pos
|
new g_pos
|
||||||
|
|
||||||
public plugin_init() {
|
public plugin_init()
|
||||||
register_plugin("NextMap",AMXX_VERSION_STR,"AMXX Dev Team")
|
{
|
||||||
|
register_plugin("NextMap", AMXX_VERSION_STR, "AMXX Dev Team")
|
||||||
register_dictionary("nextmap.txt")
|
register_dictionary("nextmap.txt")
|
||||||
register_event("30","changeMap","a")
|
register_event("30", "changeMap", "a")
|
||||||
register_clcmd("say nextmap","sayNextMap",0,"- displays nextmap")
|
register_clcmd("say nextmap", "sayNextMap", 0, "- displays nextmap")
|
||||||
register_cvar("amx_nextmap","",FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_SPONLY)
|
register_cvar("amx_nextmap", "", FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_SPONLY)
|
||||||
|
|
||||||
new szString[32], szString2[32], szString3[8]
|
new szString[32], szString2[32], szString3[8]
|
||||||
get_localinfo( "lastmapcycle", szString , 31 )
|
|
||||||
parse( szString, szString2, 31, szString3 , 7 )
|
|
||||||
g_pos = str_to_num( szString3 )
|
|
||||||
get_cvar_string( "mapcyclefile" , g_mapCycle , 31 )
|
|
||||||
|
|
||||||
if ( !equal( g_mapCycle , szString2 ) )
|
get_localinfo("lastmapcycle", szString, 31)
|
||||||
|
parse(szString, szString2, 31, szString3, 7)
|
||||||
|
g_pos = str_to_num(szString3)
|
||||||
|
get_cvar_string("mapcyclefile", g_mapCycle, 31)
|
||||||
|
|
||||||
|
if (!equal(g_mapCycle, szString2))
|
||||||
g_pos = 0 // mapcyclefile has been changed - go from first
|
g_pos = 0 // mapcyclefile has been changed - go from first
|
||||||
|
|
||||||
readMapCycle( g_mapCycle , g_nextMap , 31 )
|
readMapCycle(g_mapCycle, g_nextMap, 31)
|
||||||
set_cvar_string( "amx_nextmap", g_nextMap )
|
set_cvar_string("amx_nextmap", g_nextMap)
|
||||||
format( szString3 , 31, "%s %d", g_mapCycle , g_pos ) // save lastmapcycle settings
|
format(szString3, 31, "%s %d", g_mapCycle, g_pos) // save lastmapcycle settings
|
||||||
set_localinfo( "lastmapcycle", szString3 )
|
set_localinfo("lastmapcycle", szString3)
|
||||||
}
|
}
|
||||||
|
|
||||||
getNextMapName(szArg[],iMax) {
|
getNextMapName(szArg[], iMax)
|
||||||
new len = get_cvar_string("amx_nextmap",szArg,iMax)
|
{
|
||||||
if ( is_map_valid(szArg) ) return len
|
new len = get_cvar_string("amx_nextmap", szArg, iMax)
|
||||||
len = copy(szArg,iMax,g_nextMap)
|
|
||||||
set_cvar_string("amx_nextmap",g_nextMap)
|
if (is_map_valid(szArg)) return len
|
||||||
|
len = copy(szArg, iMax, g_nextMap)
|
||||||
|
set_cvar_string("amx_nextmap", g_nextMap)
|
||||||
|
|
||||||
return len
|
return len
|
||||||
}
|
}
|
||||||
|
|
||||||
public sayNextMap() {
|
public sayNextMap()
|
||||||
|
{
|
||||||
new name[32]
|
new name[32]
|
||||||
getNextMapName(name,31)
|
|
||||||
client_print(0,print_chat,"%L %s",LANG_PLAYER,"NEXT_MAP",name)
|
getNextMapName(name, 31)
|
||||||
|
client_print(0, print_chat, "%L %s", LANG_PLAYER, "NEXT_MAP", name)
|
||||||
}
|
}
|
||||||
|
|
||||||
public delayedChange( param[] ) {
|
public delayedChange(param[])
|
||||||
set_cvar_float("mp_chattime",get_cvar_float("mp_chattime")-2.0)
|
{
|
||||||
server_cmd( "changelevel %s", param )
|
set_cvar_float("mp_chattime", get_cvar_float("mp_chattime") - 2.0)
|
||||||
|
server_cmd("changelevel %s", param)
|
||||||
}
|
}
|
||||||
|
|
||||||
public changeMap() {
|
public changeMap()
|
||||||
|
{
|
||||||
new string[32]
|
new string[32]
|
||||||
new Float:chattime = get_cvar_float("mp_chattime")
|
new Float:chattime = get_cvar_float("mp_chattime")
|
||||||
set_cvar_float( "mp_chattime" , chattime + 2.0 ) // make sure mp_chattime is long
|
|
||||||
|
set_cvar_float("mp_chattime", chattime + 2.0) // make sure mp_chattime is long
|
||||||
new len = getNextMapName(string, 31) + 1
|
new len = getNextMapName(string, 31) + 1
|
||||||
set_task( chattime , "delayedChange" , 0 , string , len ) // change with 1.5 sec. delay
|
set_task(chattime, "delayedChange", 0, string, len) // change with 1.5 sec. delay
|
||||||
}
|
}
|
||||||
|
|
||||||
new g_warning[] = "WARNING: Couldn't find a valid map or the file doesn't exist (file ^"%s^")"
|
new g_warning[] = "WARNING: Couldn't find a valid map or the file doesn't exist (file ^"%s^")"
|
||||||
|
|
||||||
#if defined OBEY_MAPCYCLE
|
#if defined OBEY_MAPCYCLE
|
||||||
|
readMapCycle(szFileName[], szNext[], iNext)
|
||||||
readMapCycle(szFileName[], szNext[], iNext ) {
|
{
|
||||||
new b, i = 0, iMaps = 0
|
new b, i = 0, iMaps = 0
|
||||||
new szBuffer[32], szFirst[32]
|
new szBuffer[32], szFirst[32]
|
||||||
if ( file_exists( szFileName ) ) {
|
|
||||||
while( read_file( szFileName , i++ , szBuffer , 31 , b ) ) {
|
if (file_exists(szFileName))
|
||||||
if ( !isalnum( szBuffer[0] ) || !is_map_valid( szBuffer ) ) continue
|
{
|
||||||
if ( !iMaps ) copy( szFirst, 31, szBuffer )
|
while (read_file(szFileName, i++, szBuffer, 31, b))
|
||||||
if ( ++iMaps > g_pos ) {
|
{
|
||||||
copy( szNext , iNext , szBuffer )
|
if (!isalnum(szBuffer[0]) || !is_map_valid(szBuffer)) continue
|
||||||
|
if (!iMaps)
|
||||||
|
copy(szFirst, 31, szBuffer)
|
||||||
|
|
||||||
|
if (++iMaps > g_pos)
|
||||||
|
{
|
||||||
|
copy(szNext, iNext, szBuffer)
|
||||||
g_pos = iMaps
|
g_pos = iMaps
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( !iMaps ) {
|
|
||||||
log_amx( g_warning , szFileName )
|
if (!iMaps)
|
||||||
get_mapname( szFirst , 31 )
|
{
|
||||||
|
log_amx(g_warning, szFileName)
|
||||||
|
get_mapname(szFirst, 31)
|
||||||
}
|
}
|
||||||
copy( szNext , iNext , szFirst )
|
|
||||||
|
copy(szNext, iNext, szFirst)
|
||||||
g_pos = 1
|
g_pos = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
readMapCycle(szFileName[], szNext[], iNext ) {
|
readMapCycle(szFileName[], szNext[], iNext)
|
||||||
|
{
|
||||||
new b, i = 0, iMaps = 0
|
new b, i = 0, iMaps = 0
|
||||||
new szBuffer[32], szFirst[32], szCurrent[32]
|
new szBuffer[32], szFirst[32], szCurrent[32]
|
||||||
get_mapname( szCurrent , 31 )
|
|
||||||
|
get_mapname(szCurrent, 31)
|
||||||
|
|
||||||
new a = g_pos
|
new a = g_pos
|
||||||
|
|
||||||
if ( file_exists( szFileName ) ) {
|
if (file_exists(szFileName))
|
||||||
while( read_file( szFileName , i++ , szBuffer , 31 , b ) ) {
|
{
|
||||||
if ( !isalnum( szBuffer[0] ) || !is_map_valid( szBuffer ) ) continue
|
while (read_file(szFileName, i++, szBuffer, 31, b))
|
||||||
if ( !iMaps ) {
|
{
|
||||||
|
if (!isalnum(szBuffer[0]) || !is_map_valid(szBuffer)) continue
|
||||||
|
|
||||||
|
if (!iMaps)
|
||||||
|
{
|
||||||
iMaps = 1
|
iMaps = 1
|
||||||
copy( szFirst, 31, szBuffer )
|
copy(szFirst, 31, szBuffer)
|
||||||
}
|
}
|
||||||
if ( iMaps == 1 ) {
|
|
||||||
if ( equali( szCurrent , szBuffer ) ) {
|
if (iMaps == 1)
|
||||||
if ( a-- == 0 )
|
{
|
||||||
|
if (equali(szCurrent, szBuffer))
|
||||||
|
{
|
||||||
|
if (a-- == 0)
|
||||||
iMaps = 2
|
iMaps = 2
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
if (equali(szCurrent, szBuffer))
|
||||||
if ( equali( szCurrent , szBuffer ) )
|
|
||||||
++g_pos
|
++g_pos
|
||||||
else
|
else
|
||||||
g_pos = 0
|
g_pos = 0
|
||||||
copy( szNext , iNext , szBuffer )
|
|
||||||
|
copy(szNext, iNext, szBuffer)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( !iMaps ) {
|
|
||||||
log_amx( g_warning , szFileName )
|
if (!iMaps)
|
||||||
copy( szNext ,iNext , szCurrent )
|
{
|
||||||
|
log_amx(g_warning, szFileName)
|
||||||
|
copy(szNext, iNext, szCurrent)
|
||||||
}
|
}
|
||||||
else copy( szNext ,iNext , szFirst )
|
else
|
||||||
|
copy(szNext, iNext, szFirst)
|
||||||
|
|
||||||
g_pos = 0
|
g_pos = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -50,18 +50,21 @@ new g_addCmd[] = "amx_pausecfg add ^"%s^""
|
|||||||
new g_system[MAX_SYSTEM]
|
new g_system[MAX_SYSTEM]
|
||||||
new g_systemNum
|
new g_systemNum
|
||||||
|
|
||||||
public plugin_init() {
|
public plugin_init()
|
||||||
register_plugin("Pause Plugins",AMXX_VERSION_STR,"AMXX Dev Team")
|
{
|
||||||
|
register_plugin("Pause Plugins", AMXX_VERSION_STR, "AMXX Dev Team")
|
||||||
register_dictionary("pausecfg.txt")
|
register_dictionary("pausecfg.txt")
|
||||||
register_dictionary("common.txt")
|
register_dictionary("common.txt")
|
||||||
register_dictionary("admincmd.txt")
|
register_dictionary("admincmd.txt")
|
||||||
register_concmd("amx_pausecfg","cmdPlugin",ADMIN_CFG,"- list commands for pause/unpause managment")
|
|
||||||
register_clcmd("amx_pausecfgmenu","cmdMenu",ADMIN_CFG,"- pause/unpause plugins with menu")
|
register_concmd("amx_pausecfg", "cmdPlugin", ADMIN_CFG, "- list commands for pause/unpause managment")
|
||||||
|
register_clcmd("amx_pausecfgmenu", "cmdMenu", ADMIN_CFG, "- pause/unpause plugins with menu")
|
||||||
#if defined DIRECT_ONOFF
|
#if defined DIRECT_ONOFF
|
||||||
register_concmd("amx_off","cmdOFF",ADMIN_CFG,"- pauses some plugins")
|
register_concmd("amx_off", "cmdOFF", ADMIN_CFG, "- pauses some plugins")
|
||||||
register_concmd("amx_on","cmdON",ADMIN_CFG,"- unpauses some plugins")
|
register_concmd("amx_on", "cmdON", ADMIN_CFG, "- unpauses some plugins")
|
||||||
#endif
|
#endif
|
||||||
register_menucmd(register_menuid("Pause/Unpause Plugins"),1023,"actionMenu")
|
register_menucmd(register_menuid("Pause/Unpause Plugins"), 1023, "actionMenu")
|
||||||
|
|
||||||
g_coloredMenus = colored_menus()
|
g_coloredMenus = colored_menus()
|
||||||
get_configsdir(g_fileToSave, 63);
|
get_configsdir(g_fileToSave, 63);
|
||||||
format(g_fileToSave, 63, "%s/pausecfg.ini", g_fileToSave);
|
format(g_fileToSave, 63, "%s/pausecfg.ini", g_fileToSave);
|
||||||
@ -70,327 +73,442 @@ public plugin_init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined DIRECT_ONOFF
|
#if defined DIRECT_ONOFF
|
||||||
|
public cmdOFF(id, level, cid)
|
||||||
public cmdOFF(id,level,cid) {
|
{
|
||||||
if (cmd_access(id,level,cid,1))
|
if (cmd_access(id, level, cid, 1))
|
||||||
pausePlugins(id)
|
pausePlugins(id)
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
public cmdON(id,level,cid) {
|
public cmdON(id, level, cid)
|
||||||
if (cmd_access(id,level,cid,1))
|
{
|
||||||
|
if (cmd_access(id, level, cid, 1))
|
||||||
unpausePlugins(id)
|
unpausePlugins(id)
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public plugin_cfg() {
|
public plugin_cfg()
|
||||||
|
{
|
||||||
loadSettings(g_fileToSave)
|
loadSettings(g_fileToSave)
|
||||||
|
|
||||||
// Put here titles of plugins which you don't want to pause
|
// Put here titles of plugins which you don't want to pause
|
||||||
server_cmd(g_addCmd, "Admin Base" )
|
server_cmd(g_addCmd, "Admin Base")
|
||||||
server_cmd(g_addCmd, "Admin Base (SQL)" )
|
server_cmd(g_addCmd, "Admin Base (SQL)")
|
||||||
server_cmd(g_addCmd, "Pause Plugins" )
|
server_cmd(g_addCmd, "Pause Plugins")
|
||||||
server_cmd(g_addCmd, "TimeLeft" )
|
server_cmd(g_addCmd, "TimeLeft")
|
||||||
server_cmd(g_addCmd, "NextMap" )
|
server_cmd(g_addCmd, "NextMap")
|
||||||
server_cmd(g_addCmd, "Slots Reservation" )
|
server_cmd(g_addCmd, "Slots Reservation")
|
||||||
}
|
}
|
||||||
|
|
||||||
public actionMenu(id,key) {
|
public actionMenu(id, key)
|
||||||
switch (key) {
|
{
|
||||||
case 6: {
|
switch (key)
|
||||||
if (file_exists(g_fileToSave)){
|
{
|
||||||
|
case 6:
|
||||||
|
{
|
||||||
|
if (file_exists(g_fileToSave))
|
||||||
|
{
|
||||||
delete_file(g_fileToSave)
|
delete_file(g_fileToSave)
|
||||||
client_print(id,print_chat,"* %L",id,"PAUSE_CONF_CLEARED")
|
client_print(id, print_chat, "* %L", id, "PAUSE_CONF_CLEARED")
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
client_print(id,print_chat,"* %L",id,"PAUSE_ALR_CLEARED")
|
client_print(id, print_chat, "* %L", id, "PAUSE_ALR_CLEARED")
|
||||||
displayMenu(id,g_menuPos[id])
|
|
||||||
|
displayMenu(id, g_menuPos[id])
|
||||||
}
|
}
|
||||||
case 7: {
|
case 7:
|
||||||
if (saveSettings(g_fileToSave)){
|
{
|
||||||
|
if (saveSettings(g_fileToSave))
|
||||||
|
{
|
||||||
g_Modified = 0
|
g_Modified = 0
|
||||||
client_print(id,print_chat,"* %L",id,"PAUSE_CONF_SAVED")
|
client_print(id, print_chat, "* %L", id, "PAUSE_CONF_SAVED")
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
client_print(id,print_chat,"* %L",id,"PAUSE_SAVE_FAILED")
|
client_print(id, print_chat, "* %L", id, "PAUSE_SAVE_FAILED")
|
||||||
displayMenu(id,g_menuPos[id])
|
|
||||||
|
displayMenu(id, g_menuPos[id])
|
||||||
}
|
}
|
||||||
case 8: displayMenu(id,++g_menuPos[id])
|
case 8: displayMenu(id, ++g_menuPos[id])
|
||||||
case 9: displayMenu(id,--g_menuPos[id])
|
case 9: displayMenu(id, --g_menuPos[id])
|
||||||
default:{
|
default:
|
||||||
|
{
|
||||||
new option = g_menuPos[id] * 6 + key
|
new option = g_menuPos[id] * 6 + key
|
||||||
new file[32],status[2]
|
new file[32], status[2]
|
||||||
get_plugin(option,file,31,status,0,status,0,status,0,status,1)
|
|
||||||
switch( status[0] ) {
|
get_plugin(option, file, 31, status, 0, status, 0, status, 0, status, 1)
|
||||||
case 'r': pause("ac",file)
|
|
||||||
case 'p': {
|
switch (status[0])
|
||||||
|
{
|
||||||
|
case 'r': pause("ac", file)
|
||||||
|
case 'p':
|
||||||
|
{
|
||||||
g_Modified = 1
|
g_Modified = 1
|
||||||
pause("dc",file)
|
pause("dc", file)
|
||||||
}
|
}
|
||||||
case 's': {
|
case 's':
|
||||||
|
{
|
||||||
g_Modified = 1
|
g_Modified = 1
|
||||||
unpause("ac",file)
|
unpause("ac", file)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
displayMenu(id,g_menuPos[id])
|
|
||||||
|
displayMenu(id, g_menuPos[id])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
getStatus( id, code, &statusCode, lStatus[], lLen ) {
|
getStatus(id, code, &statusCode, lStatus[], lLen)
|
||||||
switch (code) {
|
{
|
||||||
case 'r': {
|
switch (code)
|
||||||
|
{
|
||||||
|
case 'r':
|
||||||
|
{
|
||||||
statusCode = 'O'
|
statusCode = 'O'
|
||||||
format( lStatus, lLen, "%L", id, "ON" )
|
format(lStatus, lLen, "%L", id, "ON")
|
||||||
}
|
}
|
||||||
case 's': {
|
case 's':
|
||||||
|
{
|
||||||
statusCode = 'S'
|
statusCode = 'S'
|
||||||
format( lStatus, lLen, "%L", id, "STOPPED" )
|
format(lStatus, lLen, "%L", id, "STOPPED")
|
||||||
}
|
}
|
||||||
case 'p': {
|
case 'p':
|
||||||
|
{
|
||||||
statusCode = 'O'
|
statusCode = 'O'
|
||||||
format( lStatus, lLen, "%L", id, "OFF" )
|
format(lStatus, lLen, "%L", id, "OFF")
|
||||||
}
|
}
|
||||||
case 'b': {
|
case 'b':
|
||||||
|
{
|
||||||
statusCode = 'E'
|
statusCode = 'E'
|
||||||
format( lStatus, lLen, "%L", id, "ERROR" )
|
format(lStatus, lLen, "%L", id, "ERROR")
|
||||||
}
|
}
|
||||||
default: {
|
default:
|
||||||
|
{
|
||||||
statusCode = 'L'
|
statusCode = 'L'
|
||||||
format( lStatus, lLen, "%L", id, "LOCKED" )
|
format(lStatus, lLen, "%L", id, "LOCKED")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
isSystem( id ) {
|
isSystem(id)
|
||||||
for( new a = 0; a < g_systemNum; ++a)
|
{
|
||||||
if ( g_system[ a ] == id )
|
for (new a = 0; a < g_systemNum; ++a)
|
||||||
|
if (g_system[a] == id)
|
||||||
return 1
|
return 1
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
displayMenu(id, pos) {
|
displayMenu(id, pos)
|
||||||
|
{
|
||||||
if (pos < 0) return
|
if (pos < 0) return
|
||||||
new filename[32],title[32],status[8],statusCode
|
|
||||||
|
new filename[32], title[32], status[8], statusCode
|
||||||
new datanum = get_pluginsnum()
|
new datanum = get_pluginsnum()
|
||||||
new menu_body[512], start = pos * 6, k = 0
|
new menu_body[512], start = pos * 6, k = 0
|
||||||
if (start >= datanum) start = pos = g_menuPos[id] = 0
|
|
||||||
new len = format(menu_body,511,
|
if (start >= datanum)
|
||||||
g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n",
|
start = pos = g_menuPos[id] = 0
|
||||||
id,"PAUSE_UNPAUSE",pos + 1,((datanum/6)+((datanum%6)?1:0)))
|
|
||||||
|
new len = format(menu_body, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "PAUSE_UNPAUSE", pos + 1, ((datanum / 6) + ((datanum % 6) ? 1 : 0)))
|
||||||
new end = start + 6, keys = MENU_KEY_0|MENU_KEY_8|MENU_KEY_7
|
new end = start + 6, keys = MENU_KEY_0|MENU_KEY_8|MENU_KEY_7
|
||||||
if (end > datanum) end = datanum
|
|
||||||
for (new a = start; a < end; ++a) {
|
if (end > datanum)
|
||||||
get_plugin(a,filename,31,title,31,status,0,status,0,status,1)
|
end = datanum
|
||||||
getStatus( id, status[0], statusCode, status, 7 )
|
|
||||||
if ( isSystem( a ) || (statusCode!='O'&&statusCode!='S')) {
|
for (new a = start; a < end; ++a)
|
||||||
if ( g_coloredMenus ) {
|
{
|
||||||
len += format(menu_body[len],511-len, "\d%d. %s\R%s^n\w",++k, title, status )
|
get_plugin(a, filename, 31, title, 31, status, 0, status, 0, status, 1)
|
||||||
}
|
getStatus(id, status[0], statusCode, status, 7)
|
||||||
else{
|
|
||||||
|
if (isSystem(a) || (statusCode != 'O' && statusCode != 'S'))
|
||||||
|
{
|
||||||
|
if (g_coloredMenus)
|
||||||
|
{
|
||||||
|
len += format(menu_body[len], 511-len, "\d%d. %s\R%s^n\w", ++k, title, status)
|
||||||
|
} else {
|
||||||
++k
|
++k
|
||||||
len += format(menu_body[len],511-len, "#. %s %s^n", title, status )
|
len += format(menu_body[len], 511-len, "#. %s %s^n", title, status)
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
keys |= (1<<k)
|
keys |= (1<<k)
|
||||||
len += format(menu_body[len],511-len,g_coloredMenus ? "%d. %s\y\R%s^n\w" : "%d. %s %s^n",++k,title, status )
|
len += format(menu_body[len], 511-len, g_coloredMenus ? "%d. %s\y\R%s^n\w" : "%d. %s %s^n", ++k, title, status)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
len += format(menu_body[len],511-len,"^n7. %L^n",id,"CLEAR_STOPPED")
|
|
||||||
len += format(menu_body[len],511-len,g_coloredMenus ? "8. %L \y\R%s^n\w"
|
len += format(menu_body[len], 511-len, "^n7. %L^n", id, "CLEAR_STOPPED")
|
||||||
: "8. %L %s^n", id, "SAVE_STOPPED", g_Modified ? "*" : "")
|
len += format(menu_body[len], 511-len, g_coloredMenus ? "8. %L \y\R%s^n\w" : "8. %L %s^n", id, "SAVE_STOPPED", g_Modified ? "*" : "")
|
||||||
if (end != datanum){
|
|
||||||
format(menu_body[len],511-len,"^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
|
if (end != datanum)
|
||||||
|
{
|
||||||
|
format(menu_body[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
|
||||||
keys |= MENU_KEY_9
|
keys |= MENU_KEY_9
|
||||||
}
|
}
|
||||||
else format(menu_body[len],511-len,"^n0. %L", id, pos ? "BACK" : "EXIT")
|
else
|
||||||
show_menu(id,keys,menu_body,-1,"Pause/Unpause Plugins")
|
format(menu_body[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
|
||||||
|
|
||||||
|
show_menu(id, keys, menu_body, -1, "Pause/Unpause Plugins")
|
||||||
}
|
}
|
||||||
|
|
||||||
public cmdMenu(id,level,cid) {
|
public cmdMenu(id, level, cid)
|
||||||
if (cmd_access(id,level,cid,1))
|
{
|
||||||
displayMenu(id,g_menuPos[id] = 0)
|
if (cmd_access(id, level, cid, 1))
|
||||||
|
displayMenu(id, g_menuPos[id] = 0)
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
pausePlugins(id) {
|
pausePlugins(id)
|
||||||
new filename[32],title[32],status[2]
|
{
|
||||||
|
new filename[32], title[32], status[2]
|
||||||
new count = 0, imax = get_pluginsnum()
|
new count = 0, imax = get_pluginsnum()
|
||||||
for (new a=0;a<imax;++a){
|
|
||||||
get_plugin(a,filename,31,title,31,status,0,status,0,status,1)
|
for (new a = 0; a < imax; ++a)
|
||||||
if ( !isSystem( a ) && status[0]=='r' && pause("ac",filename) ) {
|
{
|
||||||
//console_print(id,"Pausing %s (file ^"%s^")",title,filename)
|
get_plugin(a, filename, 31, title, 31, status, 0, status, 0, status, 1)
|
||||||
|
|
||||||
|
if (!isSystem(a) && status[0] == 'r' && pause("ac", filename))
|
||||||
|
{
|
||||||
|
//console_print(id, "Pausing %s (file ^"%s^")", title, filename)
|
||||||
++count
|
++count
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console_print(id,"%L",id,(count==1)?"PAUSED_PLUGIN":"PAUSED_PLUGINS",count)
|
|
||||||
|
console_print(id, "%L", id, (count == 1) ? "PAUSED_PLUGIN" : "PAUSED_PLUGINS", count)
|
||||||
}
|
}
|
||||||
|
|
||||||
unpausePlugins(id) {
|
unpausePlugins(id)
|
||||||
new filename[32],title[32],status[2]
|
{
|
||||||
|
new filename[32], title[32], status[2]
|
||||||
new count = 0, imax = get_pluginsnum()
|
new count = 0, imax = get_pluginsnum()
|
||||||
for (new a=0;a<imax;++a){
|
|
||||||
get_plugin(a,filename,31,title,31,status,0,status,0,status,1)
|
for (new a = 0; a < imax; ++a)
|
||||||
if ( !isSystem( a ) && status[0]=='p' && unpause("ac",filename) ) {
|
{
|
||||||
//console_print(id,"Unpausing %s (file ^"%s^")",title,filename)
|
get_plugin(a, filename, 31, title, 31, status, 0, status, 0, status, 1)
|
||||||
|
|
||||||
|
if (!isSystem(a) && status[0] == 'p' && unpause("ac", filename))
|
||||||
|
{
|
||||||
|
//console_print(id, "Unpausing %s (file ^"%s^")", title, filename)
|
||||||
++count
|
++count
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console_print(id,"%L",id,(count==1)?"UNPAUSED_PLUGIN":"UNPAUSED_PLUGINS",count)
|
|
||||||
|
console_print(id, "%L", id, (count == 1) ? "UNPAUSED_PLUGIN" : "UNPAUSED_PLUGINS", count)
|
||||||
}
|
}
|
||||||
|
|
||||||
findPluginByFile(arg[32],&len) {
|
findPluginByFile(arg[32], &len)
|
||||||
new name[32],title[32],status[2]
|
{
|
||||||
|
new name[32], title[32], status[2]
|
||||||
new inum = get_pluginsnum()
|
new inum = get_pluginsnum()
|
||||||
for(new a = 0; a < inum; ++a){
|
|
||||||
get_plugin(a,name,31,title,31,status,0,status,0,status,1)
|
for (new a = 0; a < inum; ++a)
|
||||||
if ( equali(name,arg,len) && (status[0]=='r'||status[0]=='p'||status[0]=='s') ){
|
{
|
||||||
len = copy(arg,31,name)
|
get_plugin(a, name, 31, title, 31, status, 0, status, 0, status, 1)
|
||||||
|
|
||||||
|
if (equali(name, arg, len) && (status[0] == 'r' || status[0] == 'p' || status[0] == 's'))
|
||||||
|
{
|
||||||
|
len = copy(arg, 31, name)
|
||||||
return a
|
return a
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
|
|
||||||
findPluginByTitle(name[],file[],len) {
|
findPluginByTitle(name[], file[], len)
|
||||||
new title[32],status[2]
|
{
|
||||||
|
new title[32], status[2]
|
||||||
new inum = get_pluginsnum()
|
new inum = get_pluginsnum()
|
||||||
for (new a = 0; a < inum; ++a) {
|
|
||||||
get_plugin(a,file,len,title,31,status,0,status,0,status,1)
|
for (new a = 0; a < inum; ++a)
|
||||||
if ( equali( title , name ) )
|
{
|
||||||
|
get_plugin(a, file, len, title, 31, status, 0, status, 0, status, 1)
|
||||||
|
|
||||||
|
if (equali(title, name))
|
||||||
return a
|
return a
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
|
|
||||||
public cmdPlugin(id,level,cid) {
|
public cmdPlugin(id, level, cid)
|
||||||
if (!cmd_access(id,level,cid,1))
|
{
|
||||||
|
if (!cmd_access(id, level, cid, 1))
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
|
|
||||||
new cmds[32]
|
new cmds[32]
|
||||||
read_argv(1,cmds,31)
|
read_argv(1, cmds, 31)
|
||||||
if ( equal(cmds, "add" ) && read_argc() > 2 ) {
|
|
||||||
read_argv(2, cmds ,31)
|
if (equal(cmds, "add") && read_argc() > 2)
|
||||||
|
{
|
||||||
|
read_argv(2, cmds, 31)
|
||||||
new file[2]
|
new file[2]
|
||||||
if ( (g_system[ g_systemNum ] = findPluginByTitle( cmds , file , 0 )) != -1 ) {
|
|
||||||
if ( g_systemNum < MAX_SYSTEM )
|
if ((g_system[g_systemNum] = findPluginByTitle(cmds, file, 0)) != -1)
|
||||||
|
{
|
||||||
|
if (g_systemNum < MAX_SYSTEM)
|
||||||
g_systemNum++
|
g_systemNum++
|
||||||
else
|
else
|
||||||
console_print( id, "%L", id, "CANT_MARK_MORE" )
|
console_print(id, "%L", id, "CANT_MARK_MORE")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( equal(cmds, "off" ) ) {
|
else if (equal(cmds, "off"))
|
||||||
|
{
|
||||||
pausePlugins(id)
|
pausePlugins(id)
|
||||||
}
|
}
|
||||||
else if ( equal(cmds, "on" ) ) {
|
else if (equal(cmds, "on"))
|
||||||
|
{
|
||||||
unpausePlugins(id)
|
unpausePlugins(id)
|
||||||
}
|
}
|
||||||
else if ( equal(cmds, "save" ) ) {
|
else if (equal(cmds, "save"))
|
||||||
if (saveSettings(g_fileToSave)) {
|
{
|
||||||
|
if (saveSettings(g_fileToSave))
|
||||||
|
{
|
||||||
g_Modified = 0
|
g_Modified = 0
|
||||||
console_print(id,"%L",id,"PAUSE_CONF_SAVED")
|
console_print(id, "%L", id, "PAUSE_CONF_SAVED")
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
console_print(id,"%L",id,"PAUSE_SAVE_FAILED")
|
console_print(id, "%L", id, "PAUSE_SAVE_FAILED")
|
||||||
}
|
}
|
||||||
else if ( equal(cmds, "clear" ) ) {
|
else if (equal(cmds, "clear"))
|
||||||
if (file_exists(g_fileToSave)){
|
{
|
||||||
|
if (file_exists(g_fileToSave))
|
||||||
|
{
|
||||||
delete_file(g_fileToSave)
|
delete_file(g_fileToSave)
|
||||||
console_print(id,"%L",id,"PAUSE_CONF_CLEARED")
|
console_print(id, "%L", id, "PAUSE_CONF_CLEARED")
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
console_print(id,"%L",id,"PAUSE_ALR_CLEARED")
|
console_print(id, "%L", id, "PAUSE_ALR_CLEARED")
|
||||||
}
|
}
|
||||||
else if ( equal(cmds, "pause" ) ) {
|
else if (equal(cmds, "pause"))
|
||||||
new arg[32], a ,len = read_argv(2,arg,31)
|
{
|
||||||
if ( len && ((a = findPluginByFile(arg,len)) != -1) && !isSystem( a ) && pause("ac",arg) )
|
new arg[32], a, len = read_argv(2, arg, 31)
|
||||||
console_print(id,"%L %L",id,"PAUSE_PLUGIN_MATCH",arg,id,"PAUSED")
|
|
||||||
else console_print(id,"%L",id,"PAUSE_COULDNT_FIND",arg)
|
if (len && ((a = findPluginByFile(arg, len)) != -1) && !isSystem(a) && pause("ac", arg))
|
||||||
|
console_print(id, "%L %L", id, "PAUSE_PLUGIN_MATCH", arg, id, "PAUSED")
|
||||||
|
else
|
||||||
|
console_print(id, "%L", id, "PAUSE_COULDNT_FIND", arg)
|
||||||
}
|
}
|
||||||
else if ( equal(cmds, "enable" ) ) {
|
else if (equal(cmds, "enable"))
|
||||||
new arg[32], a , len = read_argv(2,arg,31)
|
{
|
||||||
if ( len && (a = findPluginByFile(arg,len)) != -1 && !isSystem( a ) && unpause("ac",arg) )
|
new arg[32], a, len = read_argv(2, arg, 31)
|
||||||
console_print(id,"%L %L",id,"PAUSE_PLUGIN_MATCH",arg,id,"UNPAUSED")
|
|
||||||
else console_print(id,"%L",id,"PAUSE_COULDNT_FIND",arg)
|
if (len && (a = findPluginByFile(arg, len)) != -1 && !isSystem(a) && unpause("ac", arg))
|
||||||
|
console_print(id, "%L %L", id, "PAUSE_PLUGIN_MATCH", arg, id, "UNPAUSED")
|
||||||
|
else
|
||||||
|
console_print(id, "%L", id, "PAUSE_COULDNT_FIND", arg)
|
||||||
}
|
}
|
||||||
else if ( equal(cmds, "stop" ) ) {
|
else if (equal(cmds, "stop"))
|
||||||
new arg[32], a, len = read_argv(2,arg,31)
|
{
|
||||||
if ( len && (a = findPluginByFile(arg,len)) != -1 && !isSystem( a ) && pause("dc",arg)){
|
new arg[32], a, len = read_argv(2, arg, 31)
|
||||||
|
|
||||||
|
if (len && (a = findPluginByFile(arg, len)) != -1 && !isSystem(a) && pause("dc", arg))
|
||||||
|
{
|
||||||
g_Modified = 1
|
g_Modified = 1
|
||||||
console_print(id,"%L %L",id,"PAUSE_PLUGIN_MATCH",arg,id,"STOPPED")
|
console_print(id, "%L %L", id, "PAUSE_PLUGIN_MATCH", arg, id, "STOPPED")
|
||||||
}
|
}
|
||||||
else console_print(id,"%L",id,"PAUSE_COULDNT_FIND",arg)
|
|
||||||
}
|
|
||||||
else if ( equal(cmds, "list" ) ) {
|
|
||||||
new lName[32],lVersion[32],lAuthor[32],lFile[32],lStatus[32]
|
|
||||||
format(lName,31,"%L",id,"NAME")
|
|
||||||
format(lVersion,31,"%L",id,"VERSION")
|
|
||||||
format(lAuthor,31,"%L",id,"AUTHOR")
|
|
||||||
format(lFile,31,"%L",id,"FILE")
|
|
||||||
format(lStatus,31,"%L",id,"STATUS")
|
|
||||||
new arg1[8], running = 0
|
|
||||||
new start = read_argv(2,arg1,7) ? str_to_num(arg1) : 1
|
|
||||||
if (--start < 0) start = 0
|
|
||||||
new plgnum = get_pluginsnum()
|
|
||||||
if (start >= plgnum) start = plgnum - 1
|
|
||||||
console_print(id,"^n----- %L -----",id,"PAUSE_LOADED")
|
|
||||||
console_print(id, " %-18.17s %-8.7s %-17.16s %-16.15s %-9.8s",lName,lVersion,lAuthor,lFile,lStatus)
|
|
||||||
new plugin[32],title[32],version[16],author[32],status[16]
|
|
||||||
new end = start + 10
|
|
||||||
if (end > plgnum) end = plgnum
|
|
||||||
for (new a = start; a < end; ++a) {
|
|
||||||
get_plugin(a,plugin,31,title,31,version,15,author,31,status,15)
|
|
||||||
if (status[0] == 'r') ++running
|
|
||||||
console_print(id, " [%3d] %-18.17s %-8.7s %-17.16s %-16.15s %-9.8s",a+1,title,version,author,plugin, status )
|
|
||||||
}
|
|
||||||
console_print(id,"----- %L -----",id,"PAUSE_ENTRIES",start+1,end,plgnum,running)
|
|
||||||
if (end < plgnum)
|
|
||||||
console_print(id,"----- %L -----",id,"PAUSE_USE_MORE",end+1)
|
|
||||||
else
|
else
|
||||||
console_print(id,"----- %L -----",id,"PAUSE_USE_BEGIN")
|
console_print(id, "%L", id, "PAUSE_COULDNT_FIND", arg)
|
||||||
}
|
}
|
||||||
else {
|
else if (equal(cmds, "list"))
|
||||||
console_print(id,"%L",id,"PAUSE_USAGE")
|
{
|
||||||
console_print(id,"%L:",id,"PAUSE_COMMANDS")
|
new lName[32], lVersion[32], lAuthor[32], lFile[32], lStatus[32]
|
||||||
console_print(id,"%L",id,"COM_PAUSE_OFF")
|
|
||||||
console_print(id,"%L",id,"COM_PAUSE_ON")
|
format(lName, 31, "%L", id, "NAME")
|
||||||
console_print(id,"%L",id,"COM_PAUSE_STOP")
|
format(lVersion, 31, "%L", id, "VERSION")
|
||||||
console_print(id,"%L",id,"COM_PAUSE_PAUSE")
|
format(lAuthor, 31, "%L", id, "AUTHOR")
|
||||||
console_print(id,"%L",id,"COM_PAUSE_ENABLE")
|
format(lFile, 31, "%L", id, "FILE")
|
||||||
console_print(id,"%L",id,"COM_PAUSE_SAVE")
|
format(lStatus, 31, "%L", id, "STATUS")
|
||||||
console_print(id,"%L",id,"COM_PAUSE_CLEAR")
|
|
||||||
console_print(id,"%L",id,"COM_PAUSE_LIST")
|
new arg1[8], running = 0
|
||||||
console_print(id,"%L",id,"COM_PAUSE_ADD")
|
new start = read_argv(2, arg1, 7) ? str_to_num(arg1) : 1
|
||||||
|
|
||||||
|
if (--start < 0)
|
||||||
|
start = 0
|
||||||
|
|
||||||
|
new plgnum = get_pluginsnum()
|
||||||
|
|
||||||
|
if (start >= plgnum)
|
||||||
|
start = plgnum - 1
|
||||||
|
|
||||||
|
console_print(id, "^n----- %L -----", id, "PAUSE_LOADED")
|
||||||
|
console_print(id, " %-18.17s %-8.7s %-17.16s %-16.15s %-9.8s", lName, lVersion, lAuthor, lFile, lStatus)
|
||||||
|
|
||||||
|
new plugin[32], title[32], version[16], author[32], status[16]
|
||||||
|
new end = start + 10
|
||||||
|
|
||||||
|
if (end > plgnum) end = plgnum
|
||||||
|
|
||||||
|
for (new a = start; a < end; ++a)
|
||||||
|
{
|
||||||
|
get_plugin(a, plugin, 31, title, 31, version, 15, author, 31, status, 15)
|
||||||
|
if (status[0] == 'r') ++running
|
||||||
|
console_print(id, " [%3d] %-18.17s %-8.7s %-17.16s %-16.15s %-9.8s", a + 1, title, version, author, plugin, status)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console_print(id, "----- %L -----", id, "PAUSE_ENTRIES", start + 1, end, plgnum, running)
|
||||||
|
|
||||||
|
if (end < plgnum)
|
||||||
|
console_print(id, "----- %L -----", id, "PAUSE_USE_MORE", end + 1)
|
||||||
|
else
|
||||||
|
console_print(id, "----- %L -----", id, "PAUSE_USE_BEGIN")
|
||||||
|
} else {
|
||||||
|
console_print(id, "%L", id, "PAUSE_USAGE")
|
||||||
|
console_print(id, "%L:", id, "PAUSE_COMMANDS")
|
||||||
|
console_print(id, "%L", id, "COM_PAUSE_OFF")
|
||||||
|
console_print(id, "%L", id, "COM_PAUSE_ON")
|
||||||
|
console_print(id, "%L", id, "COM_PAUSE_STOP")
|
||||||
|
console_print(id, "%L", id, "COM_PAUSE_PAUSE")
|
||||||
|
console_print(id, "%L", id, "COM_PAUSE_ENABLE")
|
||||||
|
console_print(id, "%L", id, "COM_PAUSE_SAVE")
|
||||||
|
console_print(id, "%L", id, "COM_PAUSE_CLEAR")
|
||||||
|
console_print(id, "%L", id, "COM_PAUSE_LIST")
|
||||||
|
console_print(id, "%L", id, "COM_PAUSE_ADD")
|
||||||
|
}
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
saveSettings(filename[]) {
|
saveSettings(filename[])
|
||||||
|
{
|
||||||
if (file_exists(filename))
|
if (file_exists(filename))
|
||||||
delete_file(filename)
|
delete_file(filename)
|
||||||
new text[256], file[32],title[32],status[2]
|
|
||||||
|
new text[256], file[32], title[32], status[2]
|
||||||
new inum = get_pluginsnum()
|
new inum = get_pluginsnum()
|
||||||
if (!write_file(filename,";Generated by Pause Plugins Plugin. Do not modify!^n;Title Filename"))
|
|
||||||
|
if (!write_file(filename, ";Generated by Pause Plugins Plugin. Do not modify!^n;Title Filename"))
|
||||||
return 0
|
return 0
|
||||||
for (new a = 0; a < inum; ++a) {
|
|
||||||
get_plugin(a,file,31,title,31,status,0,status,0,status,1)
|
for (new a = 0; a < inum; ++a)
|
||||||
if ( status[0] == 's' ){
|
{
|
||||||
format(text,255,"^"%s^" ;%s",title,file)
|
get_plugin(a, file, 31, title, 31, status, 0, status, 0, status, 1)
|
||||||
write_file(filename,text)
|
|
||||||
|
if (status[0] == 's')
|
||||||
|
{
|
||||||
|
format(text, 255, "^"%s^" ;%s", title, file)
|
||||||
|
write_file(filename, text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
loadSettings(filename[]) {
|
loadSettings(filename[])
|
||||||
if (!file_exists(filename)) return 0
|
{
|
||||||
|
if (!file_exists(filename))
|
||||||
|
return 0
|
||||||
|
|
||||||
new name[256], file[32], i, pos = 0
|
new name[256], file[32], i, pos = 0
|
||||||
while (read_file(filename,pos++,name,255,i)){
|
|
||||||
if ( name[0]!= ';' && parse(name,name,31) &&
|
while (read_file(filename, pos++, name, 255, i))
|
||||||
(i = findPluginByTitle( name , file , 31 ) != -1) )
|
{
|
||||||
pause("dc", file )
|
if (name[0] != ';' && parse(name, name, 31) && (i = findPluginByTitle(name, file, 31) != -1))
|
||||||
|
pause("dc", file)
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
@ -61,24 +61,24 @@ public plugin_natives()
|
|||||||
set_native_filter("native_filter")
|
set_native_filter("native_filter")
|
||||||
}
|
}
|
||||||
|
|
||||||
public plugin_init() {
|
public plugin_init()
|
||||||
register_plugin("Players Menu",AMXX_VERSION_STR,"AMXX Dev Team")
|
{
|
||||||
|
register_plugin("Players Menu", AMXX_VERSION_STR, "AMXX Dev Team")
|
||||||
register_dictionary("common.txt")
|
register_dictionary("common.txt")
|
||||||
register_dictionary("admincmd.txt")
|
register_dictionary("admincmd.txt")
|
||||||
register_dictionary("plmenu.txt")
|
register_dictionary("plmenu.txt")
|
||||||
|
|
||||||
register_clcmd("amx_kickmenu","cmdKickMenu",ADMIN_KICK,"- displays kick menu")
|
register_clcmd("amx_kickmenu", "cmdKickMenu", ADMIN_KICK, "- displays kick menu")
|
||||||
register_clcmd("amx_banmenu","cmdBanMenu",ADMIN_BAN,"- displays ban menu")
|
register_clcmd("amx_banmenu", "cmdBanMenu", ADMIN_BAN, "- displays ban menu")
|
||||||
register_clcmd("amx_slapmenu","cmdSlapMenu",ADMIN_SLAY,"- displays slap/slay menu")
|
register_clcmd("amx_slapmenu", "cmdSlapMenu", ADMIN_SLAY, "- displays slap/slay menu")
|
||||||
register_clcmd("amx_teammenu","cmdTeamMenu",ADMIN_LEVEL_A,"- displays team menu")
|
register_clcmd("amx_teammenu", "cmdTeamMenu", ADMIN_LEVEL_A, "- displays team menu")
|
||||||
register_clcmd("amx_clcmdmenu","cmdClcmdMenu",ADMIN_LEVEL_A,"- displays client cmds menu")
|
register_clcmd("amx_clcmdmenu", "cmdClcmdMenu", ADMIN_LEVEL_A, "- displays client cmds menu")
|
||||||
|
|
||||||
register_menucmd(register_menuid("Ban Menu"),1023,"actionBanMenu")
|
register_menucmd(register_menuid("Ban Menu"), 1023, "actionBanMenu")
|
||||||
register_menucmd(register_menuid("Kick Menu"),1023,"actionKickMenu")
|
register_menucmd(register_menuid("Kick Menu"), 1023, "actionKickMenu")
|
||||||
register_menucmd(register_menuid("Slap/Slay Menu"),1023,"actionSlapMenu")
|
register_menucmd(register_menuid("Slap/Slay Menu"), 1023, "actionSlapMenu")
|
||||||
register_menucmd(register_menuid("Team Menu"),1023,"actionTeamMenu")
|
register_menucmd(register_menuid("Team Menu"), 1023, "actionTeamMenu")
|
||||||
register_menucmd(register_menuid("Client Cmds Menu"),1023,"actionClcmdMenu")
|
register_menucmd(register_menuid("Client Cmds Menu"), 1023, "actionClcmdMenu")
|
||||||
|
|
||||||
g_coloredMenus = colored_menus()
|
g_coloredMenus = colored_menus()
|
||||||
|
|
||||||
@ -95,6 +95,7 @@ public module_filter(const module[])
|
|||||||
{
|
{
|
||||||
if (equali(module, "cstrike"))
|
if (equali(module, "cstrike"))
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
|
|
||||||
return PLUGIN_CONTINUE
|
return PLUGIN_CONTINUE
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,15 +109,19 @@ public native_filter(const name[], index, trap)
|
|||||||
|
|
||||||
/* Ban menu */
|
/* Ban menu */
|
||||||
|
|
||||||
public actionBanMenu(id,key) {
|
public actionBanMenu(id, key)
|
||||||
switch (key) {
|
{
|
||||||
case 7: {
|
switch (key)
|
||||||
/* BEGIN OF CHANGES BY MISTAGEE
|
{
|
||||||
ADDED A FEW MORE OPTIONS */
|
case 7:
|
||||||
|
{
|
||||||
|
/* BEGIN OF CHANGES BY MISTAGEE ADDED A FEW MORE OPTIONS */
|
||||||
|
|
||||||
++g_menuOption[id]
|
++g_menuOption[id]
|
||||||
g_menuOption[id] %= 7
|
g_menuOption[id] %= 7
|
||||||
|
|
||||||
switch(g_menuOption[id]){
|
switch (g_menuOption[id])
|
||||||
|
{
|
||||||
case 0: g_menuSettings[id] = 0
|
case 0: g_menuSettings[id] = 0
|
||||||
case 1: g_menuSettings[id] = 5
|
case 1: g_menuSettings[id] = 5
|
||||||
case 2: g_menuSettings[id] = 10
|
case 2: g_menuSettings[id] = 10
|
||||||
@ -126,50 +131,59 @@ public actionBanMenu(id,key) {
|
|||||||
case 6: g_menuSettings[id] = 60
|
case 6: g_menuSettings[id] = 60
|
||||||
}
|
}
|
||||||
|
|
||||||
displayBanMenu(id,g_menuPosition[id])
|
displayBanMenu(id, g_menuPosition[id])
|
||||||
}
|
}
|
||||||
case 8: displayBanMenu(id,++g_menuPosition[id])
|
case 8: displayBanMenu(id, ++g_menuPosition[id])
|
||||||
case 9: displayBanMenu(id,--g_menuPosition[id])
|
case 9: displayBanMenu(id, --g_menuPosition[id])
|
||||||
default: {
|
default:
|
||||||
|
{
|
||||||
new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
|
new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
|
||||||
|
new name[32], name2[32], authid[32], authid2[32]
|
||||||
|
|
||||||
|
get_user_name(player, name2, 31)
|
||||||
|
get_user_authid(id, authid, 31)
|
||||||
|
get_user_authid(player, authid2, 31)
|
||||||
|
get_user_name(id, name, 31)
|
||||||
|
|
||||||
new name[32], name2[32], authid[32],authid2[32]
|
|
||||||
get_user_name(player,name2,31)
|
|
||||||
get_user_authid(id,authid,31)
|
|
||||||
get_user_authid(player,authid2,31)
|
|
||||||
get_user_name(id,name,31)
|
|
||||||
new userid2 = get_user_userid(player)
|
new userid2 = get_user_userid(player)
|
||||||
|
|
||||||
log_amx("Ban: ^"%s<%d><%s><>^" ban and kick ^"%s<%d><%s><>^" (minutes ^"%d^")",
|
log_amx("Ban: ^"%s<%d><%s><>^" ban and kick ^"%s<%d><%s><>^" (minutes ^"%d^")", name, get_user_userid(id), authid, name2, userid2, authid2, g_menuSettings[id])
|
||||||
name,get_user_userid(id),authid, name2,userid2,authid2, g_menuSettings[id] )
|
|
||||||
|
|
||||||
switch (get_cvar_num("amx_show_activity")) {
|
switch (get_cvar_num("amx_show_activity"))
|
||||||
case 2: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_BAN_2",name,name2)
|
{
|
||||||
case 1: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_BAN_1",name2)
|
case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_BAN_2", name, name2)
|
||||||
|
case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_BAN_1", name2)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------- check for Steam ID added by MistaGee --------------------
|
/* ---------- check for Steam ID added by MistaGee --------------------
|
||||||
IF AUTHID == 4294967295 OR VALVE_ID_LAN OR HLTV, BAN PER IP TO NOT BAN EVERYONE */
|
IF AUTHID == 4294967295 OR VALVE_ID_LAN OR HLTV, BAN PER IP TO NOT BAN EVERYONE */
|
||||||
if ( (equal("4294967295",authid2)) || (equal("HLTV",authid2)) || (equali("VALVE_ID_LAN",authid2))) { /* lan or HLTV!*/ /* END OF MODIFICATIONS BY MISTAGEE */
|
|
||||||
|
if ((equal("4294967295", authid2)) || (equal("HLTV", authid2)) || (equali("VALVE_ID_LAN", authid2))) /* lan or HLTV!*/
|
||||||
|
{
|
||||||
|
/* END OF MODIFICATIONS BY MISTAGEE */
|
||||||
new ipa[32]
|
new ipa[32]
|
||||||
get_user_ip(player,ipa,31,1)
|
get_user_ip(player, ipa, 31, 1)
|
||||||
server_cmd("addip %d %s;writeip",g_menuSettings[id],ipa)
|
|
||||||
|
server_cmd("addip %d %s;writeip", g_menuSettings[id], ipa)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
server_cmd("banid %d #%d kick;writeid",g_menuSettings[id],userid2)
|
server_cmd("banid %d #%d kick;writeid", g_menuSettings[id], userid2)
|
||||||
|
|
||||||
server_exec()
|
server_exec()
|
||||||
|
|
||||||
displayBanMenu(id,g_menuPosition[id])
|
displayBanMenu(id, g_menuPosition[id])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
displayBanMenu(id,pos) {
|
displayBanMenu(id, pos)
|
||||||
if (pos < 0) return
|
{
|
||||||
|
if (pos < 0)
|
||||||
|
return
|
||||||
|
|
||||||
get_players(g_menuPlayers[id],g_menuPlayersNum[id])
|
get_players(g_menuPlayers[id], g_menuPlayersNum[id])
|
||||||
|
|
||||||
new menuBody[512]
|
new menuBody[512]
|
||||||
new b = 0
|
new b = 0
|
||||||
@ -180,125 +194,139 @@ displayBanMenu(id,pos) {
|
|||||||
if (start >= g_menuPlayersNum[id])
|
if (start >= g_menuPlayersNum[id])
|
||||||
start = pos = g_menuPosition[id] = 0
|
start = pos = g_menuPosition[id] = 0
|
||||||
|
|
||||||
new len = format(menuBody,511, g_coloredMenus ?
|
new len = format(menuBody, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "BAN_MENU", pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0)))
|
||||||
"\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n",
|
|
||||||
id,"BAN_MENU",pos+1,( g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )) )
|
|
||||||
|
|
||||||
new end = start + 7
|
new end = start + 7
|
||||||
new keys = MENU_KEY_0|MENU_KEY_8
|
new keys = MENU_KEY_0|MENU_KEY_8
|
||||||
|
|
||||||
if (end > g_menuPlayersNum[id])
|
if (end > g_menuPlayersNum[id])
|
||||||
end = g_menuPlayersNum[id]
|
end = g_menuPlayersNum[id]
|
||||||
|
|
||||||
for (new a = start; a < end; ++a) {
|
for (new a = start; a < end; ++a)
|
||||||
|
{
|
||||||
i = g_menuPlayers[id][a]
|
i = g_menuPlayers[id][a]
|
||||||
get_user_name(i,name,31)
|
get_user_name(i, name, 31)
|
||||||
|
|
||||||
if ( is_user_bot(i) || access(i,ADMIN_IMMUNITY) ) {
|
if (is_user_bot(i) || access(i, ADMIN_IMMUNITY))
|
||||||
|
{
|
||||||
++b
|
++b
|
||||||
if ( g_coloredMenus )
|
|
||||||
len += format(menuBody[len],511-len,"\d%d. %s^n\w",b,name)
|
if (g_coloredMenus)
|
||||||
|
len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, name)
|
||||||
else
|
else
|
||||||
len += format(menuBody[len],511-len,"#. %s^n",name)
|
len += format(menuBody[len], 511-len, "#. %s^n", name)
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
keys |= (1<<b)
|
keys |= (1<<b)
|
||||||
len += format(menuBody[len],511-len,"%d. %s^n",++b,name)
|
len += format(menuBody[len], 511-len, "%d. %s^n", ++b, name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( g_menuSettings[id] )
|
if (g_menuSettings[id])
|
||||||
len += format(menuBody[len],511-len,"^n8. %L^n", id, "BAN_FOR_MIN", g_menuSettings[id] )
|
len += format(menuBody[len], 511-len, "^n8. %L^n", id, "BAN_FOR_MIN", g_menuSettings[id])
|
||||||
else
|
else
|
||||||
len += format(menuBody[len],511-len,"^n8. %L^n", id, "BAN_PERM" )
|
len += format(menuBody[len], 511-len, "^n8. %L^n", id, "BAN_PERM")
|
||||||
|
|
||||||
if (end != g_menuPlayersNum[id]) {
|
if (end != g_menuPlayersNum[id])
|
||||||
format(menuBody[len],511-len,"^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
|
{
|
||||||
|
format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
|
||||||
keys |= MENU_KEY_9
|
keys |= MENU_KEY_9
|
||||||
}
|
}
|
||||||
else format(menuBody[len],511-len,"^n0. %L", id, pos ? "BACK" : "EXIT")
|
else
|
||||||
|
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
|
||||||
|
|
||||||
show_menu(id,keys,menuBody,-1,"Ban Menu")
|
show_menu(id, keys, menuBody, -1, "Ban Menu")
|
||||||
}
|
}
|
||||||
|
|
||||||
public cmdBanMenu(id,level,cid) {
|
public cmdBanMenu(id, level, cid)
|
||||||
if (!cmd_access(id,level,cid,1))
|
{
|
||||||
|
if (!cmd_access(id, level, cid, 1))
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
|
|
||||||
g_menuOption[id] = 1
|
g_menuOption[id] = 1
|
||||||
g_menuSettings[id] = 5
|
g_menuSettings[id] = 5
|
||||||
displayBanMenu(id,g_menuPosition[id] = 0)
|
displayBanMenu(id, g_menuPosition[id] = 0)
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Slap/Slay */
|
/* Slap/Slay */
|
||||||
|
|
||||||
public actionSlapMenu(id,key) {
|
public actionSlapMenu(id, key)
|
||||||
switch (key) {
|
{
|
||||||
case 7: {
|
switch (key)
|
||||||
|
{
|
||||||
|
case 7:
|
||||||
|
{
|
||||||
++g_menuOption[id]
|
++g_menuOption[id]
|
||||||
g_menuOption[id] %= 4
|
g_menuOption[id] %= 4
|
||||||
switch (g_menuOption[id]) {
|
|
||||||
|
switch (g_menuOption[id])
|
||||||
|
{
|
||||||
case 1: g_menuSettings[id] = 0
|
case 1: g_menuSettings[id] = 0
|
||||||
case 2: g_menuSettings[id] = 1
|
case 2: g_menuSettings[id] = 1
|
||||||
case 3: g_menuSettings[id] = 5
|
case 3: g_menuSettings[id] = 5
|
||||||
}
|
}
|
||||||
displaySlapMenu(id,g_menuPosition[id])
|
|
||||||
|
displaySlapMenu(id, g_menuPosition[id])
|
||||||
}
|
}
|
||||||
case 8: displaySlapMenu(id,++g_menuPosition[id])
|
case 8: displaySlapMenu(id, ++g_menuPosition[id])
|
||||||
case 9: displaySlapMenu(id,--g_menuPosition[id])
|
case 9: displaySlapMenu(id, --g_menuPosition[id])
|
||||||
default: {
|
default:
|
||||||
|
{
|
||||||
new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
|
new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
|
||||||
|
|
||||||
new name2[32]
|
new name2[32]
|
||||||
get_user_name(player,name2,31)
|
|
||||||
|
|
||||||
if (!is_user_alive(player)) {
|
get_user_name(player, name2, 31)
|
||||||
client_print(id,print_chat,"%L",id,"CANT_PERF_DEAD",name2)
|
|
||||||
displaySlapMenu(id,g_menuPosition[id])
|
if (!is_user_alive(player))
|
||||||
|
{
|
||||||
|
client_print(id, print_chat, "%L", id, "CANT_PERF_DEAD", name2)
|
||||||
|
displaySlapMenu(id, g_menuPosition[id])
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
new authid[32],authid2[32], name[32]
|
new authid[32], authid2[32], name[32]
|
||||||
|
|
||||||
get_user_authid(id,authid,31)
|
get_user_authid(id, authid, 31)
|
||||||
get_user_authid(player,authid2,31)
|
get_user_authid(player, authid2, 31)
|
||||||
get_user_name(id,name,31)
|
get_user_name(id, name, 31)
|
||||||
|
|
||||||
if ( g_menuOption[id] ) {
|
if (g_menuOption[id])
|
||||||
log_amx("Cmd: ^"%s<%d><%s><>^" slap with %d damage ^"%s<%d><%s><>^"",
|
{
|
||||||
name,get_user_userid(id),authid, g_menuSettings[id], name2,get_user_userid(player),authid2 )
|
log_amx("Cmd: ^"%s<%d><%s><>^" slap with %d damage ^"%s<%d><%s><>^"", name, get_user_userid(id), authid, g_menuSettings[id], name2, get_user_userid(player), authid2)
|
||||||
switch (get_cvar_num("amx_show_activity")) {
|
|
||||||
case 2: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_SLAP_2",name,name2,g_menuSettings[id])
|
switch (get_cvar_num("amx_show_activity"))
|
||||||
case 1: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_SLAP_1",name2,g_menuSettings[id])
|
{
|
||||||
|
case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_SLAP_2", name, name2, g_menuSettings[id])
|
||||||
|
case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_SLAP_1", name2, g_menuSettings[id])
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
log_amx("Cmd: ^"%s<%d><%s><>^" slay ^"%s<%d><%s><>^"", name, get_user_userid(id), authid, name2, get_user_userid(player), authid2)
|
||||||
log_amx("Cmd: ^"%s<%d><%s><>^" slay ^"%s<%d><%s><>^"",
|
|
||||||
name,get_user_userid(id),authid, name2,get_user_userid(player),authid2 )
|
switch (get_cvar_num("amx_show_activity"))
|
||||||
switch(get_cvar_num("amx_show_activity")) {
|
{
|
||||||
case 2: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_SLAY_2",name,name2)
|
case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_SLAY_2", name, name2)
|
||||||
case 1: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_SLAY_1",name2)
|
case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_SLAY_1", name2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( g_menuOption[id])
|
if (g_menuOption[id])
|
||||||
user_slap(player, ( get_user_health(player) > g_menuSettings[id] ) ? g_menuSettings[id] : 0 )
|
user_slap(player, (get_user_health(player) > g_menuSettings[id]) ? g_menuSettings[id] : 0)
|
||||||
else
|
else
|
||||||
user_kill( player )
|
user_kill(player)
|
||||||
|
|
||||||
displaySlapMenu(id,g_menuPosition[id])
|
displaySlapMenu(id, g_menuPosition[id])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
displaySlapMenu(id, pos)
|
||||||
|
{
|
||||||
|
if (pos < 0)
|
||||||
|
return
|
||||||
|
|
||||||
displaySlapMenu(id,pos) {
|
get_players(g_menuPlayers[id], g_menuPlayersNum[id])
|
||||||
if (pos < 0) return
|
|
||||||
|
|
||||||
get_players(g_menuPlayers[id],g_menuPlayersNum[id])
|
|
||||||
|
|
||||||
new menuBody[512]
|
new menuBody[512]
|
||||||
new b = 0
|
new b = 0
|
||||||
@ -309,113 +337,121 @@ displaySlapMenu(id,pos) {
|
|||||||
if (start >= g_menuPlayersNum[id])
|
if (start >= g_menuPlayersNum[id])
|
||||||
start = pos = g_menuPosition[id] = 0
|
start = pos = g_menuPosition[id] = 0
|
||||||
|
|
||||||
new len = format(menuBody,511, g_coloredMenus ?
|
new len = format(menuBody, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "SLAP_SLAY_MENU", pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0)))
|
||||||
"\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n",
|
|
||||||
id,"SLAP_SLAY_MENU",pos+1,( g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )) )
|
|
||||||
|
|
||||||
new end = start + 7
|
new end = start + 7
|
||||||
new keys = MENU_KEY_0|MENU_KEY_8
|
new keys = MENU_KEY_0|MENU_KEY_8
|
||||||
|
|
||||||
if (end > g_menuPlayersNum[id])
|
if (end > g_menuPlayersNum[id])
|
||||||
end = g_menuPlayersNum[id]
|
end = g_menuPlayersNum[id]
|
||||||
|
|
||||||
for (new a = start; a < end; ++a) {
|
for (new a = start; a < end; ++a)
|
||||||
|
{
|
||||||
i = g_menuPlayers[id][a]
|
i = g_menuPlayers[id][a]
|
||||||
get_user_name(i,name,31)
|
get_user_name(i, name, 31)
|
||||||
|
|
||||||
if (g_cstrike)
|
if (g_cstrike)
|
||||||
{
|
{
|
||||||
if (cs_get_user_team(i) == CS_TEAM_T)
|
if (cs_get_user_team(i) == CS_TEAM_T)
|
||||||
{
|
{
|
||||||
copy(team, 3, "TE")
|
copy(team, 3, "TE")
|
||||||
} else if (cs_get_user_team(i) == CS_TEAM_CT) {
|
}
|
||||||
|
else if (cs_get_user_team(i) == CS_TEAM_CT)
|
||||||
|
{
|
||||||
copy(team, 3, "CT")
|
copy(team, 3, "CT")
|
||||||
} else {
|
} else {
|
||||||
get_user_team(i,team,3)
|
get_user_team(i, team, 3)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
get_user_team(i,team,3)
|
get_user_team(i, team, 3)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !is_user_alive(i) || access(i,ADMIN_IMMUNITY) ) {
|
if (!is_user_alive(i) || access(i, ADMIN_IMMUNITY))
|
||||||
++b
|
|
||||||
if ( g_coloredMenus )
|
|
||||||
len += format(menuBody[len],511-len,"\d%d. %s\R%s^n\w", b,name,team)
|
|
||||||
else
|
|
||||||
len += format(menuBody[len],511-len,"#. %s %s^n",name,team)
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
keys |= (1<<b)
|
++b
|
||||||
|
|
||||||
len += format(menuBody[len],511-len, g_coloredMenus ?
|
if (g_coloredMenus)
|
||||||
"%d. %s\y\R%s^n\w" : "%d. %s %s^n",++b,name,team)
|
len += format(menuBody[len], 511-len, "\d%d. %s\R%s^n\w", b, name, team)
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( g_menuOption[id] )
|
|
||||||
len += format(menuBody[len],511-len,"^n8. %L^n",id,"SLAP_WITH_DMG",g_menuSettings[id] )
|
|
||||||
else
|
else
|
||||||
len += format(menuBody[len],511-len,"^n8. %L^n",id,"SLAY")
|
len += format(menuBody[len], 511-len, "#. %s %s^n", name, team)
|
||||||
|
} else {
|
||||||
|
keys |= (1<<b)
|
||||||
|
len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s\y\R%s^n\w" : "%d. %s %s^n", ++b, name, team)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (end != g_menuPlayersNum[id]) {
|
if (g_menuOption[id])
|
||||||
format(menuBody[len],511-len,"^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
|
len += format(menuBody[len], 511-len, "^n8. %L^n", id, "SLAP_WITH_DMG", g_menuSettings[id])
|
||||||
|
else
|
||||||
|
len += format(menuBody[len], 511-len, "^n8. %L^n", id, "SLAY")
|
||||||
|
|
||||||
|
if (end != g_menuPlayersNum[id])
|
||||||
|
{
|
||||||
|
format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
|
||||||
keys |= MENU_KEY_9
|
keys |= MENU_KEY_9
|
||||||
}
|
}
|
||||||
else format(menuBody[len],511-len,"^n0. %L", id, pos ? "BACK" : "EXIT")
|
else
|
||||||
|
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
|
||||||
|
|
||||||
show_menu(id,keys,menuBody,-1,"Slap/Slay Menu")
|
show_menu(id, keys, menuBody, -1, "Slap/Slay Menu")
|
||||||
}
|
}
|
||||||
|
|
||||||
public cmdSlapMenu(id,level,cid)
|
public cmdSlapMenu(id, level, cid)
|
||||||
{
|
{
|
||||||
if (!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
|
if (!cmd_access(id, level, cid, 1))
|
||||||
|
return PLUGIN_HANDLED
|
||||||
|
|
||||||
g_menuOption[id] = 0
|
g_menuOption[id] = 0
|
||||||
g_menuSettings[id] = 0
|
g_menuSettings[id] = 0
|
||||||
|
|
||||||
displaySlapMenu(id,g_menuPosition[id] = 0)
|
displaySlapMenu(id, g_menuPosition[id] = 0)
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Kick */
|
/* Kick */
|
||||||
|
|
||||||
public actionKickMenu(id,key)
|
public actionKickMenu(id, key)
|
||||||
{
|
{
|
||||||
switch (key) {
|
switch (key)
|
||||||
case 8: displayKickMenu(id,++g_menuPosition[id])
|
{
|
||||||
case 9: displayKickMenu(id,--g_menuPosition[id])
|
case 8: displayKickMenu(id, ++g_menuPosition[id])
|
||||||
default: {
|
case 9: displayKickMenu(id, --g_menuPosition[id])
|
||||||
|
default:
|
||||||
|
{
|
||||||
new player = g_menuPlayers[id][g_menuPosition[id] * 8 + key]
|
new player = g_menuPlayers[id][g_menuPosition[id] * 8 + key]
|
||||||
|
new authid[32], authid2[32], name[32], name2[32]
|
||||||
|
|
||||||
|
get_user_authid(id, authid, 31)
|
||||||
|
get_user_authid(player, authid2, 31)
|
||||||
|
get_user_name(id, name, 31)
|
||||||
|
get_user_name(player, name2, 31)
|
||||||
|
|
||||||
new authid[32],authid2[32], name[32], name2[32]
|
|
||||||
get_user_authid(id,authid,31)
|
|
||||||
get_user_authid(player,authid2,31)
|
|
||||||
get_user_name(id,name,31)
|
|
||||||
get_user_name(player,name2,31)
|
|
||||||
new userid2 = get_user_userid(player)
|
new userid2 = get_user_userid(player)
|
||||||
|
|
||||||
log_amx("Kick: ^"%s<%d><%s><>^" kick ^"%s<%d><%s><>^"",
|
log_amx("Kick: ^"%s<%d><%s><>^" kick ^"%s<%d><%s><>^"", name, get_user_userid(id), authid, name2, userid2, authid2)
|
||||||
name,get_user_userid(id),authid, name2,userid2,authid2 )
|
|
||||||
|
|
||||||
switch (get_cvar_num("amx_show_activity")) {
|
switch (get_cvar_num("amx_show_activity"))
|
||||||
case 2: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_KICK_2",name,name2)
|
{
|
||||||
case 1: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_KICK_1",name2)
|
case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_KICK_2", name, name2)
|
||||||
|
case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_KICK_1", name2)
|
||||||
}
|
}
|
||||||
|
|
||||||
server_cmd("kick #%d",userid2)
|
server_cmd("kick #%d", userid2)
|
||||||
server_exec()
|
server_exec()
|
||||||
|
|
||||||
displayKickMenu(id,g_menuPosition[id])
|
displayKickMenu(id, g_menuPosition[id])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
displayKickMenu(id,pos) {
|
displayKickMenu(id, pos)
|
||||||
if (pos < 0) return
|
{
|
||||||
|
if (pos < 0)
|
||||||
|
return
|
||||||
|
|
||||||
get_players(g_menuPlayers[id],g_menuPlayersNum[id])
|
get_players(g_menuPlayers[id], g_menuPlayersNum[id])
|
||||||
|
|
||||||
new menuBody[512]
|
new menuBody[512]
|
||||||
new b = 0
|
new b = 0
|
||||||
@ -426,74 +462,80 @@ displayKickMenu(id,pos) {
|
|||||||
if (start >= g_menuPlayersNum[id])
|
if (start >= g_menuPlayersNum[id])
|
||||||
start = pos = g_menuPosition[id] = 0
|
start = pos = g_menuPosition[id] = 0
|
||||||
|
|
||||||
new len = format(menuBody,511, g_coloredMenus ?
|
new len = format(menuBody, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "KICK_MENU", pos + 1, (g_menuPlayersNum[id] / 8 + ((g_menuPlayersNum[id] % 8) ? 1 : 0)))
|
||||||
"\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n",
|
|
||||||
id,"KICK_MENU",pos+1,( g_menuPlayersNum[id] / 8 + ((g_menuPlayersNum[id] % 8) ? 1 : 0 )) )
|
|
||||||
|
|
||||||
new end = start + 8
|
new end = start + 8
|
||||||
new keys = MENU_KEY_0
|
new keys = MENU_KEY_0
|
||||||
|
|
||||||
if (end > g_menuPlayersNum[id])
|
if (end > g_menuPlayersNum[id])
|
||||||
end = g_menuPlayersNum[id]
|
end = g_menuPlayersNum[id]
|
||||||
|
|
||||||
for (new a = start; a < end; ++a) {
|
for (new a = start; a < end; ++a)
|
||||||
|
{
|
||||||
i = g_menuPlayers[id][a]
|
i = g_menuPlayers[id][a]
|
||||||
get_user_name(i,name,31)
|
get_user_name(i, name, 31)
|
||||||
|
|
||||||
if ( access(i,ADMIN_IMMUNITY) ) {
|
if (access(i, ADMIN_IMMUNITY))
|
||||||
|
{
|
||||||
++b
|
++b
|
||||||
if ( g_coloredMenus )
|
|
||||||
len += format(menuBody[len],511-len,"\d%d. %s^n\w",b,name)
|
if (g_coloredMenus)
|
||||||
|
len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, name)
|
||||||
else
|
else
|
||||||
len += format(menuBody[len],511-len,"#. %s^n",name)
|
len += format(menuBody[len], 511-len, "#. %s^n", name)
|
||||||
|
} else {
|
||||||
}
|
|
||||||
else {
|
|
||||||
keys |= (1<<b)
|
keys |= (1<<b)
|
||||||
len += format(menuBody[len],511-len,"%d. %s^n",++b,name)
|
len += format(menuBody[len], 511-len, "%d. %s^n", ++b, name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (end != g_menuPlayersNum[id]) {
|
if (end != g_menuPlayersNum[id])
|
||||||
format(menuBody[len],511-len,"^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
|
{
|
||||||
|
format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
|
||||||
keys |= MENU_KEY_9
|
keys |= MENU_KEY_9
|
||||||
}
|
}
|
||||||
else format(menuBody[len],511-len,"^n0. %L", id, pos ? "BACK" : "EXIT")
|
else
|
||||||
|
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
|
||||||
|
|
||||||
show_menu(id,keys,menuBody,-1,"Kick Menu")
|
show_menu(id, keys, menuBody, -1, "Kick Menu")
|
||||||
}
|
}
|
||||||
|
|
||||||
public cmdKickMenu(id,level,cid) {
|
public cmdKickMenu(id, level, cid)
|
||||||
if (cmd_access(id,level,cid,1))
|
{
|
||||||
displayKickMenu(id,g_menuPosition[id] = 0)
|
if (cmd_access(id, level, cid, 1))
|
||||||
|
displayKickMenu(id, g_menuPosition[id] = 0)
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Team menu */
|
/* Team menu */
|
||||||
|
|
||||||
public actionTeamMenu(id,key) {
|
public actionTeamMenu(id, key)
|
||||||
switch (key) {
|
{
|
||||||
case 7:{
|
switch (key)
|
||||||
|
{
|
||||||
|
case 7:
|
||||||
|
{
|
||||||
g_menuOption[id] = 1 - g_menuOption[id]
|
g_menuOption[id] = 1 - g_menuOption[id]
|
||||||
displayTeamMenu(id,g_menuPosition[id])
|
displayTeamMenu(id, g_menuPosition[id])
|
||||||
}
|
}
|
||||||
case 8: displayTeamMenu(id,++g_menuPosition[id])
|
case 8: displayTeamMenu(id, ++g_menuPosition[id])
|
||||||
case 9: displayTeamMenu(id,--g_menuPosition[id])
|
case 9: displayTeamMenu(id, --g_menuPosition[id])
|
||||||
default: {
|
default:
|
||||||
|
{
|
||||||
new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
|
new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
|
||||||
new authid[32],authid2[32], name[32], name2[32]
|
new authid[32], authid2[32], name[32], name2[32]
|
||||||
get_user_name(player,name2,31)
|
|
||||||
get_user_authid(id,authid,31)
|
|
||||||
get_user_authid(player,authid2,31)
|
|
||||||
get_user_name(id,name,31)
|
|
||||||
|
|
||||||
log_amx("Cmd: ^"%s<%d><%s><>^" transfer ^"%s<%d><%s><>^" (team ^"%s^")",
|
get_user_name(player, name2, 31)
|
||||||
name,get_user_userid(id),authid, name2,get_user_userid(player),authid2, g_menuOption[id] ? "TERRORIST" : "CT" )
|
get_user_authid(id, authid, 31)
|
||||||
|
get_user_authid(player, authid2, 31)
|
||||||
|
get_user_name(id, name, 31)
|
||||||
|
|
||||||
switch (get_cvar_num("amx_show_activity")) {
|
log_amx("Cmd: ^"%s<%d><%s><>^" transfer ^"%s<%d><%s><>^" (team ^"%s^")", name, get_user_userid(id), authid, name2, get_user_userid(player), authid2, g_menuOption[id] ? "TERRORIST" : "CT")
|
||||||
case 2: client_print(0,print_chat,"%L",id,"ADMIN_TRANSF_2",name,name2,g_menuOption[id] ? "TERRORIST" : "CT" )
|
|
||||||
case 1: client_print(0,print_chat,"%L",id,"ADMIN_TRANSF_1",name2,g_menuOption[id] ? "TERRORIST" : "CT" )
|
switch (get_cvar_num("amx_show_activity"))
|
||||||
|
{
|
||||||
|
case 2: client_print(0, print_chat, "%L", id, "ADMIN_TRANSF_2", name, name2, g_menuOption[id] ? "TERRORIST" : "CT")
|
||||||
|
case 1: client_print(0, print_chat, "%L", id, "ADMIN_TRANSF_1", name2, g_menuOption[id] ? "TERRORIST" : "CT")
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_cstrike)
|
if (g_cstrike)
|
||||||
@ -502,23 +544,26 @@ public actionTeamMenu(id,key) {
|
|||||||
cs_reset_user_model(player)
|
cs_reset_user_model(player)
|
||||||
} else {
|
} else {
|
||||||
new limit_setting = get_cvar_num("mp_limitteams")
|
new limit_setting = get_cvar_num("mp_limitteams")
|
||||||
|
|
||||||
set_cvar_num("mp_limitteams", 0)
|
set_cvar_num("mp_limitteams", 0)
|
||||||
engclient_cmd(player, "jointeam", g_menuOption[id] ? "1" : "2")
|
engclient_cmd(player, "jointeam", g_menuOption[id] ? "1" : "2")
|
||||||
engclient_cmd(player, "joinclass", "1")
|
engclient_cmd(player, "joinclass", "1")
|
||||||
set_cvar_num("mp_limitteams", limit_setting)
|
set_cvar_num("mp_limitteams", limit_setting)
|
||||||
}
|
}
|
||||||
|
|
||||||
displayTeamMenu(id,g_menuPosition[id])
|
displayTeamMenu(id, g_menuPosition[id])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
displayTeamMenu(id, pos)
|
||||||
|
{
|
||||||
|
if (pos < 0)
|
||||||
|
return
|
||||||
|
|
||||||
displayTeamMenu(id,pos) {
|
get_players(g_menuPlayers[id], g_menuPlayersNum[id])
|
||||||
if (pos < 0) return
|
|
||||||
|
|
||||||
get_players(g_menuPlayers[id],g_menuPlayersNum[id])
|
|
||||||
|
|
||||||
new menuBody[512]
|
new menuBody[512]
|
||||||
new b = 0
|
new b = 0
|
||||||
@ -529,111 +574,131 @@ displayTeamMenu(id,pos) {
|
|||||||
if (start >= g_menuPlayersNum[id])
|
if (start >= g_menuPlayersNum[id])
|
||||||
start = pos = g_menuPosition[id] = 0
|
start = pos = g_menuPosition[id] = 0
|
||||||
|
|
||||||
new len = format(menuBody,511, g_coloredMenus ?
|
new len = format(menuBody, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "TEAM_MENU", pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0)))
|
||||||
"\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n",
|
|
||||||
id,"TEAM_MENU",pos+1,( g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )) )
|
|
||||||
|
|
||||||
new end = start + 7
|
new end = start + 7
|
||||||
new keys = MENU_KEY_0|MENU_KEY_8
|
new keys = MENU_KEY_0|MENU_KEY_8
|
||||||
|
|
||||||
if (end > g_menuPlayersNum[id])
|
if (end > g_menuPlayersNum[id])
|
||||||
end = g_menuPlayersNum[id]
|
end = g_menuPlayersNum[id]
|
||||||
|
|
||||||
for (new a = start; a < end; ++a) {
|
for (new a = start; a < end; ++a)
|
||||||
|
{
|
||||||
i = g_menuPlayers[id][a]
|
i = g_menuPlayers[id][a]
|
||||||
get_user_name(i,name,31)
|
get_user_name(i, name, 31)
|
||||||
|
|
||||||
if (g_cstrike)
|
if (g_cstrike)
|
||||||
{
|
{
|
||||||
iteam = _:cs_get_user_team(i)
|
iteam = _:cs_get_user_team(i)
|
||||||
if (iteam == 1) {
|
|
||||||
|
if (iteam == 1)
|
||||||
|
{
|
||||||
copy(team, 3, "TE")
|
copy(team, 3, "TE")
|
||||||
} else if (iteam == 2) {
|
}
|
||||||
|
else if (iteam == 2)
|
||||||
|
{
|
||||||
copy(team, 3, "CT")
|
copy(team, 3, "CT")
|
||||||
} else {
|
} else {
|
||||||
get_user_team(i,team,3)
|
get_user_team(i, team, 3)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
iteam = get_user_team(i,team,3)
|
iteam = get_user_team(i, team, 3)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (iteam == (g_menuOption[id] ? 1 : 2)) || access(i,ADMIN_IMMUNITY) ) {
|
if ((iteam == (g_menuOption[id] ? 1 : 2)) || access(i, ADMIN_IMMUNITY))
|
||||||
|
{
|
||||||
++b
|
++b
|
||||||
if ( g_coloredMenus )
|
|
||||||
len += format(menuBody[len],511-len,"\d%d. %s\R%s^n\w",b,name,team)
|
if (g_coloredMenus)
|
||||||
|
len += format(menuBody[len], 511-len, "\d%d. %s\R%s^n\w", b, name, team)
|
||||||
else
|
else
|
||||||
len += format(menuBody[len],511-len,"#. %s %s^n",name,team)
|
len += format(menuBody[len], 511-len, "#. %s %s^n", name, team)
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
keys |= (1<<b)
|
keys |= (1<<b)
|
||||||
len += format(menuBody[len],511-len, g_coloredMenus ?
|
len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s\y\R%s^n\w" : "%d. %s %s^n", ++b, name, team)
|
||||||
"%d. %s\y\R%s^n\w" : "%d. %s %s^n",++b,name,team)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
len += format(menuBody[len],511-len,"^n8. %L^n",id,"TRANSF_TO",g_menuOption[id] ? "TERRORIST" : "CT" )
|
len += format(menuBody[len], 511-len, "^n8. %L^n", id, "TRANSF_TO", g_menuOption[id] ? "TERRORIST" : "CT")
|
||||||
|
|
||||||
if (end != g_menuPlayersNum[id])
|
if (end != g_menuPlayersNum[id])
|
||||||
{
|
{
|
||||||
format(menuBody[len],511-len,"^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
|
format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
|
||||||
keys |= MENU_KEY_9
|
keys |= MENU_KEY_9
|
||||||
}
|
}
|
||||||
else format(menuBody[len],511-len,"^n0. %L", id, pos ? "BACK" : "EXIT")
|
else
|
||||||
|
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
|
||||||
|
|
||||||
show_menu(id,keys,menuBody,-1,"Team Menu")
|
show_menu(id, keys, menuBody, -1, "Team Menu")
|
||||||
}
|
}
|
||||||
|
|
||||||
public cmdTeamMenu(id,level,cid) {
|
public cmdTeamMenu(id, level, cid)
|
||||||
if (!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
|
{
|
||||||
|
if (!cmd_access(id, level, cid, 1))
|
||||||
|
return PLUGIN_HANDLED
|
||||||
|
|
||||||
g_menuOption[id] = 0
|
g_menuOption[id] = 0
|
||||||
|
|
||||||
displayTeamMenu(id,g_menuPosition[id] = 0)
|
displayTeamMenu(id, g_menuPosition[id] = 0)
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Client cmds menu */
|
/* Client cmds menu */
|
||||||
|
|
||||||
public actionClcmdMenu(id,key) {
|
public actionClcmdMenu(id, key)
|
||||||
switch (key) {
|
{
|
||||||
case 7:{
|
switch (key)
|
||||||
|
{
|
||||||
|
case 7:
|
||||||
|
{
|
||||||
++g_menuOption[id]
|
++g_menuOption[id]
|
||||||
g_menuOption[id] %= g_menuSelectNum[id]
|
g_menuOption[id] %= g_menuSelectNum[id]
|
||||||
displayClcmdMenu(id,g_menuPosition[id])
|
displayClcmdMenu(id, g_menuPosition[id])
|
||||||
}
|
}
|
||||||
case 8: displayClcmdMenu(id,++g_menuPosition[id])
|
case 8: displayClcmdMenu(id, ++g_menuPosition[id])
|
||||||
case 9: displayClcmdMenu(id,--g_menuPosition[id])
|
case 9: displayClcmdMenu(id, --g_menuPosition[id])
|
||||||
default: {
|
default:
|
||||||
|
{
|
||||||
new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
|
new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
|
||||||
new flags = g_clcmdMisc[g_menuSelect[id][g_menuOption[id]]][1]
|
new flags = g_clcmdMisc[g_menuSelect[id][g_menuOption[id]]][1]
|
||||||
if (is_user_connected(player)) {
|
|
||||||
|
if (is_user_connected(player))
|
||||||
|
{
|
||||||
new command[64], authid[32], name[32], userid[32]
|
new command[64], authid[32], name[32], userid[32]
|
||||||
copy(command,63,g_clcmdCmd[g_menuSelect[id][g_menuOption[id]]])
|
|
||||||
get_user_authid(player,authid,31)
|
copy(command, 63, g_clcmdCmd[g_menuSelect[id][g_menuOption[id]]])
|
||||||
get_user_name(player,name,31)
|
get_user_authid(player, authid, 31)
|
||||||
num_to_str(get_user_userid(player),userid,31)
|
get_user_name(player, name, 31)
|
||||||
replace(command,63,"%userid%",userid)
|
num_to_str(get_user_userid(player), userid, 31)
|
||||||
replace(command,63,"%authid%",authid)
|
|
||||||
replace(command,63,"%name%",name)
|
replace(command, 63, "%userid%", userid)
|
||||||
if (flags & 1) {
|
replace(command, 63, "%authid%", authid)
|
||||||
|
replace(command, 63, "%name%", name)
|
||||||
|
|
||||||
|
if (flags & 1)
|
||||||
|
{
|
||||||
server_cmd(command)
|
server_cmd(command)
|
||||||
server_exec()
|
server_exec()
|
||||||
}
|
} else if (flags & 2)
|
||||||
else if (flags & 2)
|
client_cmd(id, command)
|
||||||
client_cmd(id,command)
|
|
||||||
else if (flags & 4)
|
else if (flags & 4)
|
||||||
client_cmd(player,command)
|
client_cmd(player, command)
|
||||||
}
|
}
|
||||||
if (flags & 8) displayClcmdMenu(id,g_menuPosition[id])
|
|
||||||
|
if (flags & 8)
|
||||||
|
displayClcmdMenu(id, g_menuPosition[id])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
displayClcmdMenu(id,pos) {
|
displayClcmdMenu(id, pos)
|
||||||
if (pos < 0) return
|
{
|
||||||
|
if (pos < 0)
|
||||||
|
return
|
||||||
|
|
||||||
get_players(g_menuPlayers[id],g_menuPlayersNum[id])
|
get_players(g_menuPlayers[id], g_menuPlayersNum[id])
|
||||||
|
|
||||||
new menuBody[512]
|
new menuBody[512]
|
||||||
new b = 0
|
new b = 0
|
||||||
@ -644,49 +709,51 @@ displayClcmdMenu(id,pos) {
|
|||||||
if (start >= g_menuPlayersNum[id])
|
if (start >= g_menuPlayersNum[id])
|
||||||
start = pos = g_menuPosition[id] = 0
|
start = pos = g_menuPosition[id] = 0
|
||||||
|
|
||||||
new len = format(menuBody,511, g_coloredMenus ?
|
new len = format(menuBody, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "CL_CMD_MENU", pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0)))
|
||||||
"\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n",
|
|
||||||
id, "CL_CMD_MENU", pos+1,( g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )) )
|
|
||||||
|
|
||||||
new end = start + 7
|
new end = start + 7
|
||||||
new keys = MENU_KEY_0|MENU_KEY_8
|
new keys = MENU_KEY_0|MENU_KEY_8
|
||||||
|
|
||||||
if (end > g_menuPlayersNum[id])
|
if (end > g_menuPlayersNum[id])
|
||||||
end = g_menuPlayersNum[id]
|
end = g_menuPlayersNum[id]
|
||||||
|
|
||||||
for (new a = start; a < end; ++a) {
|
for (new a = start; a < end; ++a)
|
||||||
|
{
|
||||||
i = g_menuPlayers[id][a]
|
i = g_menuPlayers[id][a]
|
||||||
get_user_name(i,name,31)
|
get_user_name(i, name, 31)
|
||||||
|
|
||||||
if ( !g_menuSelectNum[id] || access(i,ADMIN_IMMUNITY) ) {
|
if (!g_menuSelectNum[id] || access(i, ADMIN_IMMUNITY))
|
||||||
|
{
|
||||||
++b
|
++b
|
||||||
if ( g_coloredMenus )
|
|
||||||
len += format(menuBody[len],511-len,"\d%d. %s^n\w",b,name)
|
if (g_coloredMenus)
|
||||||
|
len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, name)
|
||||||
else
|
else
|
||||||
len += format(menuBody[len],511-len,"#. %s^n",name)
|
len += format(menuBody[len], 511-len, "#. %s^n", name)
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
keys |= (1<<b)
|
keys |= (1<<b)
|
||||||
len += format(menuBody[len],511-len,"%d. %s^n",++b,name)
|
len += format(menuBody[len], 511-len, "%d. %s^n", ++b, name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( g_menuSelectNum[id] )
|
if (g_menuSelectNum[id])
|
||||||
len += format(menuBody[len],511-len,"^n8. %s^n", g_clcmdName[g_menuSelect[id][g_menuOption[id]]] )
|
len += format(menuBody[len], 511-len, "^n8. %s^n", g_clcmdName[g_menuSelect[id][g_menuOption[id]]])
|
||||||
else
|
else
|
||||||
len += format(menuBody[len],511-len,"^n8. %L^n",id,"NO_CMDS")
|
len += format(menuBody[len], 511-len, "^n8. %L^n", id, "NO_CMDS")
|
||||||
|
|
||||||
if (end != g_menuPlayersNum[id]) {
|
if (end != g_menuPlayersNum[id])
|
||||||
format(menuBody[len],511-len,"^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
|
{
|
||||||
|
format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
|
||||||
keys |= MENU_KEY_9
|
keys |= MENU_KEY_9
|
||||||
}
|
}
|
||||||
else format(menuBody[len],511-len,"^n0. %L", id, pos ? "BACK" : "EXIT")
|
else
|
||||||
|
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
|
||||||
|
|
||||||
show_menu(id,keys,menuBody,-1,"Client Cmds Menu")
|
show_menu(id, keys, menuBody, -1, "Client Cmds Menu")
|
||||||
}
|
}
|
||||||
|
|
||||||
public cmdClcmdMenu(id,level,cid) {
|
public cmdClcmdMenu(id, level, cid)
|
||||||
if (!cmd_access(id,level,cid,1))
|
{
|
||||||
|
if (!cmd_access(id, level, cid, 1))
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
|
|
||||||
new flags = get_user_flags(id)
|
new flags = get_user_flags(id)
|
||||||
@ -699,30 +766,32 @@ public cmdClcmdMenu(id,level,cid) {
|
|||||||
|
|
||||||
g_menuOption[id] = 0
|
g_menuOption[id] = 0
|
||||||
|
|
||||||
displayClcmdMenu(id,g_menuPosition[id] = 0)
|
displayClcmdMenu(id, g_menuPosition[id] = 0)
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
load_settings( szFilename[] ) {
|
load_settings(szFilename[])
|
||||||
if ( !file_exists ( szFilename ) )
|
{
|
||||||
|
if (!file_exists(szFilename))
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
new text[256], szFlags[32], szAccess[32]
|
new text[256], szFlags[32], szAccess[32]
|
||||||
new a, pos = 0
|
new a, pos = 0
|
||||||
|
|
||||||
while ( g_clcmdNum < MAX_CLCMDS && read_file (szFilename,pos++,text,255,a) ) {
|
while (g_clcmdNum < MAX_CLCMDS && read_file(szFilename, pos++, text, 255, a))
|
||||||
if ( text[0] == ';' ) continue
|
{
|
||||||
|
if (text[0] == ';') continue
|
||||||
if ( parse( text , g_clcmdName[g_clcmdNum] , 31 ,
|
|
||||||
g_clcmdCmd[g_clcmdNum] ,63,szFlags,31,szAccess,31 ) > 3 )
|
if (parse(text, g_clcmdName[g_clcmdNum], 31, g_clcmdCmd[g_clcmdNum], 63, szFlags, 31, szAccess, 31) > 3)
|
||||||
|
{
|
||||||
|
while (replace(g_clcmdCmd[g_clcmdNum], 63, "\'", "^""))
|
||||||
{
|
{
|
||||||
while ( replace( g_clcmdCmd[ g_clcmdNum ] ,63,"\'","^"") ) {
|
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
g_clcmdMisc[ g_clcmdNum ][1] = read_flags ( szFlags )
|
g_clcmdMisc[g_clcmdNum][1] = read_flags(szFlags)
|
||||||
g_clcmdMisc[ g_clcmdNum ][0] = read_flags ( szAccess )
|
g_clcmdMisc[g_clcmdNum][0] = read_flags(szAccess)
|
||||||
g_clcmdNum++
|
g_clcmdNum++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,17 +45,19 @@ new Float:g_xPos
|
|||||||
new g_Length
|
new g_Length
|
||||||
new g_Frequency
|
new g_Frequency
|
||||||
|
|
||||||
public plugin_init() {
|
public plugin_init()
|
||||||
register_plugin("Scrolling Message",AMXX_VERSION_STR,"AMXX Dev Team")
|
{
|
||||||
|
register_plugin("Scrolling Message", AMXX_VERSION_STR, "AMXX Dev Team")
|
||||||
register_dictionary("scrollmsg.txt")
|
register_dictionary("scrollmsg.txt")
|
||||||
register_dictionary("common.txt")
|
register_dictionary("common.txt")
|
||||||
register_srvcmd("amx_scrollmsg","setMessage")
|
register_srvcmd("amx_scrollmsg", "setMessage")
|
||||||
}
|
}
|
||||||
|
|
||||||
public showMsg() {
|
public showMsg()
|
||||||
|
{
|
||||||
new a = g_startPos, i = 0
|
new a = g_startPos, i = 0
|
||||||
|
|
||||||
while( a < g_endPos )
|
while (a < g_endPos)
|
||||||
g_displayMsg[i++] = g_scrollMsg[a++]
|
g_displayMsg[i++] = g_scrollMsg[a++]
|
||||||
|
|
||||||
g_displayMsg[i] = 0
|
g_displayMsg[i] = 0
|
||||||
@ -65,44 +67,58 @@ public showMsg() {
|
|||||||
|
|
||||||
if (g_xPos > 0.35)
|
if (g_xPos > 0.35)
|
||||||
g_xPos -= 0.0063
|
g_xPos -= 0.0063
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
g_startPos++
|
g_startPos++
|
||||||
g_xPos = 0.35
|
g_xPos = 0.35
|
||||||
}
|
}
|
||||||
|
|
||||||
set_hudmessage(200, 100, 0, g_xPos, 0.90, 0, SPEED, SPEED, 0.05, 0.05, 2)
|
set_hudmessage(200, 100, 0, g_xPos, 0.90, 0, SPEED, SPEED, 0.05, 0.05, 2)
|
||||||
show_hudmessage(0,g_displayMsg)
|
show_hudmessage(0, g_displayMsg)
|
||||||
}
|
}
|
||||||
|
|
||||||
public msgInit() {
|
public msgInit()
|
||||||
|
{
|
||||||
g_endPos = 1
|
g_endPos = 1
|
||||||
g_startPos = 0
|
g_startPos = 0
|
||||||
g_xPos = 0.65
|
g_xPos = 0.65
|
||||||
set_task( SPEED , "showMsg",123,"",0,"a", g_Length + 48)
|
|
||||||
client_print(0,print_console,g_scrollMsg)
|
set_task(SPEED, "showMsg", 123, "", 0, "a", g_Length + 48)
|
||||||
|
client_print(0, print_console, g_scrollMsg)
|
||||||
}
|
}
|
||||||
|
|
||||||
public setMessage() {
|
public setMessage()
|
||||||
|
{
|
||||||
remove_task(123) /* remove current messaging */
|
remove_task(123) /* remove current messaging */
|
||||||
read_argv(1,g_scrollMsg,380)
|
read_argv(1, g_scrollMsg, 380)
|
||||||
|
|
||||||
new hostname[64]
|
new hostname[64]
|
||||||
get_cvar_string("hostname",hostname,63)
|
|
||||||
replace(g_scrollMsg,380,"%hostname%",hostname)
|
get_cvar_string("hostname", hostname, 63)
|
||||||
|
replace(g_scrollMsg, 380, "%hostname%", hostname)
|
||||||
g_Length = strlen(g_scrollMsg)
|
g_Length = strlen(g_scrollMsg)
|
||||||
|
|
||||||
new mytime[32]
|
new mytime[32]
|
||||||
read_argv(2,mytime,31)
|
|
||||||
|
read_argv(2, mytime, 31)
|
||||||
|
|
||||||
g_Frequency = str_to_num(mytime)
|
g_Frequency = str_to_num(mytime)
|
||||||
if (g_Frequency > 0) {
|
|
||||||
|
if (g_Frequency > 0)
|
||||||
|
{
|
||||||
new minimal = floatround((g_Length + 48) * (SPEED + 0.1))
|
new minimal = floatround((g_Length + 48) * (SPEED + 0.1))
|
||||||
if (g_Frequency < minimal) {
|
|
||||||
server_print("%L",LANG_SERVER,"MIN_FREQ",minimal)
|
if (g_Frequency < minimal)
|
||||||
|
{
|
||||||
|
server_print("%L", LANG_SERVER, "MIN_FREQ", minimal)
|
||||||
g_Frequency = minimal
|
g_Frequency = minimal
|
||||||
}
|
}
|
||||||
server_print("%L",LANG_SERVER,"MSG_FREQ",
|
|
||||||
g_Frequency/60,g_Frequency%60)
|
server_print("%L", LANG_SERVER, "MSG_FREQ", g_Frequency / 60, g_Frequency % 60)
|
||||||
set_task(float(g_Frequency),"msgInit",123,"",0,"b")
|
set_task(float(g_Frequency), "msgInit", 123, "", 0, "b")
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
server_print("%L",LANG_SERVER,"MSG_DISABLED")
|
server_print("%L", LANG_SERVER, "MSG_DISABLED")
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
@ -45,196 +45,266 @@ new g_menuPosition[33]
|
|||||||
new g_fileToSave[64]
|
new g_fileToSave[64]
|
||||||
new bool:g_modified
|
new bool:g_modified
|
||||||
|
|
||||||
public plugin_precache() {
|
public plugin_precache()
|
||||||
register_clcmd("amx_statscfgmenu","cmdCfgMenu",ADMIN_CFG,"- displays stats configuration menu")
|
{
|
||||||
|
register_clcmd("amx_statscfgmenu", "cmdCfgMenu", ADMIN_CFG, "- displays stats configuration menu")
|
||||||
register_dictionary("statscfg.txt")
|
register_dictionary("statscfg.txt")
|
||||||
register_dictionary("common.txt")
|
register_dictionary("common.txt")
|
||||||
register_concmd("amx_statscfg","cmdCfg",ADMIN_CFG,"- displays help for stats configuration")
|
register_concmd("amx_statscfg", "cmdCfg", ADMIN_CFG, "- displays help for stats configuration")
|
||||||
}
|
}
|
||||||
|
|
||||||
public plugin_init() {
|
public plugin_init()
|
||||||
register_plugin("Stats Configuration",AMXX_VERSION_STR,"AMXX Dev Team")
|
{
|
||||||
register_menucmd(register_menuid("Stats Configuration"),1023,"actionCfgMenu")
|
register_plugin("Stats Configuration", AMXX_VERSION_STR, "AMXX Dev Team")
|
||||||
|
register_menucmd(register_menuid("Stats Configuration"), 1023, "actionCfgMenu")
|
||||||
|
|
||||||
get_configsdir(g_fileToSave, 63)
|
get_configsdir(g_fileToSave, 63)
|
||||||
format(g_fileToSave, 63, "%s/stats.ini", g_fileToSave)
|
format(g_fileToSave, 63, "%s/stats.ini", g_fileToSave)
|
||||||
loadSettings(g_fileToSave)
|
loadSettings(g_fileToSave)
|
||||||
}
|
}
|
||||||
|
|
||||||
public cmdCfg( id,level,cid ) {
|
public cmdCfg(id, level, cid)
|
||||||
if (!cmd_access(id,level,cid,1))
|
{
|
||||||
|
if (!cmd_access(id, level, cid, 1))
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
|
|
||||||
new cmds[32]
|
new cmds[32]
|
||||||
read_argv(1,cmds,31)
|
read_argv(1, cmds, 31)
|
||||||
new option = equali(cmds, "on" ) ? 1 : 0
|
|
||||||
if ( !option ) option = equali(cmds, "off" ) ? 2 : 0
|
new option = equali(cmds, "on") ? 1 : 0
|
||||||
if ( read_argc() > 2 && option ) {
|
|
||||||
|
if (!option)
|
||||||
|
option = equali(cmds, "off") ? 2 : 0
|
||||||
|
|
||||||
|
if (read_argc() > 2 && option)
|
||||||
|
{
|
||||||
new var[32], enabled = 0
|
new var[32], enabled = 0
|
||||||
read_argv( 2 , var , 31 )
|
read_argv(2, var, 31)
|
||||||
for ( new a = 0; a < g_menuDataNum; ++a ) {
|
|
||||||
if ( containi( g_menuDataVar[ a ] , var ) != -1 ) {
|
for (new a = 0; a < g_menuDataNum; ++a)
|
||||||
|
{
|
||||||
|
if (containi(g_menuDataVar[a], var) != -1)
|
||||||
|
{
|
||||||
g_modified = true
|
g_modified = true
|
||||||
++enabled
|
++enabled
|
||||||
if ( option == 1 ) {
|
if (option == 1)
|
||||||
set_xvar_num( g_menuDataId[a] , 1 )
|
{
|
||||||
console_print(id,"%L: %s", id, "STATS_ENABLED", g_menuData[a] )
|
set_xvar_num(g_menuDataId[a], 1)
|
||||||
}
|
console_print(id, "%L: %s", id, "STATS_ENABLED", g_menuData[a])
|
||||||
else {
|
} else {
|
||||||
set_xvar_num( g_menuDataId[a] , 0 )
|
set_xvar_num(g_menuDataId[a], 0)
|
||||||
console_print(id,"%L: %s", id, "STATS_DISABLED", g_menuData[a] )
|
console_print(id, "%L: %s", id, "STATS_DISABLED", g_menuData[a])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( enabled )
|
|
||||||
console_print(id,"%L", id, "TOTAL_NUM", enabled )
|
|
||||||
else
|
|
||||||
console_print(id,"%L",id,"NO_OPTION", var )
|
|
||||||
}
|
|
||||||
else if ( equali(cmds, "save" ) ) {
|
|
||||||
if ( saveSettings( g_fileToSave ) ){
|
|
||||||
g_modified = false
|
|
||||||
console_print(id,"%L",id,"STATS_CONF_SAVED")
|
|
||||||
}
|
|
||||||
else
|
|
||||||
console_print(id,"%L",id,"STATS_CONF_FAILED")
|
|
||||||
}
|
|
||||||
else if ( equali(cmds, "load" ) ) {
|
|
||||||
if ( loadSettings( g_fileToSave ) ){
|
|
||||||
g_modified = false
|
|
||||||
console_print(id,"%L",id,"STATS_CONF_LOADED")
|
|
||||||
}
|
|
||||||
else
|
|
||||||
console_print(id,"%L",id,"STATS_CONF_FAIL_LOAD")
|
|
||||||
}
|
|
||||||
else if ( equali(cmds, "list" ) ) {
|
|
||||||
new arg1[8]
|
|
||||||
new start = read_argv(2,arg1,7) ? str_to_num(arg1) : 1
|
|
||||||
if (--start < 0) start = 0
|
|
||||||
if (start >= g_menuDataNum) start = g_menuDataNum - 1
|
|
||||||
new end = start + 10
|
|
||||||
if (end > g_menuDataNum) end = g_menuDataNum
|
|
||||||
|
|
||||||
new lName[16],lVariable[16],lStatus[16]
|
if (enabled)
|
||||||
format(lName,15,"%L",id,"NAME")
|
console_print(id, "%L", id, "TOTAL_NUM", enabled)
|
||||||
format(lVariable,15,"%L",id,"VARIABLE")
|
|
||||||
format(lStatus,15,"%L",id,"STATUS")
|
|
||||||
console_print(id, "^n----- %L: -----",id,"STATS_CONF")
|
|
||||||
console_print(id, " %-29.28s %-24.23s %-9.8s",lName,lVariable,lStatus)
|
|
||||||
if ( start != -1 ) {
|
|
||||||
new lOnOff[16]
|
|
||||||
for (new a = start; a < end; ++a) {
|
|
||||||
format(lOnOff,15,"%L",id,get_xvar_num( g_menuDataId[ a ] ) ? "ON" : "OFF")
|
|
||||||
console_print(id, "%3d: %-29.28s %-24.23s %-9.8s",a + 1,
|
|
||||||
g_menuData[a], g_menuDataVar[a], lOnOff)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
console_print(id,"----- %L -----",id,"STATS_ENTRIES_OF",start+1,end,g_menuDataNum)
|
|
||||||
if (end < g_menuDataNum)
|
|
||||||
console_print(id,"----- %L -----",id,"STATS_USE_MORE",end+1)
|
|
||||||
else
|
else
|
||||||
console_print(id,"----- %L -----",id,"STATS_USE_BEGIN")
|
console_print(id, "%L", id, "NO_OPTION", var)
|
||||||
}
|
}
|
||||||
else if ( equali(cmds, "add" ) && read_argc() > 3 ) {
|
else if (equali(cmds, "save"))
|
||||||
if ( g_menuDataNum < MAX_MENU_DATA ) {
|
{
|
||||||
read_argv(2, g_menuData[g_menuDataNum] , 31 )
|
if (saveSettings(g_fileToSave))
|
||||||
read_argv(3, g_menuDataVar[g_menuDataNum] , 31 )
|
{
|
||||||
g_menuDataId[g_menuDataNum] = get_xvar_id( g_menuDataVar[g_menuDataNum] )
|
g_modified = false
|
||||||
|
console_print(id, "%L", id, "STATS_CONF_SAVED")
|
||||||
|
}
|
||||||
|
else
|
||||||
|
console_print(id, "%L", id, "STATS_CONF_FAILED")
|
||||||
|
}
|
||||||
|
else if (equali(cmds, "load"))
|
||||||
|
{
|
||||||
|
if (loadSettings(g_fileToSave))
|
||||||
|
{
|
||||||
|
g_modified = false
|
||||||
|
console_print(id, "%L", id, "STATS_CONF_LOADED")
|
||||||
|
}
|
||||||
|
else
|
||||||
|
console_print(id, "%L", id, "STATS_CONF_FAIL_LOAD")
|
||||||
|
}
|
||||||
|
else if (equali(cmds, "list"))
|
||||||
|
{
|
||||||
|
new arg1[8]
|
||||||
|
new start = read_argv(2, arg1, 7) ? str_to_num(arg1) : 1
|
||||||
|
|
||||||
|
if (--start < 0) start = 0
|
||||||
|
|
||||||
|
if (start >= g_menuDataNum)
|
||||||
|
start = g_menuDataNum - 1
|
||||||
|
|
||||||
|
new end = start + 10
|
||||||
|
|
||||||
|
if (end > g_menuDataNum)
|
||||||
|
end = g_menuDataNum
|
||||||
|
|
||||||
|
new lName[16], lVariable[16], lStatus[16]
|
||||||
|
|
||||||
|
format(lName, 15, "%L", id, "NAME")
|
||||||
|
format(lVariable, 15, "%L", id, "VARIABLE")
|
||||||
|
format(lStatus, 15, "%L", id, "STATUS")
|
||||||
|
console_print(id, "^n----- %L: -----", id, "STATS_CONF")
|
||||||
|
console_print(id, " %-29.28s %-24.23s %-9.8s", lName, lVariable, lStatus)
|
||||||
|
|
||||||
|
if (start != -1)
|
||||||
|
{
|
||||||
|
new lOnOff[16]
|
||||||
|
|
||||||
|
for (new a = start; a < end; ++a)
|
||||||
|
{
|
||||||
|
format(lOnOff, 15, "%L", id, get_xvar_num(g_menuDataId[a]) ? "ON" : "OFF")
|
||||||
|
console_print(id, "%3d: %-29.28s %-24.23s %-9.8s", a + 1, g_menuData[a], g_menuDataVar[a], lOnOff)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console_print(id, "----- %L -----", id, "STATS_ENTRIES_OF", start + 1, end, g_menuDataNum)
|
||||||
|
|
||||||
|
if (end < g_menuDataNum)
|
||||||
|
console_print(id, "----- %L -----", id, "STATS_USE_MORE", end + 1)
|
||||||
|
else
|
||||||
|
console_print(id, "----- %L -----", id, "STATS_USE_BEGIN")
|
||||||
|
}
|
||||||
|
else if (equali(cmds, "add") && read_argc() > 3)
|
||||||
|
{
|
||||||
|
if (g_menuDataNum < MAX_MENU_DATA)
|
||||||
|
{
|
||||||
|
read_argv(2, g_menuData[g_menuDataNum], 31)
|
||||||
|
read_argv(3, g_menuDataVar[g_menuDataNum], 31)
|
||||||
|
g_menuDataId[g_menuDataNum] = get_xvar_id(g_menuDataVar[g_menuDataNum])
|
||||||
++g_menuDataNum
|
++g_menuDataNum
|
||||||
}
|
}
|
||||||
else console_print(id, "%L",id,"CANT_ADD_STATS")
|
else
|
||||||
}
|
console_print(id, "%L", id, "CANT_ADD_STATS")
|
||||||
else {
|
} else {
|
||||||
console_print(id,"%L",id,"COM_STATS_USAGE")
|
console_print(id, "%L", id, "COM_STATS_USAGE")
|
||||||
console_print(id,"%L",id,"COM_STATS_COM")
|
console_print(id, "%L", id, "COM_STATS_COM")
|
||||||
console_print(id,"%L",id,"COM_STATS_ON")
|
console_print(id, "%L", id, "COM_STATS_ON")
|
||||||
console_print(id,"%L",id,"COM_STATS_OFF")
|
console_print(id, "%L", id, "COM_STATS_OFF")
|
||||||
console_print(id,"%L",id,"COM_STATS_SAVE")
|
console_print(id, "%L", id, "COM_STATS_SAVE")
|
||||||
console_print(id,"%L",id,"COM_STATS_LOAD")
|
console_print(id, "%L", id, "COM_STATS_LOAD")
|
||||||
console_print(id,"%L",id,"COM_STATS_LIST")
|
console_print(id, "%L", id, "COM_STATS_LIST")
|
||||||
console_print(id,"%L",id,"COM_STATS_ADD")
|
console_print(id, "%L", id, "COM_STATS_ADD")
|
||||||
}
|
}
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
public cmdCfgMenu(id,level,cid) {
|
public cmdCfgMenu(id, level, cid)
|
||||||
if (cmd_access(id,level,cid,1))
|
{
|
||||||
displayCfgMenu(id,g_menuPosition[id] = 0)
|
if (cmd_access(id, level, cid, 1))
|
||||||
|
displayCfgMenu(id, g_menuPosition[id] = 0)
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
displayCfgMenu(id,pos) {
|
displayCfgMenu(id, pos)
|
||||||
if (pos < 0) return
|
{
|
||||||
|
if (pos < 0)
|
||||||
|
return
|
||||||
|
|
||||||
new menu_body[512], start = pos * 7
|
new menu_body[512], start = pos * 7
|
||||||
if (start >= g_menuDataNum) start = pos = g_menuPosition[id] = 0
|
|
||||||
new len = format(menu_body,511,"\y%L\R%d/%d^n\w^n",
|
if (start >= g_menuDataNum)
|
||||||
id,"STATS_CONF",pos + 1,((g_menuDataNum/7)+((g_menuDataNum%7)?1:0)))
|
start = pos = g_menuPosition[id] = 0
|
||||||
|
|
||||||
|
new len = format(menu_body, 511, "\y%L\R%d/%d^n\w^n", id, "STATS_CONF", pos + 1, ((g_menuDataNum / 7)+((g_menuDataNum % 7) ? 1 : 0)))
|
||||||
new end = start + 7, keys = MENU_KEY_0|MENU_KEY_8, k = 0
|
new end = start + 7, keys = MENU_KEY_0|MENU_KEY_8, k = 0
|
||||||
if (end > g_menuDataNum) end = g_menuDataNum
|
|
||||||
for (new a = start; a < end; ++a) {
|
if (end > g_menuDataNum)
|
||||||
|
end = g_menuDataNum
|
||||||
|
|
||||||
|
for (new a = start; a < end; ++a)
|
||||||
|
{
|
||||||
keys |= (1<<k)
|
keys |= (1<<k)
|
||||||
len += format(menu_body[len],511-len,"%d. %s\y\R%L^n\w",++k,
|
len += format(menu_body[len], 511-len, "%d. %s\y\R%L^n\w", ++k, g_menuData[a], id, get_xvar_num(g_menuDataId[a]) ? "ON" : "OFF")
|
||||||
g_menuData[a], id, get_xvar_num( g_menuDataId[ a ] ) ? "ON" : "OFF" )
|
|
||||||
}
|
}
|
||||||
if ( g_menuDataNum == 0 )
|
|
||||||
len += format(menu_body[len],511-len,"\d%L\w",id,"NO_STATS")
|
if (g_menuDataNum == 0)
|
||||||
len += format(menu_body[len],511-len,"^n8. %L\y\R%s^n\w",id,"SAVE_CONF",g_modified ? "*" : "")
|
len += format(menu_body[len], 511-len, "\d%L\w", id, "NO_STATS")
|
||||||
if (end != g_menuDataNum) {
|
|
||||||
format(menu_body[len],511-len,"^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
|
len += format(menu_body[len], 511-len, "^n8. %L\y\R%s^n\w", id, "SAVE_CONF", g_modified ? "*" : "")
|
||||||
|
|
||||||
|
if (end != g_menuDataNum)
|
||||||
|
{
|
||||||
|
format(menu_body[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
|
||||||
keys |= MENU_KEY_9
|
keys |= MENU_KEY_9
|
||||||
}
|
}
|
||||||
else format(menu_body[len],511-len,"^n0. %L", id, pos ? "BACK" : "EXIT")
|
else
|
||||||
show_menu(id,keys,menu_body,-1,"Stats Configuration")
|
format(menu_body[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
|
||||||
|
|
||||||
|
show_menu(id, keys, menu_body, -1, "Stats Configuration")
|
||||||
}
|
}
|
||||||
|
|
||||||
public actionCfgMenu(id,key) {
|
public actionCfgMenu(id, key)
|
||||||
switch(key) {
|
{
|
||||||
case 7: {
|
switch (key)
|
||||||
if (saveSettings(g_fileToSave)) {
|
{
|
||||||
|
case 7:
|
||||||
|
{
|
||||||
|
if (saveSettings(g_fileToSave))
|
||||||
|
{
|
||||||
g_modified = false
|
g_modified = false
|
||||||
client_print(id,print_chat,"* %L",id,"STATS_CONF_SAVED")
|
client_print(id, print_chat, "* %L", id, "STATS_CONF_SAVED")
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
client_print(id,print_chat,"* %L",id,"STATS_CONF_FAILED")
|
client_print(id, print_chat, "* %L", id, "STATS_CONF_FAILED")
|
||||||
displayCfgMenu(id,g_menuPosition[id])
|
|
||||||
|
displayCfgMenu(id, g_menuPosition[id])
|
||||||
}
|
}
|
||||||
case 8: displayCfgMenu(id,++g_menuPosition[id])
|
case 8: displayCfgMenu(id, ++g_menuPosition[id])
|
||||||
case 9: displayCfgMenu(id,--g_menuPosition[id])
|
case 9: displayCfgMenu(id, --g_menuPosition[id])
|
||||||
default: {
|
default:
|
||||||
|
{
|
||||||
g_modified = true
|
g_modified = true
|
||||||
new a = g_menuPosition[id] * 7 + key
|
new a = g_menuPosition[id] * 7 + key
|
||||||
set_xvar_num( g_menuDataId[ a ] , 1 - get_xvar_num( g_menuDataId[ a ] ) )
|
set_xvar_num(g_menuDataId[a], 1 - get_xvar_num(g_menuDataId[a]))
|
||||||
displayCfgMenu( id , g_menuPosition[ id ] )
|
|
||||||
|
displayCfgMenu(id, g_menuPosition[id])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
saveSettings(filename[]) {
|
saveSettings(filename[])
|
||||||
|
{
|
||||||
if (file_exists(filename))
|
if (file_exists(filename))
|
||||||
delete_file(filename)
|
delete_file(filename)
|
||||||
if (!write_file(filename,";Generated by Stats Configuration Plugin. Do not modify!^n;Variable Description"))
|
|
||||||
|
if (!write_file(filename, ";Generated by Stats Configuration Plugin. Do not modify!^n;Variable Description"))
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
new text[256]
|
new text[256]
|
||||||
for(new a = 0; a < g_menuDataNum; ++a){
|
|
||||||
if ( get_xvar_num( g_menuDataId[ a ] ) ) {
|
for (new a = 0; a < g_menuDataNum; ++a)
|
||||||
format(text,255,"%-24.23s ;%s",g_menuDataVar[a],g_menuData[a])
|
{
|
||||||
write_file(filename,text)
|
if (get_xvar_num(g_menuDataId[a]))
|
||||||
|
{
|
||||||
|
format(text, 255, "%-24.23s ;%s", g_menuDataVar[a], g_menuData[a])
|
||||||
|
write_file(filename, text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
loadSettings(filename[]) {
|
loadSettings(filename[])
|
||||||
|
{
|
||||||
if (!file_exists(filename))
|
if (!file_exists(filename))
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
new text[256], name[32]
|
new text[256], name[32]
|
||||||
new len, pos = 0, xid
|
new len, pos = 0, xid
|
||||||
while (read_file(filename,pos++,text,255,len)) {
|
|
||||||
if ( text[0] == ';' ) continue // line is a comment
|
while (read_file(filename, pos++, text, 255, len))
|
||||||
parse( text , name , 31 )
|
{
|
||||||
if ( ( xid = get_xvar_id( name ) ) != -1 )
|
if (text[0] == ';') continue // line is a comment
|
||||||
set_xvar_num( xid , 1 )
|
|
||||||
|
parse(text, name, 31)
|
||||||
|
|
||||||
|
if ((xid = get_xvar_id(name)) != -1)
|
||||||
|
set_xvar_num(xid, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
@ -39,149 +39,161 @@
|
|||||||
new g_menuPosition[33]
|
new g_menuPosition[33]
|
||||||
new g_menuPlayers[33][32]
|
new g_menuPlayers[33][32]
|
||||||
new g_menuPlayersNum[33]
|
new g_menuPlayersNum[33]
|
||||||
new g_menuOption[33] = { -1 , ... }
|
new g_menuOption[33] = {-1, ...}
|
||||||
new g_menuOrgin[33][3]
|
new g_menuOrgin[33][3]
|
||||||
new g_coloredMenus
|
new g_coloredMenus
|
||||||
|
|
||||||
public plugin_init() {
|
public plugin_init()
|
||||||
register_plugin("Teleport Menu",AMXX_VERSION_STR,"AMXX Dev Team")
|
{
|
||||||
|
register_plugin("Teleport Menu", AMXX_VERSION_STR, "AMXX Dev Team")
|
||||||
register_dictionary("telemenu.txt")
|
register_dictionary("telemenu.txt")
|
||||||
register_dictionary("common.txt")
|
register_dictionary("common.txt")
|
||||||
register_clcmd("amx_teleportmenu","cmdTelMenu",ADMIN_CFG,"- displays teleport menu")
|
register_clcmd("amx_teleportmenu", "cmdTelMenu", ADMIN_CFG, "- displays teleport menu")
|
||||||
register_menucmd(register_menuid("Teleport Menu"),1023,"actionTelMenu")
|
register_menucmd(register_menuid("Teleport Menu"), 1023, "actionTelMenu")
|
||||||
|
|
||||||
g_coloredMenus = colored_menus()
|
g_coloredMenus = colored_menus()
|
||||||
}
|
}
|
||||||
|
|
||||||
public actionTelMenu(id,key) {
|
public actionTelMenu(id, key)
|
||||||
switch (key) {
|
{
|
||||||
case 6: {
|
switch (key)
|
||||||
|
{
|
||||||
|
case 6:
|
||||||
|
{
|
||||||
g_menuOption[id] = 1 - g_menuOption[id]
|
g_menuOption[id] = 1 - g_menuOption[id]
|
||||||
displayTelMenu(id,g_menuPosition[id])
|
displayTelMenu(id, g_menuPosition[id])
|
||||||
}
|
}
|
||||||
case 7: {
|
case 7:
|
||||||
|
{
|
||||||
if (g_menuOption[id] < 0) /* unlocking position for the first time */
|
if (g_menuOption[id] < 0) /* unlocking position for the first time */
|
||||||
g_menuOption[id] = 0
|
g_menuOption[id] = 0
|
||||||
get_user_origin(id,g_menuOrgin[id])
|
|
||||||
displayTelMenu(id,g_menuPosition[id])
|
get_user_origin(id, g_menuOrgin[id])
|
||||||
|
displayTelMenu(id, g_menuPosition[id])
|
||||||
}
|
}
|
||||||
case 8: displayTelMenu(id,++g_menuPosition[id])
|
case 8: displayTelMenu(id, ++g_menuPosition[id])
|
||||||
case 9: displayTelMenu(id,--g_menuPosition[id])
|
case 9: displayTelMenu(id, --g_menuPosition[id])
|
||||||
default: {
|
default:
|
||||||
|
{
|
||||||
new player = g_menuPlayers[id][g_menuPosition[id] * 6 + key]
|
new player = g_menuPlayers[id][g_menuPosition[id] * 6 + key]
|
||||||
|
|
||||||
new name2[32]
|
new name2[32]
|
||||||
get_user_name(player,name2,31)
|
|
||||||
|
|
||||||
if (!is_user_alive(player)) {
|
get_user_name(player, name2, 31)
|
||||||
client_print(id,print_chat,"%L",id,"CANT_PERF_DEAD",name2)
|
|
||||||
displayTelMenu(id,g_menuPosition[id])
|
if (!is_user_alive(player))
|
||||||
|
{
|
||||||
|
client_print(id, print_chat, "%L", id, "CANT_PERF_DEAD", name2)
|
||||||
|
displayTelMenu(id, g_menuPosition[id])
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_menuOption[id] > 0) {
|
if (g_menuOption[id] > 0)
|
||||||
set_user_origin(player,g_menuOrgin[id])
|
{
|
||||||
}
|
set_user_origin(player, g_menuOrgin[id])
|
||||||
else {
|
} else {
|
||||||
new origin[3]
|
new origin[3]
|
||||||
get_user_origin(id,origin)
|
|
||||||
set_user_origin(player,origin)
|
get_user_origin(id, origin)
|
||||||
|
set_user_origin(player, origin)
|
||||||
}
|
}
|
||||||
|
|
||||||
new authid[32],authid2[32], name[32]
|
new authid[32], authid2[32], name[32]
|
||||||
|
|
||||||
get_user_authid(id,authid,31)
|
get_user_authid(id, authid, 31)
|
||||||
get_user_authid(player,authid2,31)
|
get_user_authid(player, authid2, 31)
|
||||||
get_user_name(id,name,31)
|
get_user_name(id, name, 31)
|
||||||
|
|
||||||
log_amx("Cmd: ^"%s<%d><%s><>^" teleport ^"%s<%d><%s><>^"",
|
log_amx("Cmd: ^"%s<%d><%s><>^" teleport ^"%s<%d><%s><>^"", name, get_user_userid(id), authid, name2, get_user_userid(player), authid2)
|
||||||
name,get_user_userid(id),authid, name2,get_user_userid(player),authid2 )
|
|
||||||
|
|
||||||
switch (get_cvar_num("amx_show_activity")) {
|
switch (get_cvar_num("amx_show_activity"))
|
||||||
case 2: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_TELEPORT_2",name,name2)
|
{
|
||||||
case 1: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_TELEPORT_1",name2)
|
case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_TELEPORT_2", name, name2)
|
||||||
|
case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_TELEPORT_1", name2)
|
||||||
}
|
}
|
||||||
|
|
||||||
displayTelMenu(id,g_menuPosition[id])
|
displayTelMenu(id, g_menuPosition[id])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
displayTelMenu(id,pos) {
|
displayTelMenu(id, pos)
|
||||||
|
{
|
||||||
if (pos < 0)
|
if (pos < 0)
|
||||||
return
|
return
|
||||||
|
|
||||||
get_players(g_menuPlayers[id],g_menuPlayersNum[id])
|
get_players(g_menuPlayers[id], g_menuPlayersNum[id])
|
||||||
|
|
||||||
new menuBody[512]
|
new menuBody[512]
|
||||||
new b = 0
|
new b = 0
|
||||||
new i
|
new i
|
||||||
new name[32]
|
new name[32]
|
||||||
new start = pos * 6
|
new start = pos * 6
|
||||||
new bool:blockMenu = (is_user_alive(id)&&g_menuOption[id]<1) ? true : false
|
new bool:blockMenu = (is_user_alive(id) && g_menuOption[id] < 1) ? true : false
|
||||||
|
|
||||||
if (start >= g_menuPlayersNum[id])
|
if (start >= g_menuPlayersNum[id])
|
||||||
start = pos = g_menuPosition[id] = 0
|
start = pos = g_menuPosition[id] = 0
|
||||||
|
|
||||||
new len = format(menuBody,511, g_coloredMenus ?
|
new len = format(menuBody, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "TELE_MENU", pos + 1, (g_menuPlayersNum[id] / 6 + ((g_menuPlayersNum[id] % 6) ? 1 : 0)))
|
||||||
"\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n" ,
|
|
||||||
id, "TELE_MENU", pos+1,( g_menuPlayersNum[id] / 6 + ((g_menuPlayersNum[id] % 6) ? 1 : 0 )) )
|
|
||||||
|
|
||||||
new end = start + 6
|
new end = start + 6
|
||||||
new keys = MENU_KEY_0|MENU_KEY_8
|
new keys = MENU_KEY_0|MENU_KEY_8
|
||||||
|
|
||||||
if (end > g_menuPlayersNum[id])
|
if (end > g_menuPlayersNum[id])
|
||||||
end = g_menuPlayersNum[id]
|
end = g_menuPlayersNum[id]
|
||||||
|
|
||||||
for (new a = start; a < end; ++a) {
|
for (new a = start; a < end; ++a)
|
||||||
|
{
|
||||||
i = g_menuPlayers[id][a]
|
i = g_menuPlayers[id][a]
|
||||||
get_user_name(i,name,31)
|
get_user_name(i, name, 31)
|
||||||
|
|
||||||
if ( blockMenu || !is_user_alive(i) || (get_user_flags(i)&ADMIN_IMMUNITY) ) {
|
if (blockMenu || !is_user_alive(i) || (get_user_flags(i) & ADMIN_IMMUNITY))
|
||||||
|
{
|
||||||
++b
|
++b
|
||||||
if ( g_coloredMenus )
|
|
||||||
len += format(menuBody[len],511-len,"\d%d. %s^n\w",b,name)
|
if (g_coloredMenus)
|
||||||
|
len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, name)
|
||||||
else
|
else
|
||||||
len += format(menuBody[len],511-len,"#. %s^n",name)
|
len += format(menuBody[len], 511-len, "#. %s^n", name)
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
keys |= (1<<b)
|
keys |= (1<<b)
|
||||||
len += format(menuBody[len],511-len,"%d. %s^n",++b,name)
|
len += format(menuBody[len], 511-len, "%d. %s^n", ++b, name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( g_menuOption[id] > 0 ) { // 1
|
if (g_menuOption[id] > 0) // 1
|
||||||
|
{
|
||||||
keys |= MENU_KEY_7
|
keys |= MENU_KEY_7
|
||||||
len += format(menuBody[len],511-len,"^n7. To location: %d %d %d^n",
|
len += format(menuBody[len], 511-len, "^n7. To location: %d %d %d^n", g_menuOrgin[id][0], g_menuOrgin[id][1], g_menuOrgin[id][2])
|
||||||
g_menuOrgin[id][0],g_menuOrgin[id][1] ,g_menuOrgin[id][2])
|
|
||||||
}
|
}
|
||||||
else if ( g_menuOption[id] ) { // -1
|
else if (g_menuOption[id]) // -1
|
||||||
if ( g_coloredMenus )
|
{
|
||||||
len += format(menuBody[len],511-len,"^n\d7. %L^n\w",id,"CUR_LOC")
|
if (g_coloredMenus)
|
||||||
|
len += format(menuBody[len], 511-len, "^n\d7. %L^n\w", id, "CUR_LOC")
|
||||||
else
|
else
|
||||||
len += format(menuBody[len],511-len,"^n#. %L^n",id,"CUR_LOC")
|
len += format(menuBody[len], 511-len, "^n#. %L^n", id, "CUR_LOC")
|
||||||
}
|
} else { // 0
|
||||||
else { // 0
|
|
||||||
keys |= MENU_KEY_7
|
keys |= MENU_KEY_7
|
||||||
len += format(menuBody[len],511-len,"^n7. %L^n",id,"CUR_LOC")
|
len += format(menuBody[len], 511-len, "^n7. %L^n", id, "CUR_LOC")
|
||||||
}
|
}
|
||||||
|
|
||||||
len += format(menuBody[len],511-len,"8. %L^n",id,"SAVE_LOC")
|
len += format(menuBody[len], 511-len, "8. %L^n", id, "SAVE_LOC")
|
||||||
|
|
||||||
if (end != g_menuPlayersNum[id]) {
|
if (end != g_menuPlayersNum[id])
|
||||||
format(menuBody[len],511-len,"^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
|
{
|
||||||
|
format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
|
||||||
keys |= MENU_KEY_9
|
keys |= MENU_KEY_9
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
format(menuBody[len],511-len,"^n0. %L", id, pos ? "BACK" : "EXIT")
|
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
|
||||||
|
|
||||||
show_menu(id,keys,menuBody,-1,"Teleport Menu")
|
show_menu(id, keys, menuBody, -1, "Teleport Menu")
|
||||||
}
|
}
|
||||||
|
|
||||||
public cmdTelMenu(id,level,cid) {
|
public cmdTelMenu(id, level, cid)
|
||||||
if (cmd_access(id,level,cid,1))
|
{
|
||||||
displayTelMenu(id,g_menuPosition[id] = 0)
|
if (cmd_access(id, level, cid, 1))
|
||||||
|
displayTelMenu(id, g_menuPosition[id] = 0)
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
@ -39,163 +39,235 @@ new g_LastTime
|
|||||||
new g_CountDown
|
new g_CountDown
|
||||||
new g_Switch
|
new g_Switch
|
||||||
|
|
||||||
public plugin_init() {
|
public plugin_init()
|
||||||
register_plugin("TimeLeft",AMXX_VERSION_STR,"AMXX Dev Team")
|
{
|
||||||
|
register_plugin("TimeLeft", AMXX_VERSION_STR, "AMXX Dev Team")
|
||||||
register_dictionary("timeleft.txt")
|
register_dictionary("timeleft.txt")
|
||||||
register_cvar("amx_time_voice","1")
|
register_cvar("amx_time_voice", "1")
|
||||||
register_srvcmd("amx_time_display","setDisplaying")
|
register_srvcmd("amx_time_display", "setDisplaying")
|
||||||
register_cvar("amx_timeleft","00:00",FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY)
|
register_cvar("amx_timeleft", "00:00", FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY)
|
||||||
register_clcmd("say timeleft","sayTimeLeft",0,"- displays timeleft")
|
register_clcmd("say timeleft", "sayTimeLeft", 0, "- displays timeleft")
|
||||||
register_clcmd("say thetime","sayTheTime",0,"- displays current time")
|
register_clcmd("say thetime", "sayTheTime", 0, "- displays current time")
|
||||||
set_task(0.8,"timeRemain",8648458,"",0,"b")
|
|
||||||
|
set_task(0.8, "timeRemain", 8648458, "", 0, "b")
|
||||||
}
|
}
|
||||||
|
|
||||||
public sayTheTime(id){
|
public sayTheTime(id)
|
||||||
if ( get_cvar_num("amx_time_voice") ) {
|
{
|
||||||
|
if (get_cvar_num("amx_time_voice"))
|
||||||
|
{
|
||||||
new mhours[6], mmins[6], whours[32], wmins[32], wpm[6]
|
new mhours[6], mmins[6], whours[32], wmins[32], wpm[6]
|
||||||
get_time("%H",mhours,5)
|
|
||||||
get_time("%M",mmins,5)
|
get_time("%H", mhours, 5)
|
||||||
|
get_time("%M", mmins, 5)
|
||||||
|
|
||||||
new mins = str_to_num(mmins)
|
new mins = str_to_num(mmins)
|
||||||
new hrs = str_to_num(mhours)
|
new hrs = str_to_num(mhours)
|
||||||
|
|
||||||
if (mins)
|
if (mins)
|
||||||
num_to_word(mins,wmins,31)
|
num_to_word(mins, wmins, 31)
|
||||||
else
|
else
|
||||||
wmins[0] = 0
|
wmins[0] = 0
|
||||||
|
|
||||||
if (hrs < 12)
|
if (hrs < 12)
|
||||||
wpm = "am "
|
wpm = "am "
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
if (hrs > 12) hrs -= 12
|
if (hrs > 12) hrs -= 12
|
||||||
wpm = "pm "
|
wpm = "pm "
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hrs)
|
if (hrs)
|
||||||
num_to_word(hrs,whours,31)
|
num_to_word(hrs, whours, 31)
|
||||||
else
|
else
|
||||||
whours = "twelve "
|
whours = "twelve "
|
||||||
client_cmd(id, "spk ^"fvox/time_is_now %s_period %s%s^"",whours,wmins,wpm )
|
|
||||||
|
client_cmd(id, "spk ^"fvox/time_is_now %s_period %s%s^"", whours, wmins, wpm)
|
||||||
}
|
}
|
||||||
|
|
||||||
new ctime[64]
|
new ctime[64]
|
||||||
get_time("%m/%d/%Y - %H:%M:%S",ctime,63)
|
|
||||||
client_print(0,print_chat, "%L: %s",LANG_PLAYER,"THE_TIME",ctime )
|
get_time("%m/%d/%Y - %H:%M:%S", ctime, 63)
|
||||||
|
client_print(0, print_chat, "%L: %s", LANG_PLAYER, "THE_TIME", ctime)
|
||||||
|
|
||||||
return PLUGIN_CONTINUE
|
return PLUGIN_CONTINUE
|
||||||
}
|
}
|
||||||
|
|
||||||
public sayTimeLeft(id) {
|
public sayTimeLeft(id)
|
||||||
if (get_cvar_float("mp_timelimit")) {
|
{
|
||||||
|
if (get_cvar_float("mp_timelimit"))
|
||||||
|
{
|
||||||
new a = get_timeleft()
|
new a = get_timeleft()
|
||||||
if ( get_cvar_num("amx_time_voice") ) {
|
|
||||||
|
if (get_cvar_num("amx_time_voice"))
|
||||||
|
{
|
||||||
new svoice[128]
|
new svoice[128]
|
||||||
setTimeVoice( svoice , 127 , 0 , a )
|
setTimeVoice(svoice, 127, 0, a)
|
||||||
client_cmd( id , svoice )
|
client_cmd(id, svoice)
|
||||||
}
|
}
|
||||||
client_print(0,print_chat, "%L: %d:%02d", LANG_PLAYER, "TIME_LEFT", (a / 60) , (a % 60) )
|
client_print(0, print_chat, "%L: %d:%02d", LANG_PLAYER, "TIME_LEFT", (a / 60), (a % 60))
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
client_print(0,print_chat, "%L",LANG_PLAYER,"NO_T_LIMIT" )
|
client_print(0, print_chat, "%L", LANG_PLAYER, "NO_T_LIMIT")
|
||||||
|
|
||||||
return PLUGIN_CONTINUE
|
return PLUGIN_CONTINUE
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeText(text[],len,tmlf,id) {
|
setTimeText(text[], len, tmlf, id)
|
||||||
|
{
|
||||||
new secs = tmlf % 60
|
new secs = tmlf % 60
|
||||||
new mins = tmlf / 60
|
new mins = tmlf / 60
|
||||||
|
|
||||||
if (secs == 0)
|
if (secs == 0)
|
||||||
format(text,len,"%d %L", mins, id, (mins > 1) ? "MINUTES" : "MINUTE" )
|
format(text, len, "%d %L", mins, id, (mins > 1) ? "MINUTES" : "MINUTE")
|
||||||
else if (mins == 0)
|
else if (mins == 0)
|
||||||
format(text,len,"%d %L", secs, id, (secs > 1) ? "SECONDS" : "SECOND" )
|
format(text, len, "%d %L", secs, id, (secs > 1) ? "SECONDS" : "SECOND")
|
||||||
else
|
else
|
||||||
format(text,len,"%d %L %d %L", mins, id, (mins > 1) ? "MINUTES" : "MINUTE", secs, id, (secs > 1) ? "SECONDS" : "SECOND" )
|
format(text, len, "%d %L %d %L", mins, id, (mins > 1) ? "MINUTES" : "MINUTE", secs, id, (secs > 1) ? "SECONDS" : "SECOND")
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeVoice(text[],len,flags,tmlf) {
|
setTimeVoice(text[], len, flags, tmlf)
|
||||||
|
{
|
||||||
new temp[7][32]
|
new temp[7][32]
|
||||||
new secs = tmlf % 60
|
new secs = tmlf % 60
|
||||||
new mins = tmlf / 60
|
new mins = tmlf / 60
|
||||||
|
|
||||||
for (new a = 0;a < 7;++a)
|
for (new a = 0;a < 7;++a)
|
||||||
temp[a][0] = 0
|
temp[a][0] = 0
|
||||||
if (secs > 0){
|
|
||||||
num_to_word(secs,temp[4],31)
|
if (secs > 0)
|
||||||
if (!(flags & 8)) temp[5] = "seconds " /* there is no "second" in default hl */
|
{
|
||||||
|
num_to_word(secs, temp[4], 31)
|
||||||
|
|
||||||
|
if (!(flags & 8))
|
||||||
|
temp[5] = "seconds " /* there is no "second" in default hl */
|
||||||
}
|
}
|
||||||
if (mins > 59) {
|
|
||||||
|
if (mins > 59)
|
||||||
|
{
|
||||||
new hours = mins / 60
|
new hours = mins / 60
|
||||||
num_to_word(hours,temp[0],31)
|
|
||||||
if (!(flags & 8)) temp[1] = "hours "
|
num_to_word(hours, temp[0], 31)
|
||||||
|
|
||||||
|
if (!(flags & 8))
|
||||||
|
temp[1] = "hours "
|
||||||
|
|
||||||
mins = mins % 60
|
mins = mins % 60
|
||||||
}
|
}
|
||||||
if (mins > 0) {
|
|
||||||
num_to_word(mins ,temp[2],31)
|
if (mins > 0)
|
||||||
if (!(flags & 8)) temp[3] = "minutes "
|
{
|
||||||
|
num_to_word(mins, temp[2], 31)
|
||||||
|
|
||||||
|
if (!(flags & 8))
|
||||||
|
temp[3] = "minutes "
|
||||||
}
|
}
|
||||||
if (!(flags & 4)) temp[6] = "remaining "
|
|
||||||
return format(text,len,"spk ^"vox/%s%s%s%s%s%s%s^"", temp[0],temp[1],temp[2],temp[3],temp[4],temp[5],temp[6] )
|
if (!(flags & 4))
|
||||||
|
temp[6] = "remaining "
|
||||||
|
|
||||||
|
return format(text, len, "spk ^"vox/%s%s%s%s%s%s%s^"", temp[0], temp[1], temp[2], temp[3], temp[4], temp[5], temp[6])
|
||||||
}
|
}
|
||||||
|
|
||||||
findDispFormat(time) {
|
findDispFormat(time)
|
||||||
for(new i = 0;g_TimeSet[i][0];++i) {
|
{
|
||||||
if (g_TimeSet[i][1] & 16) {
|
for (new i = 0; g_TimeSet[i][0]; ++i)
|
||||||
if (g_TimeSet[i][0] > time) {
|
{
|
||||||
if (!g_Switch) {
|
if (g_TimeSet[i][1] & 16)
|
||||||
|
{
|
||||||
|
if (g_TimeSet[i][0] > time)
|
||||||
|
{
|
||||||
|
if (!g_Switch)
|
||||||
|
{
|
||||||
g_CountDown = g_Switch = time
|
g_CountDown = g_Switch = time
|
||||||
remove_task(8648458)
|
remove_task(8648458)
|
||||||
set_task(1.0,"timeRemain",34543,"",0,"b")
|
set_task(1.0, "timeRemain", 34543, "", 0, "b")
|
||||||
}
|
}
|
||||||
|
|
||||||
return i
|
return i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (g_TimeSet[i][0] == time) {
|
else if (g_TimeSet[i][0] == time)
|
||||||
|
{
|
||||||
return i
|
return i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
|
|
||||||
public setDisplaying() {
|
public setDisplaying()
|
||||||
|
{
|
||||||
new arg[32], flags[32], num[32]
|
new arg[32], flags[32], num[32]
|
||||||
new argc = read_argc() - 1
|
new argc = read_argc() - 1
|
||||||
new i = 0
|
new i = 0
|
||||||
while (i < argc && i < 32) {
|
|
||||||
read_argv(i+1,arg,31)
|
while (i < argc && i < 32)
|
||||||
parse(arg,flags,31,num,31)
|
{
|
||||||
|
read_argv(i + 1, arg, 31)
|
||||||
|
parse(arg, flags, 31, num, 31)
|
||||||
|
|
||||||
g_TimeSet[i][0] = str_to_num(num)
|
g_TimeSet[i][0] = str_to_num(num)
|
||||||
g_TimeSet[i][1] = read_flags(flags)
|
g_TimeSet[i][1] = read_flags(flags)
|
||||||
|
|
||||||
i++
|
i++
|
||||||
}
|
}
|
||||||
g_TimeSet[i][0] = 0
|
g_TimeSet[i][0] = 0
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
public timeRemain(param[]) {
|
public timeRemain(param[])
|
||||||
|
{
|
||||||
new gmtm = get_timeleft()
|
new gmtm = get_timeleft()
|
||||||
new tmlf = g_Switch ? --g_CountDown : gmtm
|
new tmlf = g_Switch ? --g_CountDown : gmtm
|
||||||
new stimel[12]
|
new stimel[12]
|
||||||
format(stimel,11,"%02d:%02d",gmtm / 60, gmtm % 60)
|
|
||||||
set_cvar_string("amx_timeleft",stimel)
|
format(stimel, 11, "%02d:%02d", gmtm / 60, gmtm % 60)
|
||||||
if ( g_Switch && gmtm > g_Switch ) {
|
set_cvar_string("amx_timeleft", stimel)
|
||||||
|
|
||||||
|
if (g_Switch && gmtm > g_Switch)
|
||||||
|
{
|
||||||
remove_task(34543)
|
remove_task(34543)
|
||||||
g_Switch = 0
|
g_Switch = 0
|
||||||
set_task(0.8,"timeRemain",8648458,"",0,"b")
|
set_task(0.8, "timeRemain", 8648458, "", 0, "b")
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (tmlf > 0 && g_LastTime != tmlf) {
|
|
||||||
|
if (tmlf > 0 && g_LastTime != tmlf)
|
||||||
|
{
|
||||||
g_LastTime = tmlf
|
g_LastTime = tmlf
|
||||||
new tm_set = findDispFormat(tmlf)
|
new tm_set = findDispFormat(tmlf)
|
||||||
if ( tm_set != -1){
|
|
||||||
|
if (tm_set != -1)
|
||||||
|
{
|
||||||
new flags = g_TimeSet[tm_set][1]
|
new flags = g_TimeSet[tm_set][1]
|
||||||
new arg[128]
|
new arg[128]
|
||||||
if (flags & 1) {
|
|
||||||
new players[32],pnum
|
if (flags & 1)
|
||||||
get_players(players,pnum,"c")
|
{
|
||||||
for (new i=0;i<pnum;i++) {
|
new players[32], pnum
|
||||||
setTimeText(arg,127,tmlf,players[i])
|
|
||||||
|
get_players(players, pnum, "c")
|
||||||
|
|
||||||
|
for (new i = 0; i < pnum; i++)
|
||||||
|
{
|
||||||
|
setTimeText(arg, 127, tmlf, players[i])
|
||||||
|
|
||||||
if (flags & 16)
|
if (flags & 16)
|
||||||
set_hudmessage(255, 255, 255, -1.0, 0.85, 0, 0.0, 1.1, 0.1, 0.5, 1)
|
set_hudmessage(255, 255, 255, -1.0, 0.85, 0, 0.0, 1.1, 0.1, 0.5, 1)
|
||||||
else
|
else
|
||||||
set_hudmessage(255, 255, 255, -1.0, 0.85, 0, 0.0, 3.0, 0.0, 0.5, 1)
|
set_hudmessage(255, 255, 255, -1.0, 0.85, 0, 0.0, 3.0, 0.0, 0.5, 1)
|
||||||
show_hudmessage(players[i],arg)
|
|
||||||
|
show_hudmessage(players[i], arg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (flags & 2) {
|
|
||||||
setTimeVoice(arg,127,flags,tmlf)
|
if (flags & 2)
|
||||||
client_cmd(0,arg)
|
{
|
||||||
|
setTimeVoice(arg, 127, flags, tmlf)
|
||||||
|
client_cmd(0, arg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user