updated to use the multi-lingual system | better code style

This commit is contained in:
Felix Geyer 2004-08-03 20:11:16 +00:00
parent b25d3a081f
commit 0be7ddcbd9
6 changed files with 399 additions and 265 deletions

View File

@ -57,6 +57,7 @@ public plugin_init()
#else #else
register_plugin("Admin Base",AMXX_VERSION_STR,"AMXX Dev Team") register_plugin("Admin Base",AMXX_VERSION_STR,"AMXX Dev Team")
#endif #endif
register_dictionary("admin.txt")
register_cvar("amx_mode","1") register_cvar("amx_mode","1")
register_cvar("amx_password_field","_pw") register_cvar("amx_password_field","_pw")
register_cvar("amx_default_access","") register_cvar("amx_default_access","")
@ -133,7 +134,11 @@ loadSettings(szFilename[])
g_aFlags[ g_aNum ] = read_flags( szFlags ) g_aFlags[ g_aNum ] = read_flags( szFlags )
++g_aNum ++g_aNum
} }
server_print("[AMXX] Loaded %d admin%s from file",g_aNum, (g_aNum == 1) ? "" : "s" ) if (g_aNum == 1)
server_print("[AMXX] %L", LANG_SERVER, "LOADED_ADMIN" )
else
server_print("[AMXX] %L", LANG_SERVER, "LOADED_ADMINS", g_aNum )
return 1 return 1
} }
#endif #endif
@ -148,7 +153,7 @@ public adminSql() {
new Sql:sql = dbi_connect(host,user,pass,db,error,127) new Sql:sql = dbi_connect(host,user,pass,db,error,127)
if (sql <= SQL_FAILED) { if (sql <= SQL_FAILED) {
server_print("[AMXX] SQL error: can't connect: '%s'",error) server_print("[AMXX] %L",LANG_SERVER,"SQL_CANT_CON",error)
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
@ -158,13 +163,13 @@ public adminSql() {
if (Res == RESULT_FAILED) { if (Res == RESULT_FAILED) {
dbi_error(sql,error,127) dbi_error(sql,error,127)
server_print("[AMXX] SQL error: can't load admins: '%s'",error) server_print("[AMXX] %L",LANG_SERVER,"SQL_CANT_LOAD_ADMINS",error)
dbi_free_result(Res) dbi_free_result(Res)
dbi_close(Sql) dbi_close(Sql)
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
else if (Res == RESULT_NONE) { else if (Res == RESULT_NONE) {
server_print("[AMXX] No admins found.") server_print("[AMXX] %L",LANG_SERVER,"NO_ADMINS")
dbi_free_result(Res) dbi_free_result(Res)
dbi_close(Sql) dbi_close(Sql)
return PLUGIN_HANDLED return PLUGIN_HANDLED
@ -185,7 +190,10 @@ public adminSql() {
++g_aNum ++g_aNum
} }
server_print("[AMXX] Loaded %d admin%s from database",g_aNum, (g_aNum == 1) ? "" : "s" ) if (g_aNum == 1)
server_print("[AMXX] %L", SERVER_LANG, "SQL_LOADED_ADMIN" )
else
server_print("[AMXX] %L", SERVER_LANG, "SQL_LOADED_ADMINS", g_aNum )
dbi_free_result(Res) dbi_free_result(Res)
dbi_close(sql) dbi_close(sql)
return PLUGIN_HANDLED return PLUGIN_HANDLED
@ -303,13 +311,13 @@ accessUser( id, name[] = "" )
get_cvar_string("amx_password_field",passfield,31) get_cvar_string("amx_password_field",passfield,31)
get_user_info(id,passfield,password,31) get_user_info(id,passfield,password,31)
new result = getAccess(id,username,userauthid,userip,password) new result = getAccess(id,username,userauthid,userip,password)
if (result & 1) client_cmd(id,"echo ^"* Invalid Password!^"") if (result & 1) client_cmd(id,"echo ^"* %L^"",id,"INV_PAS")
if (result & 2) { if (result & 2) {
client_cmd(id,g_cmdLoopback) client_cmd(id,g_cmdLoopback)
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
if (result & 4) client_cmd(id,"echo ^"* Password accepted^"") if (result & 4) client_cmd(id,"echo ^"* %L^"",id,"PAS_ACC")
if (result & 8) client_cmd(id,"echo ^"* Privileges set^"") if (result & 8) client_cmd(id,"echo ^"* %L^"",id,"PRIV_SET")
return PLUGIN_CONTINUE return PLUGIN_CONTINUE
} }
@ -328,8 +336,11 @@ public client_infochanged(id)
return PLUGIN_CONTINUE return PLUGIN_CONTINUE
} }
public ackSignal(id) public ackSignal(id) {
server_cmd("kick #%d ^"You have no entry to the server...^"", get_user_userid(id) ) new no_entry[64]
format(no_entry,63,"%L",id,"NO_ENTRY")
server_cmd("kick #%d ^"%L^"", get_user_userid(id), no_entry )
}
public client_authorized(id) public client_authorized(id)
return get_cvar_num( "amx_mode" ) ? accessUser( id ) : PLUGIN_CONTINUE return get_cvar_num( "amx_mode" ) ? accessUser( id ) : PLUGIN_CONTINUE

View File

@ -42,12 +42,13 @@
new g_msgChannel new g_msgChannel
#define MAX_CLR 10 #define MAX_CLR 10
new g_Colors[MAX_CLR][] = {"white","red","green","blue","yellow","magenta","cyan","orange","ocean","maroon"} 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 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}} new Float:g_Pos[4][] = {{0.0,0.0},{0.05,0.55},{-1.0,0.2},{-1.0,0.7}}
public plugin_init(){ public plugin_init() {
register_plugin("Admin Chat",AMXX_VERSION_STR,"AMXX Dev Team") register_plugin("Admin Chat",AMXX_VERSION_STR,"AMXX Dev Team")
register_dictionary("adminchat.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")
@ -57,17 +58,17 @@ public plugin_init(){
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 (!(get_user_flags(id)&ADMIN_CHAT)) return PLUGIN_CONTINUE if (!access(id,ADMIN_CHAT)) return PLUGIN_CONTINUE
new said[6], i=0 new said[6], i=0
read_argv(1,said,5) read_argv(1,said,5)
while (said[i]=='@') 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
@ -76,31 +77,32 @@ 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, color[16]
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)
format(color,15,"%L","en",g_Colors[a])
log_amx("Chat: ^"%s<%d><%s><>^" tsay ^"%s^"",name,userid,authid,message[i+1]) 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 ^"%s^")", log_message("^"%s<%d><%s><>^" triggered ^"amx_tsay^" (text ^"%s^") (color ^"%s^")",
name,userid,authid,message[ i+1 ],g_Colors[a]) name,userid,authid,message[ i+1 ],color)
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], 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 ) g_Pos[i][0], verpos , 0, 6.0, 6.0, 0.5, 0.15, g_msgChannel )
#if defined SHOW_NAMES #if defined SHOW_NAMES
show_hudmessage(0,"%s : %s",name,message[i+1]) show_hudmessage(0,"%s : %s",name,message[i+1])
client_print(0,print_notify,"%s : %s",name,message[i+1]) client_print(0,print_notify,"%s : %s",name,message[i+1])
#else #else
show_hudmessage(0,message[i+1]) show_hudmessage(0,message[i+1])
client_print(0,print_notify,message[i+1]) client_print(0,print_notify,message[i+1])
#endif #endif
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 if (said[0]!='@') return PLUGIN_CONTINUE
@ -110,20 +112,20 @@ public cmdSayAdmin(id) {
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_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_message("^"%s<%d><%s><>^" triggered ^"amx_chat^" (text ^"%s^")",name,userid,authid,message[1])
format(message,191,"(ADMINS) %s : %s",name,message[1]) format(message,191,"(ADMINS) %s : %s",name,message[1])
get_players(players,inum) get_players(players,inum)
for(new i=0; i<inum; ++i){ 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,message) client_print(players[i],print_chat,message)
} }
client_print(id,print_chat,message) client_print(id,print_chat,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
@ -137,30 +139,30 @@ public cmdChat(id,level,cid){
log_message("^"%s<%d><%s><>^" triggered ^"amx_chat^" (text ^"%s^")",name,userid,authid,message) log_message("^"%s<%d><%s><>^" triggered ^"amx_chat^" (text ^"%s^")",name,userid,authid,message)
format(message,191,"(ADMINS) %s : %s",name,message) format(message,191,"(ADMINS) %s : %s",name,message)
console_print(id,message) console_print(id,message)
for(new i = 0; i < inum; ++i){ for (new i = 0; i < inum; ++i) {
if ( get_user_flags(players[i]) & ADMIN_CHAT ) if ( access(players[i],ADMIN_CHAT) )
client_print(players[i],print_chat,message) client_print(players[i],print_chat,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 new message[192],name[32],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)
client_print(0,print_chat,"(ALL) %s : %s",name,message) client_print(0,print_chat,"%L",LANG_PLAYER,"PRINT_LANG",name,message)
console_print(id,"(ALL) %s : %s",name,message) console_print(id,"%L",id,"PRINT_LANG",name,message)
log_amx("Chat: ^"%s<%d><%s><>^" say ^"%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) 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]
@ -192,22 +194,30 @@ public cmdPsay(id,level,cid){
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[12], 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,11) parse(message,color,15)
new found = 0,a = 0 new found = 0,a = 0
for(new i=0;i<MAX_CLR;++i) new lang[3],langnum = get_langsnum()
if (equal(color,g_Colors[i])) { for (new i=0;i<MAX_CLR;++i) {
a = i for (new j=0;j<langnum;j++) {
found = 1 get_lang(j,lang)
break format(color2,15,"%L",lang,g_Colors[i])
if (equali(color,color2)) {
a = i
found = 1
break
}
} }
if (found==1)
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
@ -227,8 +237,9 @@ public cmdTsay(id,level,cid){
console_print(id,message[length]) console_print(id,message[length])
#endif #endif
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],g_Colors[a]) name,userid,authid,cmd,message[length],color2)
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }

View File

@ -45,6 +45,8 @@ new g_addCvar[] = "amx_cvar add %s"
public plugin_init() { public plugin_init() {
register_plugin("Admin Commands",AMXX_VERSION_STR,"AMXX Dev Team") register_plugin("Admin Commands",AMXX_VERSION_STR,"AMXX Dev Team")
register_dictionary("admincmd.txt")
register_dictionary("common.txt")
register_concmd("amx_kick","cmdKick",ADMIN_KICK,"<name or #userid> [reason]") register_concmd("amx_kick","cmdKick",ADMIN_KICK,"<name or #userid> [reason]")
register_concmd("amx_ban","cmdBan",ADMIN_BAN,"<name or #userid> <id/ip> <minutes> [reason]") register_concmd("amx_ban","cmdBan",ADMIN_BAN,"<name or #userid> <id/ip> <minutes> [reason]")
register_concmd("amx_addban","cmdAddBan",ADMIN_BAN,"<authid or ip> <minutes> [reason]") register_concmd("amx_addban","cmdAddBan",ADMIN_BAN,"<authid or ip> <minutes> [reason]")
@ -94,8 +96,8 @@ public cmdKick(id,level,cid) {
log_amx("Kick: ^"%s<%d><%s><>^" kick ^"%s<%d><%s><>^" (reason ^"%s^")", log_amx("Kick: ^"%s<%d><%s><>^" kick ^"%s<%d><%s><>^" (reason ^"%s^")",
name,get_user_userid(id),authid,name2,userid2,authid2,reason) name,get_user_userid(id),authid,name2,userid2,authid2,reason)
switch (get_cvar_num("amx_show_activity")) { switch (get_cvar_num("amx_show_activity")) {
case 2: client_print(0,print_chat,"ADMIN %s: kick %s",name,name2) case 2: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_KICK_2",name,name2)
case 1: client_print(0,print_chat,"ADMIN: kick %s",name2) case 1: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_KICK_1",name2)
} }
if ( is_user_bot(player) ) if ( is_user_bot(player) )
server_cmd("kick #%d",userid2) server_cmd("kick #%d",userid2)
@ -117,16 +119,16 @@ public cmdUnban(id,level,cid) {
read_argv(1,arg,31) read_argv(1,arg,31)
if (contain(arg,".")!=-1) { if (contain(arg,".")!=-1) {
server_cmd("removeip ^"%s^";writeip",arg) server_cmd("removeip ^"%s^";writeip",arg)
console_print(id,"[AMXX] Ip ^"%s^" removed from ban list", arg ) console_print(id,"[AMXX] %L", id, "IP_REMOVED", arg )
} }
else { else {
server_cmd("removeid ^"%s^";writeid",arg) server_cmd("removeid ^"%s^";writeid",arg)
console_print(id,"[AMXX] Authid ^"%s^" removed from ban list", arg ) console_print(id,"[AMXX] %L", id, "AUTHID_REMOVED", arg )
} }
get_user_name(id,name,31) get_user_name(id,name,31)
switch (get_cvar_num("amx_show_activity")) { switch (get_cvar_num("amx_show_activity")) {
case 2: client_print(0,print_chat,"ADMIN %s: unban %s",name,arg) case 2: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_UNBAN_2",name,arg)
case 1: client_print(0,print_chat,"ADMIN: unban %s",arg) case 1: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_UNBAN_1",arg)
} }
get_user_authid(id,authid,31) get_user_authid(id,authid,31)
log_amx("Cmd: ^"%s<%d><%s><>^" unban ^"%s^"", log_amx("Cmd: ^"%s<%d><%s><>^" unban ^"%s^"",
@ -151,8 +153,8 @@ public cmdAddBan(id,level,cid) {
} }
get_user_name(id,name,31) get_user_name(id,name,31)
switch (get_cvar_num("amx_show_activity")) { switch (get_cvar_num("amx_show_activity")) {
case 2: client_print(0,print_chat,"ADMIN %s: ban %s",name,arg) case 2: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_ADDBAN_2",name,arg)
case 1: client_print(0,print_chat,"ADMIN: ban %s",arg) case 1: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_ADDBAN_1",arg)
} }
get_user_authid(id,authid,31) get_user_authid(id,authid,31)
log_amx("Cmd: ^"%s<%d><%s><>^" ban ^"%s^" (minutes ^"%s^") (reason ^"%s^")", log_amx("Cmd: ^"%s<%d><%s><>^" ban ^"%s^" (minutes ^"%s^") (reason ^"%s^")",
@ -169,8 +171,7 @@ public cmdBan(id,level,cid) {
strtolower(mode) strtolower(mode)
read_argv(3,minutes,7) read_argv(3,minutes,7)
read_argv(4,reason,31) read_argv(4,reason,31)
if ( (!equal(mode,"id")) && (!equal(mode,"ip")) ) if ( (!equal(mode,"id")) && (!equal(mode,"ip")) ) {
{
new hcmd[32],hinfo[128],hflag new hcmd[32],hinfo[128],hflag
get_concmd(cid,hcmd,31,hflag,hinfo,127,level) get_concmd(cid,hcmd,31,hflag,hinfo,127,level)
console_print(id,"Usage: %s %s",hcmd,hinfo) console_print(id,"Usage: %s %s",hcmd,hinfo)
@ -188,40 +189,53 @@ public cmdBan(id,level,cid) {
log_amx("Ban: ^"%s<%d><%s><>^" ban and kick ^"%s<%d><%s><>^" (mode ^"%s^") (minutes ^"%s^") (reason ^"%s^")", log_amx("Ban: ^"%s<%d><%s><>^" ban and kick ^"%s<%d><%s><>^" (mode ^"%s^") (minutes ^"%s^") (reason ^"%s^")",
name,get_user_userid(id),authid, name2,userid2,authid2,mode,minutes,reason) name,get_user_userid(id),authid, name2,userid2,authid2,mode,minutes,reason)
new temp[64] new temp[64],banned[16],nNum = str_to_num(minutes)
if (str_to_num(minutes)) if (nNum)
format(temp,63,"for %s min.",minutes) format(temp,63,"%L",player,"FOR_MIN",minutes)
else else
temp = "permanently" format(temp,63,"%L",player,"PERM")
format(banned,15,"%L",player,"BANNED")
if ( equal(mode,"ip") ){ if ( equal(mode,"ip") ){
new address[32] new address[32]
get_user_ip(player,address,31,1) get_user_ip(player,address,31,1)
if (reason[0]) if (reason[0])
server_cmd("kick #%d ^"%s (banned %s)^";wait;addip ^"%s^" ^"%s^";wait;writeip",userid2,reason,temp,minutes,address) server_cmd("kick #%d ^"%s (%s %s)^";wait;addip ^"%s^" ^"%s^";wait;writeip",userid2,reason,banned,temp,minutes,address)
else else
server_cmd("kick #%d ^"banned %s^";wait;addip ^"%s^" ^"%s^";wait;writeip",userid2,temp,minutes,address) server_cmd("kick #%d ^"%s %s^";wait;addip ^"%s^" ^"%s^";wait;writeip",userid2,banned,temp,minutes,address)
} }
else else
{ {
if (reason[0]) if (reason[0])
server_cmd("kick #%d ^"%s (banned %s)^";wait;banid ^"%s^" ^"%s^";wait;writeid",userid2,reason,temp,minutes,authid2) server_cmd("kick #%d ^"%s (%s %s)^";wait;banid ^"%s^" ^"%s^";wait;writeid",userid2,reason,banned,temp,minutes,authid2)
else else
server_cmd("kick #%d ^"banned %s^";wait;banid ^"%s^" ^"%s^";wait;writeid",userid2,temp,minutes,authid2) server_cmd("kick #%d ^"%s %s^";wait;banid ^"%s^" ^"%s^";wait;writeid",userid2,banned,temp,minutes,authid2)
} }
new activity = get_cvar_num("amx_show_activity") new activity = get_cvar_num("amx_show_activity")
if (activity) { if (activity!=0) {
new temp2[64] new players[32],pnum,msg[256],len
if (activity == 1) get_players(players,pnum,"c")
temp2 = "ADMIN:" for (new i=0;i<pnum;i++) {
else len = format(msg,255,"%L",players[i],"ADMIN")
format(temp2,63,"ADMIN %s:",name) strtoupper(msg)
client_print(0,print_chat,"%s ban %s %s",temp2,name2,temp) if (activity==1)
} len += copy(msg[len],255-len,":")
else
console_print(id,"[AMXX] Client ^"%s^" banned",name2) len += format(msg[len],255-len," %s:",name)
len += format(msg[len],255-len," %L",players[i],"BAN")
len += format(msg[len],255-len," %s ",name2)
if (nNum)
format(msg[len],255-len,"%L",players[i],"FOR_MIN",minutes)
else
format(msg[len],255-len,"%L",players[i],"PERM")
client_print(players[i],print_chat,msg)
}
}
console_print(id,"[AMXX] %L",id,"CLIENT_BANNED",name2)
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
@ -242,11 +256,11 @@ public cmdSlay(id,level,cid) {
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,"ADMIN %s: slay %s",name,name2) case 2: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_SLAY_2",name,name2)
case 1: client_print(0,print_chat,"ADMIN: slay %s",name2) case 1: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_SLAY_1",name2)
} }
console_print(id,"[AMXX] Client ^"%s^" slayed",name2) console_print(id,"[AMXX] %L",id,"CLIENT_SLAYED",name2)
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
@ -269,11 +283,11 @@ public cmdSlap(id,level,cid) {
name,get_user_userid(id),authid, damage,name2,get_user_userid(player),authid2 ) name,get_user_userid(id),authid, damage,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,"ADMIN %s: slap %s with %d damage",name,name2,damage) case 2: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_SLAP_2",name,name2,damage)
case 1: client_print(0,print_chat,"ADMIN: slap %s with %d damage",name2,damage) case 1: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_SLAP_1",name2,damage)
} }
console_print(id,"[AMXX] Client ^"%s^" slaped with %d damage",name2,damage) console_print(id,"[AMXX] %L",id,"CLIENT_SLAPED",name2,damage)
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
@ -287,15 +301,15 @@ public cmdMap(id,level,cid) {
new arg[32] new arg[32]
new arglen = read_argv(1,arg,31) new arglen = read_argv(1,arg,31)
if ( !is_map_valid(arg) ){ if ( !is_map_valid(arg) ){
console_print(id,"[AMXX] Map with that name not found or map is invalid") console_print(id,"[AMXX] %L",id,"MAP_NOT_FOUND")
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
new authid[32],name[32] new authid[32],name[32]
get_user_authid(id,authid,31) get_user_authid(id,authid,31)
get_user_name(id,name,31) get_user_name(id,name,31)
switch (get_cvar_num("amx_show_activity")) { switch (get_cvar_num("amx_show_activity")) {
case 2: client_print(0,print_chat,"ADMIN %s: changelevel %s",name,arg) case 2: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_MAP_2",name,arg)
case 1: client_print(0,print_chat,"ADMIN: changelevel %s",arg) case 1: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_MAP_1",arg)
} }
log_amx("Cmd: ^"%s<%d><%s><>^" changelevel ^"%s^"", name,get_user_userid(id),authid, arg) log_amx("Cmd: ^"%s<%d><%s><>^" changelevel ^"%s^"", name,get_user_userid(id),authid, arg)
message_begin(MSG_ALL, SVC_INTERMISSION) message_begin(MSG_ALL, SVC_INTERMISSION)
@ -322,25 +336,25 @@ public cmdCvar(id,level,cid) {
if ( g_cvarRconNum < MAXRCONCVARS ) if ( g_cvarRconNum < MAXRCONCVARS )
copy( g_cvarRcon[ g_cvarRconNum++ ] , 31, arg2 ) copy( g_cvarRcon[ g_cvarRconNum++ ] , 31, arg2 )
else else
console_print(id,"[AMXX] Can't add more cvars for rcon access!") console_print(id,"[AMXX] %L",id,"NO_MORE_CVARS")
} }
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
if (!cvar_exists(arg)){ if (!cvar_exists(arg)){
console_print(id,"[AMXX] Unknown cvar: %s",arg) console_print(id,"[AMXX] %L",id,"UNKNOWN_CVAR",arg)
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
if ( onlyRcon(arg) && !(get_user_flags(id) & ADMIN_RCON)){ if ( onlyRcon(arg) && !(get_user_flags(id) & ADMIN_RCON)){
console_print(id,"[AMXX] You have no access to that cvar") console_print(id,"[AMXX] %L",id,"CVAR_NO_ACC")
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
else if (equal(arg,"sv_password") && !(get_user_flags(id) & ADMIN_PASSWORD)){ else if (equal(arg,"sv_password") && !(get_user_flags(id) & ADMIN_PASSWORD)){
console_print(id,"[AMXX] You have no access to that cvar") console_print(id,"[AMXX] %L",id,"CVAR_NO_ACC")
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
if (read_argc() < 3){ if (read_argc() < 3){
get_cvar_string(arg,arg2,63) get_cvar_string(arg,arg2,63)
console_print(id,"[AMXX] Cvar ^"%s^" is ^"%s^"",arg,arg2) console_print(id,"[AMXX] %L",id,"CVAR_IS",arg,arg2)
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
new authid[32],name[32] new authid[32],name[32]
@ -349,20 +363,28 @@ public cmdCvar(id,level,cid) {
log_amx("Cmd: ^"%s<%d><%s><>^" set cvar (name ^"%s^") (value ^"%s^")", log_amx("Cmd: ^"%s<%d><%s><>^" set cvar (name ^"%s^") (value ^"%s^")",
name,get_user_userid(id),authid, arg,arg2) name,get_user_userid(id),authid, arg,arg2)
set_cvar_string(arg,arg2) set_cvar_string(arg,arg2)
new activity = get_cvar_num("amx_show_activity") new activity = get_cvar_num("amx_show_activity")
if (activity) { if (activity!=0) {
new temp[64] new players[32],pnum,admin[64],cvar_val[64],len
if (activity == 1) get_players(players,pnum,"c")
temp = "ADMIN:" for (new i=0;i<pnum;i++) {
else len = format(admin,255,"%L",players[i],"ADMIN")
format(temp,63,"ADMIN %s:",name) strtoupper(admin)
if (equal(arg,"rcon_password") || equal(arg,"sv_password")) if (activity == 1)
copy(arg2,63,"*** PROTECTED ***") len += copy(admin[len],255-len,":")
client_print(0,print_chat,"%s set cvar %s to ^"%s^"",temp,arg,arg2) else
} len += format(admin[len],255-len," %s:",name)
if (equal(arg,"rcon_password") || equal(arg,"sv_password"))
format(cvar_val,63,"*** %L ***",players[i],"PROTECTED")
else
copy(cvar_val,63,arg2)
client_print(players[i],print_chat,"%L",players[i],"SET_CVAR_TO",admin,arg,arg2)
}
}
console_print(id,"[AMXX] Cvar ^"%s^" changed to ^"%s^"",arg,arg2) console_print(id,"[AMXX] %L",id,"CVAR_CHANGED",arg,arg2)
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
@ -371,6 +393,13 @@ public cmdPlugins(id,level,cid) {
return PLUGIN_HANDLED return PLUGIN_HANDLED
new name[32],version[32],author[32],filename[32],status[32] new name[32],version[32],author[32],filename[32],status[32]
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 motd_body[MOTD_LEN],state[4] new motd_body[MOTD_LEN],state[4]
@ -394,16 +423,16 @@ public cmdPlugins(id,level,cid) {
*/ */
new num = get_pluginsnum() new num = get_pluginsnum()
new running = 0 new running = 0
console_print(id,"Currently loaded plugins:") console_print(id,"%L:",id,"LOADED_PLUGINS")
console_print(id,"%-18.17s %-8.7s %-17.16s %-16.15s %-9.8s","name","version","author","file","status")
for (new i=0;i<num;i++) console_print(id,"%-18.17s %-8.7s %-17.16s %-16.15s %-9.8s",Lname,Lversion,Lauthor,Lfile,Lstatus)
{ for (new i=0;i<num;i++) {
get_plugin(i,filename,31,name,31,version,31,author,31,status,31) get_plugin(i,filename,31,name,31,version,31,author,31,status,31)
console_print(id,"%-18.17s %-8.7s %-17.16s %-16.15s %-9.8s",name,version,author,filename,status) console_print(id,"%-18.17s %-8.7s %-17.16s %-16.15s %-9.8s",name,version,author,filename,status)
if (equal(status,"running")) if (equal(status,"running"))
running++ running++
} }
console_print(id,"%d plugins, %d running",num,running) console_print(id,"%L",id,"PLUGINS_RUN",num,running)
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
@ -413,6 +442,11 @@ public cmdModules(id,level,cid) {
return PLUGIN_HANDLED return PLUGIN_HANDLED
new name[32],version[32],author[32],status,sStatus[16] new name[32],version[32],author[32],status,sStatus[16]
new Lname[32],Lversion[32],Lauthor[32]
format(Lname,31,"%L",id,"NAME")
format(Lversion,31,"%L",id,"VERSION")
format(Lauthor,31,"%L",id,"AUTHOR")
/* /*
new motd_body[MOTD_LEN],state[4] new motd_body[MOTD_LEN],state[4]
@ -432,10 +466,9 @@ public cmdModules(id,level,cid) {
show_motd(id,motd_body,"Currently loaded modules:") show_motd(id,motd_body,"Currently loaded modules:")
*/ */
new num = get_modulesnum() new num = get_modulesnum()
console_print(id,"Currently loaded modules:") console_print(id,"%L:",id,"LOADED_MODULES")
console_print(id,"%-23.22s %-8.7s %-20.19s","name","version","author") console_print(id,"%-23.22s %-8.7s %-20.19s",Lname,Lversion,Lauthor)
for (new i=0;i<num;i++) for (new i=0;i<num;i++) {
{
get_module(i,name,31,author,31,version,31,status) get_module(i,name,31,author,31,version,31,status)
switch (status) { switch (status) {
case module_loaded: copy(sStatus,15,"running") case module_loaded: copy(sStatus,15,"running")
@ -443,7 +476,7 @@ public cmdModules(id,level,cid) {
} }
console_print(id,"%-23.22s %-8.7s %-20.19s",name,version,author) console_print(id,"%-23.22s %-8.7s %-20.19s",name,version,author)
} }
console_print(id,"%d modules",num) console_print(id,"%L",id,"NUM_MODULES",num)
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
@ -454,7 +487,7 @@ public cmdCfg(id,level,cid) {
new arg[128] new arg[128]
read_argv(1,arg,127) read_argv(1,arg,127)
if (!file_exists(arg)){ if (!file_exists(arg)){
console_print(id,"[AMXX] File ^"%s^" not found",arg) console_print(id,"[AMXX] %L",id,"FILE_NOT_FOUND",arg)
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
new authid[32],name[32] new authid[32],name[32]
@ -466,16 +499,18 @@ public cmdCfg(id,level,cid) {
server_cmd("exec %s",arg) server_cmd("exec %s",arg)
switch(get_cvar_num("amx_show_activity")) { switch(get_cvar_num("amx_show_activity")) {
case 2: client_print(0,print_chat,"ADMIN %s: execute config %s",name,arg) case 2: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_CONF_2",name,arg)
case 1: client_print(0,print_chat,"ADMIN: execute config %s",arg) case 1: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_CONF_1",arg)
} }
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
public cmdLBack() { public cmdLBack() {
new paused[16]
format(paused,15,"%L",g_pauseCon,g_Paused ? "UNPAUSED" : "PAUSED")
set_cvar_float("pausable",g_pausAble) set_cvar_float("pausable",g_pausAble)
console_print(g_pauseCon,"[AMXX] Server %s", g_Paused ? "unpaused" : "paused") console_print(g_pauseCon,"[AMXX] Server %s", paused)
if (g_Paused) g_Paused = false if (g_Paused) g_Paused = false
else g_Paused = true else g_Paused = true
return PLUGIN_HANDLED return PLUGIN_HANDLED
@ -490,20 +525,33 @@ public cmdPause(id,level,cid) {
g_pausAble = get_cvar_float("pausable") g_pausAble = get_cvar_float("pausable")
if (!slayer) slayer = find_player("h") if (!slayer) slayer = find_player("h")
if (!slayer){ if (!slayer){
console_print(id,"[AMXX] Server was unable to pause the game. Real players on server are needed") console_print(id,"[AMXX] %L",id,"UNABLE_PAUSE")
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
set_cvar_float("pausable",1.0) set_cvar_float("pausable",1.0)
client_cmd(slayer,"pause;pauseAck") client_cmd(slayer,"pause;pauseAck")
log_amx("Cmd: ^"%s<%d><%s><>^" %s server", log_amx("Cmd: ^"%s<%d><%s><>^" %s server",
name,get_user_userid(id),authid, g_Paused ? "unpause" : "pause" ) name,get_user_userid(id),authid, g_Paused ? "unpause" : "pause" )
console_print(id,"[AMXX] Server proceed %s", g_Paused ? "unpausing" : "pausing") new pausing[16]
format(pausing,15,"%L",id,g_Paused ? "unpausing" : "pausing")
switch(get_cvar_num("amx_show_activity")) { console_print(id,"[AMXX] %L", id, pausing)
case 2: client_print(0,print_chat,"ADMIN %s: %s server",name,g_Paused ? "unpause" : "pause")
case 1: client_print(0,print_chat,"ADMIN: %s server",g_Paused ? "unpause" : "pause") new activity = get_cvar_num("amx_show_activity")
if (activity!=0) {
new players[32],pnum,msg[128],len
get_players(players,pnum,"c")
for (new i=0;i<pnum;i++) {
len = format(msg,127,"%L",players[i],"ADMIN")
strtoupper(msg)
if (activity==1)
len += copy(msg[len],127-len,":")
else
len += format(msg[len],127-len," %s:",name)
format(msg[len],127-len,"%L",players[i],g_Paused ? "UNPAUSE" : "PAUSE" )
client_print(players[i],print_chat,"%s server",msg)
}
} }
g_pauseCon = id g_pauseCon = id
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
@ -517,7 +565,7 @@ public cmdRcon(id,level,cid) {
get_user_name(id,name,31) get_user_name(id,name,31)
log_amx("Cmd: ^"%s<%d><%s><>^" server console (cmdline ^"%s^")", log_amx("Cmd: ^"%s<%d><%s><>^" server console (cmdline ^"%s^")",
name,get_user_userid(id),authid, arg) name,get_user_userid(id),authid, arg)
console_print(id,"[AMXX] Commmand line ^"%s^" sent to server console",arg) console_print(id,"[AMXX] %L",id,"COM_SENT_SERVER",arg)
server_cmd(arg) server_cmd(arg)
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
@ -526,20 +574,27 @@ public cmdWho(id,level,cid) {
if (!cmd_access(id,level,cid,1)) if (!cmd_access(id,level,cid,1))
return PLUGIN_HANDLED return PLUGIN_HANDLED
new players[32], inum, authid[32],name[32], flags, sflags[32] new players[32], inum, cl_on_server[64], authid[32], name[32], flags, sflags[32]
new lImm[16],lRes[16],lAccess[16],lYes[16],lNo[16]
format(lImm,15,"%L",id,"IMMU")
format(lRes,15,"%L",id,"RESERV")
format(lAccess,15,"%L",id,"ACCESS")
format(lYes,15,"%L",id,"YES")
format(lNo,15,"%L",id,"YES")
get_players(players,inum) get_players(players,inum)
console_print(id,"^nClients on server:^n # %-16.15s %-12s %-8s %-4.3s %-4.3s %s", format(cl_on_server,63,"%L",id,"CLIENTS_ON_SERVER")
"nick","authid","userid","imm","res","access") console_print(id,"^n%s:^n # %-16.15s %-12s %-8s %-4.3s %-4.3s %s",
cl_on_server,"nick","authid","userid",lImm,lRes,lAccess)
for (new a = 0; a < inum; ++a) { for (new a = 0; a < inum; ++a) {
get_user_authid(players[a],authid,31) get_user_authid(players[a],authid,31)
get_user_name(players[a],name,31) get_user_name(players[a],name,31)
flags = get_user_flags(players[a]) flags = get_user_flags(players[a])
get_flags(flags,sflags,31) get_flags(flags,sflags,31)
console_print(id,"%2d %-16.15s %-12s %-8d %-4.3s %-4.3s %s", players[a],name,authid, console_print(id,"%2d %-16.15s %-12s %-8d %-4.3s %-4.3s %s", players[a],name,authid,
get_user_userid(players[a]),(flags&ADMIN_IMMUNITY)?"yes":"no", get_user_userid(players[a]),(flags&ADMIN_IMMUNITY)?lYes:lNo,
(flags&ADMIN_RESERVATION)?"yes":"no",sflags) (flags&ADMIN_RESERVATION)?lYes:lNo,sflags)
} }
console_print(id,"Total %d",inum) console_print(id,"%L",id,"TOTAL_NUM",inum)
get_user_authid(id,authid,31) get_user_authid(id,authid,31)
get_user_name(id,name,31) get_user_name(id,name,31)
log_amx("Cmd: ^"%s<%d><%s><>^" ask for players list",name,get_user_userid(id),authid) log_amx("Cmd: ^"%s<%d><%s><>^" ask for players list",name,get_user_userid(id),authid)
@ -565,29 +620,30 @@ public cmdLeave(id,level,cid) {
else else
ltags[ltagsnum++][0] = 0 ltags[ltagsnum++][0] = 0
} }
new nick[32], ires, pnum = get_maxplayers() + 1, count = 0 new nick[32], ires, pnum = get_maxplayers() + 1, count = 0, lReason[128]
for (new b=1;b<pnum;++b){ for (new b=1;b<pnum;++b){
if (!is_user_connected(b)&&!is_user_connecting(b)) continue if (!is_user_connected(b)&&!is_user_connecting(b)) continue
get_user_name(b,nick,31) get_user_name(b,nick,31)
ires = hasTag(nick,ltags,ltagsnum) ires = hasTag(nick,ltags,ltagsnum)
if (ires!=-1){ if (ires!=-1){
console_print(id,"[AMXX] Skipping ^"%s^" (matching ^"%s^")",nick,ltags[ires]) console_print(id,"[AMXX] %L",id,"SKIP_MATCH",nick,ltags[ires])
continue continue
} }
if (get_user_flags(b)&ADMIN_IMMUNITY){ if (get_user_flags(b)&ADMIN_IMMUNITY){
console_print(id,"[AMXX] Skipping ^"%s^" (immunity)",nick) console_print(id,"[AMXX] %L",id,"SKIP_IMM",nick)
continue continue
} }
console_print(id,"[AMXX] Kicking ^"%s^"",nick) console_print(id,"[AMXX] %L",id,"KICK_PL",nick)
if (is_user_bot(b)) if (is_user_bot(b))
server_cmd("kick #%d",get_user_userid(b)) server_cmd("kick #%d",get_user_userid(b))
else else
{ {
server_cmd("kick #%d ^"You have been dropped because admin has left only specified group of clients^"",get_user_userid(b)) format(lReason,127,"%L",b,"YOU_DROPPED")
server_cmd("kick #%d ^"%s^"",get_user_userid(b),lReason)
} }
count++ count++
} }
console_print(id,"[AMXX] Kicked %d clients",count) console_print(id,"[AMXX] %L",id,"KICKED_CLIENTS",count)
new authid[32],name[32] new authid[32],name[32]
get_user_authid(id,authid,31) get_user_authid(id,authid,31)
get_user_name(id,name,31) get_user_name(id,name,31)
@ -595,8 +651,8 @@ public cmdLeave(id,level,cid) {
name,get_user_userid(id),authid,ltags[0],ltags[1],ltags[2],ltags[3] ) name,get_user_userid(id),authid,ltags[0],ltags[1],ltags[2],ltags[3] )
switch(get_cvar_num("amx_show_activity")) { switch(get_cvar_num("amx_show_activity")) {
case 2: client_print(0,print_chat,"ADMIN %s: leave %s %s %s %s",name,ltags[0],ltags[1],ltags[2],ltags[3]) case 2: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_LEAVE_2",name,ltags[0],ltags[1],ltags[2],ltags[3])
case 1: client_print(0,print_chat,"ADMIN: leave %s %s %s %s",ltags[0],ltags[1],ltags[2],ltags[3]) case 1: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_LEAVE_1",ltags[0],ltags[1],ltags[2],ltags[3])
} }
return PLUGIN_HANDLED return PLUGIN_HANDLED
@ -625,11 +681,11 @@ public cmdNick(id,level,cid) {
name,get_user_userid(id),authid,arg2,name2,get_user_userid(player),authid2 ) name,get_user_userid(id),authid,arg2,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,"ADMIN %s: change nick of %s to ^"%s^"",name,name2,arg2) case 2: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_NICK_2",name,name2,arg2)
case 1: client_print(0,print_chat,"ADMIN: change nick of %s to ^"%s^"",name2,arg2) case 1: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_NICK_1",name2,arg2)
} }
console_print(id,"[AMXX] Changed nick of %s to ^"%s^"",name2,arg2) console_print(id,"[AMXX] %L",id,"CHANGED_NICK",name2,arg2)
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }

View File

@ -36,12 +36,9 @@
#define HELPAMOUNT 10 // Number of commands per page #define HELPAMOUNT 10 // Number of commands per page
new g_typeHelp[] = "Type 'amx_help' in the console to see available commands"
new g_timeInfo1[] = "Time Left: %d:%02d min. Next Map: %s"
new g_timeInfo2[] = "No Time Limit. Next Map: %s"
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_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")
} }
@ -64,7 +61,7 @@ public cmdHelp(id,level,cid) {
if (start >= clcmdsnum) if (start >= clcmdsnum)
start = clcmdsnum - 1 start = clcmdsnum - 1
console_print(id,"^n----- AMX Mod X Help: Commands -----") 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
@ -75,27 +72,27 @@ public cmdHelp(id,level,cid) {
get_concmd(i,cmd,31,eflags,info,127,flags,id) get_concmd(i,cmd,31,eflags,info,127,flags,id)
console_print(id,"%3d: %s %s",i+1,cmd,info) console_print(id,"%3d: %s %s",i+1,cmd,info)
} }
console_print(id,"----- Entries %d - %d of %d -----",start+1,end,clcmdsnum) console_print(id,"----- %L -----",id,"ENTRIES",start+1,end,clcmdsnum)
if (end < clcmdsnum) if (end < clcmdsnum)
console_print(id,"----- Use 'amx_help %d' for more -----",end+1) console_print(id,"----- %L -----",id,"USE_MORE",end+1)
else else
console_print(id,"----- Use 'amx_help 1' for begin -----") console_print(id,"----- %L -----",id,"USE_BEGIN")
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
public dispInfo(id){ public dispInfo(id) {
client_print(id,print_chat, g_typeHelp ) 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){ if (timeleft > 0){
client_print(id,print_chat, g_timeInfo1 , timeleft / 60, timeleft % 60,nextmap) client_print(id,print_chat, "%L" , id, "TIME_INFO_1", timeleft / 60, timeleft % 60,nextmap)
} }
} }
client_print(id,print_chat, g_timeInfo2 ,nextmap) client_print(id,print_chat,"%L",id,"TIME_INFO_2",nextmap)
} }
setHelp(id) setHelp(id)

View File

@ -40,9 +40,9 @@
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_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" ,
@ -51,16 +51,18 @@ public plugin_init()
register_clcmd( g_cmdLoopback, "ackSignal" ) register_clcmd( g_cmdLoopback, "ackSignal" )
} }
public ackSignal(id) public ackSignal(id) {
server_cmd("kick #%d ^"Dropped due to slot reservation^"", get_user_userid(id) ) new lReason[64]
format(lReason,63,"%L",id,"DROPPED_RES")
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 ( (get_user_flags(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 )
@ -76,9 +78,9 @@ public client_authorized(id)
#if defined HIDE_RESERVED_SLOTS #if defined HIDE_RESERVED_SLOTS
public client_disconnect(id) public client_disconnect(id)
{ {
new maxplayers = get_maxplayers( ) new maxplayers = get_maxplayers()
setVisibleSlots( get_playersnum(1) - 1 , maxplayers , setVisibleSlots( get_playersnum(1) - 1 , maxplayers ,
maxplayers - get_cvar_num( "amx_reservation" ) ) maxplayers - get_cvar_num("amx_reservation") )
return PLUGIN_CONTINUE return PLUGIN_CONTINUE
} }

View File

@ -44,23 +44,20 @@ new g_coloredMenus
new g_voteCaller new g_voteCaller
new g_Execute[256] new g_Execute[256]
new g_execLen new g_execLen
new g_alredyVoting[]= "There is already one voting..."
new g_notAllowed[] = "Voting not allowed at this time"
new g_votingStarted[] = "Voting has started..."
new g_playerTag[] = "PLAYER"
new g_adminTag[] = "ADMIN"
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_menucmd(register_menuid("Change map to ") ,MENU_KEY_1|MENU_KEY_2,"voteCount") register_dictionary("adminvote.txt")
register_menucmd(register_menuid("Choose map: ") ,MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4,"voteCount") register_dictionary("common.txt")
register_menucmd(register_menuid("Kick ") ,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("Ban ") ,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("Vote: ") ,MENU_KEY_1|MENU_KEY_2,"voteCount") register_menucmd(register_menuid("Kick "),MENU_KEY_1|MENU_KEY_2,"voteCount")
register_menucmd(register_menuid("The result: ") ,MENU_KEY_1|MENU_KEY_2,"actionResult") 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("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>")
@ -69,7 +66,7 @@ public plugin_init() {
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 ) ) { if ( task_exists( 99889988 , 1 ) ) {
@ -77,40 +74,42 @@ public cmdCancelVote(id,level,cid){
get_user_authid(id,authid,31) get_user_authid(id,authid,31)
get_user_name(id,name,31) get_user_name(id,name,31)
log_amx("Vote: ^"%s<%d><%s><>^" cancel vote session", name,get_user_userid(id),authid) log_amx("Vote: ^"%s<%d><%s><>^" cancel vote session", name,get_user_userid(id),authid)
switch(get_cvar_num("amx_show_activity")) { new players[32],pnum,lTag[16],activity = get_cvar_num("amx_show_activity")
case 2: client_print(0,print_chat,"%s %s: cancel vote", (get_user_flags(id) & ADMIN_USER) ? g_playerTag : g_adminTag, name) get_players(players,pnum,"c")
case 1: client_print(0,print_chat,"%s: cancel vote", (get_user_flags(id) & ADMIN_USER) ? g_playerTag : g_adminTag) for (new i=0;i<pnum;i++) {
format(lTag,15,"%L",players[i],is_user_admin(id) ? "ADMIN" : "PLAYER")
strtoupper(lTag)
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, "Voting canceled" ) console_print(id, "%L", id, "VOTING_CANC" )
client_print(0,print_chat,"Voting canceled") client_print(0,print_chat,"%L",LANG_PALYER,"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, "There is no voting to cancel or the vote session can't be canceled with that command" ) console_print(id, "%L", id, "NO_VOTE_CANC" )
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
public delayedExec(cmd[]) public delayedExec(cmd[])
server_cmd(cmd) server_cmd(cmd)
new g_resultRef[] = "Result refused" public autoRefuse() {
new g_resultAcpt[] = "Result accepted" log_amx("Vote: %s" , "Result refused")
new g_votingFailed[] = "Voting failed"
new g_votingSuccess[] = "Voting successful"
public autoRefuse(){
log_amx("Vote: %s" , g_resultRef)
client_print(0,print_chat,g_resultRef ) client_print(0,print_chat,g_resultRef )
} }
public actionResult(id,key) { public actionResult(id,key) {
remove_task( 4545454 ) remove_task( 4545454 )
switch(key){ switch (key){
case 0: { case 0: {
set_task(2.0,"delayedExec",0,g_Execute,g_execLen) set_task(2.0,"delayedExec",0,g_Execute,g_execLen)
log_amx("Vote: %s",g_resultAcpt) log_amx("Vote: %L","en","RES_ACCEPTED")
client_print(0,print_chat,g_resultAcpt ) client_print(0,print_chat,"%L",LANG_PLAYER,"RES_ACCEPTED")
} }
case 1: autoRefuse() case 1: autoRefuse()
} }
@ -120,63 +119,79 @@ public actionResult(id,key) {
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]
if ( iResult < iRatio ){ new players[32],pnum,i
if (g_yesNoVote) get_players(players,pnum,"c")
client_print(0,print_chat,"%s (yes ^"%d^") (no ^"%d^") (needed ^"%d^")",g_votingFailed, g_voteCount[0], g_voteCount[1] , iRatio ) if ( iResult < iRatio ) {
else new lVotingFailed[32]
client_print(0,print_chat,"%s (got ^"%d^") (needed ^"%d^")",g_votingFailed,iResult , iRatio ) for (i=0;i<pnum;i++) {
log_amx("Vote: %s (got ^"%d^") (needed ^"%d^")",g_votingFailed,iResult , iRatio ) format(lVotingFailed,31,"%L",players[i],"VOTING_FAILED")
if (g_yesNoVote)
client_print(0,print_chat,"%L",players[i],"VOTING_RES_1",
lVotingFailed,g_voteCount[0],g_voteCount[1],iRatio)
else
client_print(0,print_chat,"%L",players[i],"VOTING_RES_2",lVotingFailed,iResult,iRatio )
}
log_amx("Vote: %s (got ^"%d^") (needed ^"%d^")",g_votingFailed,iResult,iRatio)
return PLUGIN_CONTINUE return PLUGIN_CONTINUE
} }
g_execLen = format(g_Execute,255,g_Answer,g_optionName[best]) + 1 g_execLen = format(g_Execute,255,g_Answer,g_optionName[best]) + 1
if (g_execResult){ if (g_execResult){
g_execResult = false g_execResult = false
if ( is_user_connected(g_voteCaller) ) { if ( is_user_connected(g_voteCaller) ) {
new menuBody[512] new menuBody[512],lTheResult[32],lYes[16],lNo[16]
new len = format(menuBody,511,g_coloredMenus ? "\yThe result: \w%s^n^n" : "The result: %s^n^n", g_Execute ) format(lTheResult,31,"%L",g_voteCaller,"THE_RESULT")
len += copy( menuBody[len] ,511 - len, g_coloredMenus ? "\yDo you want to continue?^n\w" : "Do you want to continue?^n" ) format(lYes,15,"%L",g_voteCaller,"YES")
copy( menuBody[len] ,511 - len, "^n1. Yes^n2. No") format(lNo,15,"%L",g_voteCaller,"NO")
show_menu( g_voteCaller ,0x03 ,menuBody, 10 ) ucfirst(lYes)
ucfirst(lNo)
new len = format(menuBody,511,g_coloredMenus ? "\y%s: \w%s^n^n" : "%s: %s^n^n", lTheResult, g_Execute )
len += copy( 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) 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)
} }
client_print(0,print_chat,"%s (got ^"%d^") (needed ^"%d^"). The result: %s", g_votingSuccess, iResult , iRatio , g_Execute ) new lVotingSuccess[32]
for (i=0;i<pnum;i++) {
format(lVotingSuccess,31,"%L",players[i],"VOTING_SUCCESS")
ient_print(0,print_chat,"%L",players[i],"VOTING_RES_3",lVotingSuccess,iResult,iRatio,g_Execute)
}
log_amx("Vote: %s (got ^"%d^") (needed ^"%d^") (result ^"%s^")", g_votingSuccess, iResult , iRatio , g_Execute ) log_amx("Vote: %s (got ^"%d^") (needed ^"%d^") (result ^"%s^")", g_votingSuccess, 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,"%s voted %s",name,key ? "against" : "for" ) client_print(0,print_chat,"%L",LANG_PLAYER,key ? "VOTED_AGAINST" : "VOTED_FOR",name)
else else
client_print(0,print_chat,"%s voted for option #%d",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, g_alredyVoting ) 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, g_notAllowed ) console_print(id, "%L", id, "VOTING_NOT_ALLOW")
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
new argc = read_argc() new argc = read_argc()
@ -186,20 +201,22 @@ public cmdVoteMap(id,level,cid) {
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){ for (new i = 1; i < argc; ++i) {
read_argv(i,g_optionName[g_validMaps],31) 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) {
console_print(id,"Given %s not valid",(argc==2)?"map is":"maps are") new lMaps[16]
format(lMaps,15,"%L",id,(argc==2)?"MAP_IS":"MAPS_ARE")
console_print(id,"%L",id,"GIVEN_NOT_VALID")
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
new menu_msg[256] new menu_msg[256]
new keys = 0 new keys = 0
if (g_validMaps > 1){ if (g_validMaps > 1) {
keys = MENU_KEY_0 keys = MENU_KEY_0
copy(menu_msg,255,g_coloredMenus ? "\yChoose map: \w^n^n" : "Choose map: ^n^n") copy(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){ for(new a = 0; a < g_validMaps; ++a){
format(temp,127,"%d. %s^n",a+1,g_optionName[a]) format(temp,127,"%d. %s^n",a+1,g_optionName[a])
@ -209,9 +226,15 @@ public cmdVoteMap(id,level,cid) {
add(menu_msg,255,"^n0. None") add(menu_msg,255,"^n0. None")
g_yesNoVote = 0 g_yesNoVote = 0
} }
else{ else {
format(menu_msg,255,g_coloredMenus ? "\yChange map to %s?\w^n^n1. Yes^n2. No" new lChangeMap[32],lYes[16],lNo[16]
: "Change map to %s?^n^n1. Yes^n2. No",g_optionName[0]) format(lChangeMap,31,"%L",LANG_SERVER,"CHANGE_MAP_TO")
format(lYes,15,"%L",LANG_SERVER,"YES")
format(lNo,15,"%L",LANG_SERVER,"NO")
ucfirst(lYes)
ucfirst(lNo)
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)
keys = MENU_KEY_1|MENU_KEY_2 keys = MENU_KEY_1|MENU_KEY_2
g_yesNoVote = 1 g_yesNoVote = 1
} }
@ -224,23 +247,32 @@ public cmdVoteMap(id,level,cid) {
else else
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,g_optionName[0],g_optionName[1],g_optionName[2],g_optionName[3]) name,get_user_userid(id),authid,g_optionName[0],g_optionName[1],g_optionName[2],g_optionName[3])
switch(get_cvar_num("amx_show_activity")) { new lTag[16],activity = get_cvar_num("amx_show_activity")
case 2: client_print(0,print_chat,"%s %s: vote map(s)",name, if (activity>0) {
(get_user_flags(id) & ADMIN_USER) ? g_playerTag : g_adminTag) new players[32],pnum
case 1: client_print(0,print_chat,"%s: vote map(s)", get_players(players,pnum,"c")
(get_user_flags(id) & ADMIN_USER) ? g_playerTag : g_adminTag) for (new i=0;i<pnum;i++) {
format(lTag,15,"%L",players[i],is_user_admin(id)?"ADMIN":"PLAYER")
strtoupper(lTag)
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)) 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, g_votingStarted ) 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
} }
@ -250,18 +282,18 @@ public cmdVote(id,level,cid) {
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, g_alredyVoting ) 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, g_notAllowed ) console_print(id, "%L", id, "VOTING_NOT_ALLOW")
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
new quest[48] new quest[48]
read_argv(1,quest,47) read_argv(1,quest,47)
if ((contain(quest,"sv_password")!=-1)||(contain(quest,"rcon_password")!=-1)|| if ((contain(quest,"sv_password")!=-1)||(contain(quest,"rcon_password")!=-1)||
(contain(quest,"kick")!=-1)||(contain(quest,"addip")!=-1)||(contain(quest,"ban")!=-1)){ (contain(quest,"kick")!=-1)||(contain(quest,"addip")!=-1)||(contain(quest,"ban")!=-1)){
console_print(id,"Voting for that has been forbidden") console_print(id,"%L",id,"VOTING_FORBIDDEN")
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
read_argv(2,g_optionName[0],31) read_argv(2,g_optionName[0],31)
@ -273,41 +305,49 @@ public cmdVote(id,level,cid) {
log_amx("Vote: ^"%s<%d><%s><>^" vote custom (question ^"%s^") (option#1 ^"%s^") (option#2 ^"%s^")", 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]) name,get_user_userid(id),authid,quest,g_optionName[0],g_optionName[1])
switch(get_cvar_num("amx_show_activity")) { new activity = get_cvar_num("amx_show_activity")
case 2: client_print(0,print_chat,"%s %s: vote custom", if (activity>0) {
(get_user_flags(id) & ADMIN_USER) ? g_playerTag : g_adminTag,name ) new players[32],pnum,lTag[16]
case 1: client_print(0,print_chat,"%s: vote custom", get_players(players,pnum,"c")
(get_user_flags(id) & ADMIN_USER) ? g_playerTag : g_adminTag) for (new i=0;i<pnum;i++) {
format(lTag,"%L",players[i],is_user_admin(id)?"ADMIN":"PLAYER")
strtoupper(lTag)
switch (activity) {
case 2: client_print(players[i],print_chat,"%L","ADMIN_VOTE_CUS_2",lTag,name)
case 1: client_print(players[i],print_chat,"%L","ADMIN_VOTE_CUS_1",lTag)
}
}
} }
new menu_msg[256] new menu_msg[256],lVote[16]
format(lVote,15,"%L",LANG_SERVER,"VOTE")
new keys = MENU_KEY_1|MENU_KEY_2 new keys = MENU_KEY_1|MENU_KEY_2
format(menu_msg,255, g_coloredMenus ? "\yVote: %s\w^n^n1. %s^n2. %s" format(menu_msg,255, g_coloredMenus ? "\y%s: %s\w^n^n1. %s^n2. %s"
: "Vote: %s^n^n1. %s^n2. %s",quest,g_optionName[0],g_optionName[1]) : "%s: %s^n^n1. %s^n2. %s",lVote,quest,g_optionName[0],g_optionName[1])
g_execResult = false g_execResult = false
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_vote_ratio") g_voteRatio = get_cvar_float("amx_vote_ratio")
format(g_Answer,127,"%s - %%s",quest) format(g_Answer,127,"%s - %%s",quest)
show_menu(0,keys,menu_msg,floatround(vote_time)) show_menu(0,keys,menu_msg,floatround(vote_time),"Vote: ")
set_task(vote_time,"checkVotes" , 99889988 ) set_task(vote_time,"checkVotes" , 99889988 )
g_voteCaller = id g_voteCaller = id
console_print(id, g_votingStarted ) console_print(id, "%L", id, "VOTING_STARTED")
g_voteCount ={ 0,0,0,0} g_voteCount = {0,0,0,0}
g_yesNoVote = 0 g_yesNoVote = 0
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
public cmdVoteKickBan(id,level,cid) { public cmdVoteKickBan(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, g_alredyVoting ) 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, g_notAllowed ) console_print(id, "%L", id, "VOTING_NOT_ALLOW")
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
new cmd[32] new cmd[32]
@ -317,18 +357,26 @@ public cmdVoteKickBan(id,level,cid) {
read_argv(1,arg,31) read_argv(1,arg,31)
new player = cmd_target(id,arg,1) new player = cmd_target(id,arg,1)
if (!player) return PLUGIN_HANDLED if (!player) return PLUGIN_HANDLED
if (voteban && is_user_bot(player)) { if (voteban && is_user_bot(player)) {
new imname[32] new imname[32]
get_user_name(player,imname,31) get_user_name(player,imname,31)
console_print(id,"That action can't be performed on bot ^"%s^"",imname) 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] 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(lKickBan,15,"%L",LANG_SERVER,voteban?"BAN":"KICK")
ucfirst(lYes)
ucfirst(lNo)
ucfirst(lKickBan)
get_user_name(player,arg,31) get_user_name(player,arg,31)
format(menu_msg,255,g_coloredMenus ? "\y%s %s?\w^n^n1. Yes^n2. No" format(menu_msg,255,g_coloredMenus ?
: "%s %s?^n^n1. Yes^n2. No", voteban ? "Ban" : "Kick", arg) "\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)
@ -340,22 +388,31 @@ public cmdVoteKickBan(id,level,cid) {
log_amx("Vote: ^"%s<%d><%s><>^" vote %s (target ^"%s^")", log_amx("Vote: ^"%s<%d><%s><>^" vote %s (target ^"%s^")",
name,get_user_userid(id),authid,voteban ? "ban" : "kick",arg) name,get_user_userid(id),authid,voteban ? "ban" : "kick",arg)
switch(get_cvar_num("amx_show_activity")) { new activity = get_cvar_num("amx_show_activity")
case 2: client_print(0,print_chat,"%s %s: vote %s for %s", if (activity>0) {
(get_user_flags(id) & ADMIN_USER) ? g_playerTag : g_adminTag,name,voteban ? "ban" : "kick",arg ) new players[32],pnum,lTag[16]
case 1: client_print(0,print_chat,"%s: vote %s for %s", get_players(players,pnum,"c")
(get_user_flags(id) & ADMIN_USER) ? g_playerTag : g_adminTag,voteban ? "ban" : "kick",arg) for (new i=0;i<pnum;i++) {
format(lTag,15,"%L",players[i],is_user_admin(id)?"ADMIN":"USER"
format(lKickBan,"%L",players[i],voteban?"BAN":"KICK")
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,"%s: vote %s for %s",
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)) 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, g_votingStarted ) 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
} }