From 0be7ddcbd9a34b8bb4c1e86d911e2ae867c9c777 Mon Sep 17 00:00:00 2001 From: Felix Geyer Date: Tue, 3 Aug 2004 20:11:16 +0000 Subject: [PATCH] updated to use the multi-lingual system | better code style --- plugins/admin.sma | 31 +++-- plugins/adminchat.sma | 95 +++++++++------- plugins/admincmd.sma | 242 ++++++++++++++++++++++++--------------- plugins/adminhelp.sma | 21 ++-- plugins/adminslots.sma | 22 ++-- plugins/adminvote.sma | 253 +++++++++++++++++++++++++---------------- 6 files changed, 399 insertions(+), 265 deletions(-) diff --git a/plugins/admin.sma b/plugins/admin.sma index 767d5292..62f71233 100755 --- a/plugins/admin.sma +++ b/plugins/admin.sma @@ -57,6 +57,7 @@ public plugin_init() #else register_plugin("Admin Base",AMXX_VERSION_STR,"AMXX Dev Team") #endif + register_dictionary("admin.txt") register_cvar("amx_mode","1") register_cvar("amx_password_field","_pw") register_cvar("amx_default_access","") @@ -133,7 +134,11 @@ loadSettings(szFilename[]) g_aFlags[ g_aNum ] = read_flags( szFlags ) ++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 } #endif @@ -148,7 +153,7 @@ public adminSql() { new Sql:sql = dbi_connect(host,user,pass,db,error,127) 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 } @@ -158,13 +163,13 @@ public adminSql() { if (Res == RESULT_FAILED) { 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_close(Sql) return PLUGIN_HANDLED } else if (Res == RESULT_NONE) { - server_print("[AMXX] No admins found.") + server_print("[AMXX] %L",LANG_SERVER,"NO_ADMINS") dbi_free_result(Res) dbi_close(Sql) return PLUGIN_HANDLED @@ -185,7 +190,10 @@ public adminSql() { ++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_close(sql) return PLUGIN_HANDLED @@ -303,13 +311,13 @@ accessUser( id, name[] = "" ) get_cvar_string("amx_password_field",passfield,31) get_user_info(id,passfield,password,31) 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) { client_cmd(id,g_cmdLoopback) return PLUGIN_HANDLED } - if (result & 4) client_cmd(id,"echo ^"* Password accepted^"") - if (result & 8) client_cmd(id,"echo ^"* Privileges set^"") + if (result & 4) client_cmd(id,"echo ^"* %L^"",id,"PAS_ACC") + if (result & 8) client_cmd(id,"echo ^"* %L^"",id,"PRIV_SET") return PLUGIN_CONTINUE } @@ -328,8 +336,11 @@ public client_infochanged(id) return PLUGIN_CONTINUE } -public ackSignal(id) - server_cmd("kick #%d ^"You have no entry to the server...^"", get_user_userid(id) ) +public ackSignal(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) return get_cvar_num( "amx_mode" ) ? accessUser( id ) : PLUGIN_CONTINUE diff --git a/plugins/adminchat.sma b/plugins/adminchat.sma index e6340ece..2a76cfb5 100755 --- a/plugins/adminchat.sma +++ b/plugins/adminchat.sma @@ -42,12 +42,13 @@ new g_msgChannel #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 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_dictionary("adminchat.txt") register_clcmd("say","cmdSayChat",ADMIN_CHAT,"@[@|@|@][w|r|g|b|y|m|c] - displays hud message") register_clcmd("say_team","cmdSayAdmin",0,"@ - displays message to admins") register_concmd("amx_say","cmdSay",ADMIN_CHAT," - sends message to all players") @@ -57,17 +58,17 @@ public plugin_init(){ register_concmd("amx_csay","cmdTsay",ADMIN_CHAT," - sends center hud message to all players") } -public cmdSayChat(id) { - if (!(get_user_flags(id)&ADMIN_CHAT)) return PLUGIN_CONTINUE - new said[6], i=0 +public cmdSayChat(id) { + if (!access(id,ADMIN_CHAT)) return PLUGIN_CONTINUE + new said[6], i=0 read_argv(1,said,5) while (said[i]=='@') - i++ - if ( !i || i > 3 ) return PLUGIN_CONTINUE + i++ + if ( !i || i > 3 ) return PLUGIN_CONTINUE new message[192], a = 0 read_args(message,191) remove_quotes(message) - switch(said[i]){ + switch(said[i]){ case 'r': a = 1 case 'g': a = 2 case 'b': a = 3 @@ -76,31 +77,32 @@ public cmdSayChat(id) { case 'c': a = 6 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_name(id,name,31) 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_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) g_msgChannel = 3 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 ) + 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 defined SHOW_NAMES - show_hudmessage(0,"%s : %s",name,message[i+1]) +#if defined SHOW_NAMES + show_hudmessage(0,"%s : %s",name,message[i+1]) client_print(0,print_notify,"%s : %s",name,message[i+1]) #else - show_hudmessage(0,message[i+1]) + show_hudmessage(0,message[i+1]) client_print(0,print_notify,message[i+1]) #endif - return PLUGIN_HANDLED + return PLUGIN_HANDLED } -public cmdSayAdmin(id) { +public cmdSayAdmin(id) { new said[2] read_argv(1,said,1) if (said[0]!='@') return PLUGIN_CONTINUE @@ -110,20 +112,20 @@ public cmdSayAdmin(id) { remove_quotes(message) 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><>^" chat ^"%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]) - get_players(players,inum) - for(new i=0; i<%s><>^" triggered ^"amx_chat^" (text ^"%s^")",name,userid,authid,message) format(message,191,"(ADMINS) %s : %s",name,message) console_print(id,message) - for(new i = 0; i < inum; ++i){ - if ( get_user_flags(players[i]) & ADMIN_CHAT ) + for (new i = 0; i < inum; ++i) { + if ( access(players[i],ADMIN_CHAT) ) client_print(players[i],print_chat,message) } return PLUGIN_HANDLED } -public cmdSay(id,level,cid){ +public cmdSay(id,level,cid) { if (!cmd_access(id,level,cid,2)) return PLUGIN_HANDLED - new message[192], name[32],authid[32], userid + new message[192],name[32],authid[32],userid read_args(message,191) remove_quotes(message) get_user_authid(id,authid,31) get_user_name(id,name,31) userid = get_user_userid(id) - client_print(0,print_chat,"(ALL) %s : %s",name,message) - console_print(id,"(ALL) %s : %s",name,message) - log_amx("Chat: ^"%s<%d><%s><>^" say ^"%s^"", name,userid,authid,message) + client_print(0,print_chat,"%L",LANG_PLAYER,"PRINT_LANG",name,message) + console_print(id,"%L",id,"PRINT_LANG",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) return PLUGIN_HANDLED } -public cmdPsay(id,level,cid){ +public cmdPsay(id,level,cid) { if (!cmd_access(id,level,cid,3)) return PLUGIN_HANDLED new name[32] @@ -192,22 +194,30 @@ public cmdPsay(id,level,cid){ return PLUGIN_HANDLED } -public cmdTsay(id,level,cid){ +public cmdTsay(id,level,cid) { if (!cmd_access(id,level,cid,3)) 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) new bool:tsay = (tolower(cmd[4]) == 't') read_args(message,191) remove_quotes(message) - parse(message,color,11) + parse(message,color,15) new found = 0,a = 0 - for(new i=0;i6||g_msgChannel<3) g_msgChannel = 3 @@ -227,8 +237,9 @@ public cmdTsay(id,level,cid){ console_print(id,message[length]) #endif + 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^")", - name,userid,authid,cmd,message[length],g_Colors[a]) + name,userid,authid,cmd,message[length],color2) return PLUGIN_HANDLED } \ No newline at end of file diff --git a/plugins/admincmd.sma b/plugins/admincmd.sma index 1ca2bdb9..a2e798c2 100755 --- a/plugins/admincmd.sma +++ b/plugins/admincmd.sma @@ -45,6 +45,8 @@ new g_addCvar[] = "amx_cvar add %s" public plugin_init() { 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," [reason]") register_concmd("amx_ban","cmdBan",ADMIN_BAN," [reason]") register_concmd("amx_addban","cmdAddBan",ADMIN_BAN," [reason]") @@ -94,8 +96,8 @@ public cmdKick(id,level,cid) { log_amx("Kick: ^"%s<%d><%s><>^" kick ^"%s<%d><%s><>^" (reason ^"%s^")", name,get_user_userid(id),authid,name2,userid2,authid2,reason) switch (get_cvar_num("amx_show_activity")) { - case 2: client_print(0,print_chat,"ADMIN %s: kick %s",name,name2) - case 1: client_print(0,print_chat,"ADMIN: kick %s",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) } if ( is_user_bot(player) ) server_cmd("kick #%d",userid2) @@ -117,16 +119,16 @@ public cmdUnban(id,level,cid) { read_argv(1,arg,31) if (contain(arg,".")!=-1) { 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 { 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) switch (get_cvar_num("amx_show_activity")) { - case 2: client_print(0,print_chat,"ADMIN %s: unban %s",name,arg) - case 1: client_print(0,print_chat,"ADMIN: unban %s",arg) + case 2: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_UNBAN_2",name,arg) + case 1: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_UNBAN_1",arg) } get_user_authid(id,authid,31) log_amx("Cmd: ^"%s<%d><%s><>^" unban ^"%s^"", @@ -151,8 +153,8 @@ public cmdAddBan(id,level,cid) { } get_user_name(id,name,31) switch (get_cvar_num("amx_show_activity")) { - case 2: client_print(0,print_chat,"ADMIN %s: ban %s",name,arg) - case 1: client_print(0,print_chat,"ADMIN: ban %s",arg) + case 2: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_ADDBAN_2",name,arg) + case 1: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_ADDBAN_1",arg) } get_user_authid(id,authid,31) log_amx("Cmd: ^"%s<%d><%s><>^" ban ^"%s^" (minutes ^"%s^") (reason ^"%s^")", @@ -169,8 +171,7 @@ public cmdBan(id,level,cid) { strtolower(mode) read_argv(3,minutes,7) 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 get_concmd(cid,hcmd,31,hflag,hinfo,127,level) 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^")", name,get_user_userid(id),authid, name2,userid2,authid2,mode,minutes,reason) - new temp[64] - if (str_to_num(minutes)) - format(temp,63,"for %s min.",minutes) + new temp[64],banned[16],nNum = str_to_num(minutes) + if (nNum) + format(temp,63,"%L",player,"FOR_MIN",minutes) else - temp = "permanently" + format(temp,63,"%L",player,"PERM") + + format(banned,15,"%L",player,"BANNED") if ( equal(mode,"ip") ){ new address[32] get_user_ip(player,address,31,1) 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 - 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 { 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 - 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") - if (activity) { - new temp2[64] - if (activity == 1) - temp2 = "ADMIN:" - else - format(temp2,63,"ADMIN %s:",name) - client_print(0,print_chat,"%s ban %s %s",temp2,name2,temp) - } - - console_print(id,"[AMXX] Client ^"%s^" banned",name2) + if (activity!=0) { + new players[32],pnum,msg[256],len + get_players(players,pnum,"c") + for (new i=0;i<%s><>^" changelevel ^"%s^"", name,get_user_userid(id),authid, arg) message_begin(MSG_ALL, SVC_INTERMISSION) @@ -322,25 +336,25 @@ public cmdCvar(id,level,cid) { if ( g_cvarRconNum < MAXRCONCVARS ) copy( g_cvarRcon[ g_cvarRconNum++ ] , 31, arg2 ) 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 } if (!cvar_exists(arg)){ - console_print(id,"[AMXX] Unknown cvar: %s",arg) + console_print(id,"[AMXX] %L",id,"UNKNOWN_CVAR",arg) return PLUGIN_HANDLED } 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 } 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 } if (read_argc() < 3){ 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 } 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^")", name,get_user_userid(id),authid, arg,arg2) set_cvar_string(arg,arg2) - + new activity = get_cvar_num("amx_show_activity") - if (activity) { - new temp[64] - if (activity == 1) - temp = "ADMIN:" - else - format(temp,63,"ADMIN %s:",name) - if (equal(arg,"rcon_password") || equal(arg,"sv_password")) - copy(arg2,63,"*** PROTECTED ***") - client_print(0,print_chat,"%s set cvar %s to ^"%s^"",temp,arg,arg2) - } + if (activity!=0) { + new players[32],pnum,admin[64],cvar_val[64],len + get_players(players,pnum,"c") + for (new i=0;i<%s><>^" %s server", name,get_user_userid(id),authid, g_Paused ? "unpause" : "pause" ) - console_print(id,"[AMXX] Server proceed %s", g_Paused ? "unpausing" : "pausing") - - switch(get_cvar_num("amx_show_activity")) { - 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 pausing[16] + format(pausing,15,"%L",id,g_Paused ? "unpausing" : "pausing") + console_print(id,"[AMXX] %L", id, pausing) + + 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<%s><>^" server console (cmdline ^"%s^")", 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) return PLUGIN_HANDLED } @@ -526,20 +574,27 @@ public cmdWho(id,level,cid) { if (!cmd_access(id,level,cid,1)) 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) - console_print(id,"^nClients on server:^n # %-16.15s %-12s %-8s %-4.3s %-4.3s %s", - "nick","authid","userid","imm","res","access") + format(cl_on_server,63,"%L",id,"CLIENTS_ON_SERVER") + 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) { get_user_authid(players[a],authid,31) get_user_name(players[a],name,31) flags = get_user_flags(players[a]) get_flags(flags,sflags,31) 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", - (flags&ADMIN_RESERVATION)?"yes":"no",sflags) + get_user_userid(players[a]),(flags&ADMIN_IMMUNITY)?lYes:lNo, + (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_name(id,name,31) 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 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 [nr of cmds (only for server)] - displays this help") } @@ -64,7 +61,7 @@ public cmdHelp(id,level,cid) { if (start >= clcmdsnum) 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 end = start + lHelpAmount // HELPAMOUNT @@ -75,27 +72,27 @@ public cmdHelp(id,level,cid) { get_concmd(i,cmd,31,eflags,info,127,flags,id) 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) - console_print(id,"----- Use 'amx_help %d' for more -----",end+1) + console_print(id,"----- %L -----",id,"USE_MORE",end+1) else - console_print(id,"----- Use 'amx_help 1' for begin -----") + console_print(id,"----- %L -----",id,"USE_BEGIN") return PLUGIN_HANDLED } -public dispInfo(id){ - client_print(id,print_chat, g_typeHelp ) +public dispInfo(id) { + client_print(id,print_chat,"%L",id,"TYPE_HELP") new nextmap[32] get_cvar_string("amx_nextmap",nextmap,31) if (get_cvar_float("mp_timelimit")){ new timeleft = get_timeleft() 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) diff --git a/plugins/adminslots.sma b/plugins/adminslots.sma index ced80d41..b0b149a1 100755 --- a/plugins/adminslots.sma +++ b/plugins/adminslots.sma @@ -40,9 +40,9 @@ new g_cmdLoopback[16] -public plugin_init() -{ +public plugin_init() { register_plugin("Slots Reservation",AMXX_VERSION_STR,"AMXX Dev Team") + register_dictionary("adminslots.txt") register_cvar("amx_reservation","1") format( g_cmdLoopback, 15, "amxres%c%c%c%c" , @@ -51,16 +51,18 @@ public plugin_init() register_clcmd( g_cmdLoopback, "ackSignal" ) } -public ackSignal(id) - server_cmd("kick #%d ^"Dropped due to slot reservation^"", get_user_userid(id) ) +public ackSignal(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 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 setVisibleSlots( players , maxplayers, limit ) @@ -76,9 +78,9 @@ public client_authorized(id) #if defined HIDE_RESERVED_SLOTS public client_disconnect(id) { - new maxplayers = get_maxplayers( ) + new maxplayers = get_maxplayers() setVisibleSlots( get_playersnum(1) - 1 , maxplayers , - maxplayers - get_cvar_num( "amx_reservation" ) ) + maxplayers - get_cvar_num("amx_reservation") ) return PLUGIN_CONTINUE } diff --git a/plugins/adminvote.sma b/plugins/adminvote.sma index b81d8576..ed96a966 100755 --- a/plugins/adminvote.sma +++ b/plugins/adminvote.sma @@ -44,23 +44,20 @@ new g_coloredMenus new g_voteCaller new g_Execute[256] 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 Float:g_voteRatio public plugin_init() { 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_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("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_dictionary("adminvote.txt") + register_dictionary("common.txt") + 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("Kick "),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("The result: "),MENU_KEY_1|MENU_KEY_2,"actionResult") register_concmd("amx_votemap","cmdVoteMap",ADMIN_VOTE," [map] [map] [map]") register_concmd("amx_votekick","cmdVoteKickBan",ADMIN_VOTE,"") register_concmd("amx_voteban","cmdVoteKickBan",ADMIN_VOTE,"") @@ -69,7 +66,7 @@ public plugin_init() { g_coloredMenus = colored_menus() } -public cmdCancelVote(id,level,cid){ +public cmdCancelVote(id,level,cid) { if (!cmd_access(id,level,cid,0)) return PLUGIN_HANDLED if ( task_exists( 99889988 , 1 ) ) { @@ -77,40 +74,42 @@ public cmdCancelVote(id,level,cid){ get_user_authid(id,authid,31) get_user_name(id,name,31) log_amx("Vote: ^"%s<%d><%s><>^" cancel vote session", name,get_user_userid(id),authid) - switch(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) - case 1: client_print(0,print_chat,"%s: cancel vote", (get_user_flags(id) & ADMIN_USER) ? g_playerTag : g_adminTag) + new players[32],pnum,lTag[16],activity = get_cvar_num("amx_show_activity") + get_players(players,pnum,"c") + for (new i=0;i g_voteCount[best]) best = a } 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 iResult = g_voteCount[best] - if ( iResult < iRatio ){ - if (g_yesNoVote) - client_print(0,print_chat,"%s (yes ^"%d^") (no ^"%d^") (needed ^"%d^")",g_votingFailed, g_voteCount[0], g_voteCount[1] , iRatio ) - else - client_print(0,print_chat,"%s (got ^"%d^") (needed ^"%d^")",g_votingFailed,iResult , iRatio ) - log_amx("Vote: %s (got ^"%d^") (needed ^"%d^")",g_votingFailed,iResult , iRatio ) + new players[32],pnum,i + get_players(players,pnum,"c") + if ( iResult < iRatio ) { + new lVotingFailed[32] + for (i=0;i get_gametime()){ - console_print(id, g_alredyVoting ) + 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, g_notAllowed ) + console_print(id, "%L", id, "VOTING_NOT_ALLOW") return PLUGIN_HANDLED } new argc = read_argc() @@ -186,20 +201,22 @@ public cmdVoteMap(id,level,cid) { g_optionName[1][0] = 0 g_optionName[2][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) if (is_map_valid(g_optionName[g_validMaps])) g_validMaps++; } 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 } new menu_msg[256] new keys = 0 - if (g_validMaps > 1){ + if (g_validMaps > 1) { 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] for(new a = 0; a < g_validMaps; ++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") g_yesNoVote = 0 } - else{ - format(menu_msg,255,g_coloredMenus ? "\yChange map to %s?\w^n^n1. Yes^n2. No" - : "Change map to %s?^n^n1. Yes^n2. No",g_optionName[0]) + else { + new lChangeMap[32],lYes[16],lNo[16] + 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 g_yesNoVote = 1 } @@ -224,23 +247,32 @@ public cmdVoteMap(id,level,cid) { 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]) - - switch(get_cvar_num("amx_show_activity")) { - case 2: client_print(0,print_chat,"%s %s: vote map(s)",name, - (get_user_flags(id) & ADMIN_USER) ? g_playerTag : g_adminTag) - case 1: client_print(0,print_chat,"%s: vote map(s)", - (get_user_flags(id) & ADMIN_USER) ? g_playerTag : g_adminTag) + + 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 1)?"Choose map: ":"Change map to ") set_task(vote_time,"checkVotes" , 99889988 ) g_voteCaller = id - console_print(id, g_votingStarted ) + console_print(id, "%L", id, "VOTING_STARTED") g_voteCount = { 0,0, 0,0 } return PLUGIN_HANDLED } @@ -250,18 +282,18 @@ public cmdVote(id,level,cid) { return PLUGIN_HANDLED new Float:voting = get_cvar_float("amx_last_voting") if (voting > get_gametime()){ - console_print(id, g_alredyVoting ) + console_print(id, "%L", id, "ALREADY_VOTING") return PLUGIN_HANDLED } 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 } 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,"Voting for that has been forbidden") + console_print(id,"%L",id,"VOTING_FORBIDDEN") return PLUGIN_HANDLED } 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^")", name,get_user_userid(id),authid,quest,g_optionName[0],g_optionName[1]) - switch(get_cvar_num("amx_show_activity")) { - case 2: client_print(0,print_chat,"%s %s: vote custom", - (get_user_flags(id) & ADMIN_USER) ? g_playerTag : g_adminTag,name ) - case 1: client_print(0,print_chat,"%s: vote custom", - (get_user_flags(id) & ADMIN_USER) ? g_playerTag : g_adminTag) + 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 get_gametime()){ - console_print(id, g_alredyVoting ) + console_print(id, "%L", id, "ALREADY_VOTING") return PLUGIN_HANDLED } 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 } new cmd[32] @@ -317,18 +357,26 @@ public cmdVoteKickBan(id,level,cid) { read_argv(1,arg,31) new player = cmd_target(id,arg,1) if (!player) return PLUGIN_HANDLED - if (voteban && is_user_bot(player)) { + if (voteban && is_user_bot(player)) { new imname[32] 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 } 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) - format(menu_msg,255,g_coloredMenus ? "\y%s %s?\w^n^n1. Yes^n2. No" - : "%s %s?^n^n1. Yes^n2. No", voteban ? "Ban" : "Kick", arg) + 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) g_yesNoVote = 1 if (voteban) 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^")", name,get_user_userid(id),authid,voteban ? "ban" : "kick",arg) - switch(get_cvar_num("amx_show_activity")) { - case 2: client_print(0,print_chat,"%s %s: vote %s for %s", - (get_user_flags(id) & ADMIN_USER) ? g_playerTag : g_adminTag,name,voteban ? "ban" : "kick",arg ) - case 1: client_print(0,print_chat,"%s: vote %s for %s", - (get_user_flags(id) & ADMIN_USER) ? g_playerTag : g_adminTag,voteban ? "ban" : "kick",arg) + 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