diff --git a/plugins/plmenu.sma b/plugins/plmenu.sma index 5a65b0a0..fed9f418 100755 --- a/plugins/plmenu.sma +++ b/plugins/plmenu.sma @@ -53,35 +53,37 @@ new g_clcmdNum new g_coloredMenus -public plugin_init() -{ +public plugin_init() { register_plugin("Players Menu",AMXX_VERSION_STR,"AMXX Dev Team") + + register_dictionary("plmenu.txt") + register_dictionary("common.txt") + register_clcmd("amx_kickmenu","cmdKickMenu",ADMIN_KICK,"- displays kick menu") register_clcmd("amx_banmenu","cmdBanMenu",ADMIN_BAN,"- displays ban menu") - register_clcmd("amx_slapmenu","cmdSlapMenu",ADMIN_SLAY,"- displays slap/slay menu") - register_clcmd("amx_teammenu","cmdTeamMenu",ADMIN_LEVEL_A,"- displays team menu") - register_clcmd("amx_clcmdmenu","cmdClcmdMenu",ADMIN_LEVEL_A,"- displays client cmds menu") + register_clcmd("amx_slapmenu","cmdSlapMenu",ADMIN_SLAY,"- displays slap/slay menu") + register_clcmd("amx_teammenu","cmdTeamMenu",ADMIN_LEVEL_A,"- displays team menu") + register_clcmd("amx_clcmdmenu","cmdClcmdMenu",ADMIN_LEVEL_A,"- displays client cmds menu") register_menucmd(register_menuid("Ban Menu"),1023,"actionBanMenu") register_menucmd(register_menuid("Kick Menu"),1023,"actionKickMenu") register_menucmd(register_menuid("Slap/Slay Menu"),1023,"actionSlapMenu") register_menucmd(register_menuid("Team Menu"),1023,"actionTeamMenu") - register_menucmd(register_menuid("Client Cmds Menu"),1023,"actionClcmdMenu") + register_menucmd(register_menuid("Client Cmds Menu"),1023,"actionClcmdMenu") g_coloredMenus = colored_menus() - new clcmds_ini_file[64]; - get_configsdir(clcmds_ini_file, 63); - format(clcmds_ini_file, 63, "%s/clcmds.ini", clcmds_ini_file); + new clcmds_ini_file[64] + get_configsdir(clcmds_ini_file, 63) + format(clcmds_ini_file, 63, "%s/clcmds.ini", clcmds_ini_file) load_settings(clcmds_ini_file) } /* Ban menu */ -public actionBanMenu(id,key) -{ - switch(key){ - case 7:{ +public actionBanMenu(id,key) { + switch (key) { + case 7: { ++g_menuOption[id] g_menuOption[id] %= 3 @@ -93,9 +95,9 @@ public actionBanMenu(id,key) displayBanMenu(id,g_menuPosition[id]) } - case 8: displayBanMenu(id,++g_menuPosition[id]) - case 9: displayBanMenu(id,--g_menuPosition[id]) - default:{ + case 8: displayBanMenu(id,++g_menuPosition[id]) + case 9: displayBanMenu(id,--g_menuPosition[id]) + default: { new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key] new name[32], name2[32], authid[32],authid2[32] @@ -104,34 +106,32 @@ public actionBanMenu(id,key) get_user_authid(player,authid2,31) get_user_name(id,name,31) new userid2 = get_user_userid(player) - + log_amx("Ban: ^"%s<%d><%s><>^" ban and kick ^"%s<%d><%s><>^" (minutes ^"%d^")", name,get_user_userid(id),authid, name2,userid2,authid2, g_menuSettings[id] ) - - switch(get_cvar_num("amx_show_activity")) { - case 2: client_print(0,print_chat,"ADMIN %s: ban %s",name,name2) - case 1: client_print(0,print_chat,"ADMIN: ban %s",name2) + + switch (get_cvar_num("amx_show_activity")) { + case 2: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_BAN_2",name,name2) + case 1: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_BAN_1",name2) } - - if (equal("4294967295",authid2)){ /* lan */ + + if (equal("4294967295",authid2)) { /* lan */ new ipa[32] get_user_ip(player,ipa,31,1) server_cmd("addip %d %s;writeip",g_menuSettings[id],ipa) } else server_cmd("banid %d #%d kick;writeid",g_menuSettings[id],userid2) - + server_exec() - + displayBanMenu(id,g_menuPosition[id]) } } return PLUGIN_HANDLED } - -displayBanMenu(id,pos){ - +displayBanMenu(id,pos) { if (pos < 0) return get_players(g_menuPlayers[id],g_menuPlayersNum[id]) @@ -146,88 +146,81 @@ displayBanMenu(id,pos){ start = pos = g_menuPosition[id] = 0 new len = format(menuBody,511, g_coloredMenus ? - "\yBan Menu\R%d/%d^n\w^n" : "Ban Menu %d/%d^n^n", - pos+1,( g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )) ) - + "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", + id,"BAN_MENU",pos+1,( g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )) ) + new end = start + 7 new keys = MENU_KEY_0|MENU_KEY_8 - + if (end > g_menuPlayersNum[id]) end = g_menuPlayersNum[id] - for(new a = start; a < end; ++a) - { + for (new a = start; a < end; ++a) { i = g_menuPlayers[id][a] get_user_name(i,name,31) - if ( is_user_bot(i) || (get_user_flags(i)&ADMIN_IMMUNITY) ) - { + if ( is_user_bot(i) || access(i,ADMIN_IMMUNITY) ) { ++b if ( g_coloredMenus ) len += format(menuBody[len],511-len,"\d%d. %s^n\w",b,name) else len += format(menuBody[len],511-len,"#. %s^n",name) - } - else - { + else { keys |= (1<<%s><>^" slap with %d damage ^"%s<%d><%s><>^"", name,get_user_userid(id),authid, g_menuSettings[id], name2,get_user_userid(player),authid2 ) - switch(get_cvar_num("amx_show_activity")) { - case 2: client_print(0,print_chat,"ADMIN %s: slap %s with %d damage",name,name2,g_menuSettings[id]) - case 1: client_print(0,print_chat,"ADMIN: slap %s with %d damage",name2,g_menuSettings[id]) + switch (get_cvar_num("amx_show_activity")) { + case 2: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_SLAP_2",name,name2,g_menuSettings[id]) + case 1: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_SLAP_1",name2,g_menuSettings[id]) } } else { log_amx("Cmd: ^"%s<%d><%s><>^" slay ^"%s<%d><%s><>^"", name,get_user_userid(id),authid, name2,get_user_userid(player),authid2 ) switch(get_cvar_num("amx_show_activity")) { - case 2: client_print(0,print_chat,"ADMIN %s: slay %s",name,name2) - case 1: client_print(0,print_chat,"ADMIN: slay %s",name2) + case 2: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_SLAY_2",name,name2) + case 1: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_SLAY_1",name2) } } @@ -267,79 +260,74 @@ public actionSlapMenu(id,key) } -displaySlapMenu(id,pos){ - +displaySlapMenu(id,pos) { if (pos < 0) return - + get_players(g_menuPlayers[id],g_menuPlayersNum[id]) - + new menuBody[512] new b = 0 new i new name[32], team[4] new start = pos * 7 - + if (start >= g_menuPlayersNum[id]) start = pos = g_menuPosition[id] = 0 - + new len = format(menuBody,511, g_coloredMenus ? - "\ySlap/Slay Menu\R%d/%d^n\w^n" : "Slap/Slay Menu %d/%d^n^n" , - pos+1,( g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )) ) + "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", + id,"SLAP_SLAY_MENU",pos+1,( g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )) ) new end = start + 7 new keys = MENU_KEY_0|MENU_KEY_8 if (end > g_menuPlayersNum[id]) end = g_menuPlayersNum[id] - - for(new a = start; a < end; ++a) - { + + for (new a = start; a < end; ++a) { i = g_menuPlayers[id][a] get_user_name(i,name,31) get_user_team(i,team,3) - - if ( !is_user_alive(i) || (get_user_flags(i)&ADMIN_IMMUNITY) ) - { + + if ( !is_user_alive(i) || access(i,ADMIN_IMMUNITY) ) { ++b if ( g_coloredMenus ) len += format(menuBody[len],511-len,"\d%d. %s\R%s^n\w", b,name,team) else len += format(menuBody[len],511-len,"#. %s %s^n",name,team) - } else { keys |= (1<<%s><>^" kick ^"%s<%d><%s><>^"", name,get_user_userid(id),authid, name2,userid2,authid2 ) - - 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) + + switch (get_cvar_num("amx_show_activity")) { + case 2: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_KICK_2",name,name2) + case 1: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_KICK_1",name2) } - + server_cmd("kick #%d",userid2) server_exec() @@ -377,39 +365,35 @@ public actionKickMenu(id,key) return PLUGIN_HANDLED } - -displayKickMenu(id,pos){ - +displayKickMenu(id,pos) { if (pos < 0) return - + get_players(g_menuPlayers[id],g_menuPlayersNum[id]) - + new menuBody[512] new b = 0 new i new name[32] new start = pos * 8 - + if (start >= g_menuPlayersNum[id]) start = pos = g_menuPosition[id] = 0 - + new len = format(menuBody,511, g_coloredMenus ? - "\yKick Menu\R%d/%d^n\w^n" : "Kick Menu %d/%d^n^n", - pos+1,( g_menuPlayersNum[id] / 8 + ((g_menuPlayersNum[id] % 8) ? 1 : 0 )) ) - + "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", + id,"KICK_MENU",pos+1,( g_menuPlayersNum[id] / 8 + ((g_menuPlayersNum[id] % 8) ? 1 : 0 )) ) + new end = start + 8 new keys = MENU_KEY_0 - + if (end > g_menuPlayersNum[id]) end = g_menuPlayersNum[id] - - for(new a = start; a < end; ++a) - { + + for (new a = start; a < end; ++a) { i = g_menuPlayers[id][a] get_user_name(i,name,31) - if ( get_user_flags(i) & ADMIN_IMMUNITY ) - { + if ( access(i,ADMIN_IMMUNITY) ) { ++b if ( g_coloredMenus ) len += format(menuBody[len],511-len,"\d%d. %s^n\w",b,name) @@ -417,58 +401,54 @@ displayKickMenu(id,pos){ len += format(menuBody[len],511-len,"#. %s^n",name) } - else - { + else { keys |= (1<<%s><>^" transfer ^"%s<%d><%s><>^" (team ^"%s^")", name,get_user_userid(id),authid, name2,get_user_userid(player),authid2, g_menuOption[id] ? "TERRORIST" : "CT" ) - - switch(get_cvar_num("amx_show_activity")) { - case 2: client_print(0,print_chat,"ADMIN %s: transfer %s to %s",name,name2,g_menuOption[id] ? "TERRORIST" : "CT" ) - case 1: client_print(0,print_chat,"ADMIN: transfer %s to %s",name2,g_menuOption[id] ? "TERRORIST" : "CT" ) + + switch (get_cvar_num("amx_show_activity")) { + case 2: client_print(0,print_chat,"%L",id,"ADMIN_TRANSF_2",name,name2,g_menuOption[id] ? "TERRORIST" : "CT" ) + case 1: client_print(0,print_chat,"%L",id,"ADMIN_TRANSF_1",name2,g_menuOption[id] ? "TERRORIST" : "CT" ) } - + new limitt = get_cvar_num("mp_limitteams") set_cvar_num("mp_limitteams",0) user_kill(player,1) @@ -477,7 +457,7 @@ public actionTeamMenu(id,key) engclient_cmd(player, "menuselect", "5") client_cmd(player,"slot1") set_cvar_num("mp_limitteams",limitt) - + displayTeamMenu(id,g_menuPosition[id]) } } @@ -485,90 +465,83 @@ public actionTeamMenu(id,key) } -displayTeamMenu(id,pos){ - +displayTeamMenu(id,pos) { if (pos < 0) return - + get_players(g_menuPlayers[id],g_menuPlayersNum[id]) - + new menuBody[512] new b = 0 new i, iteam new name[32], team[4] new start = pos * 7 - + if (start >= g_menuPlayersNum[id]) start = pos = g_menuPosition[id] = 0 - + new len = format(menuBody,511, g_coloredMenus ? - "\yTeam Menu\R%d/%d^n\w^n" : "Team Menu %d/%d^n^n", - pos+1,( g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )) ) - + "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", + id,"TEAM_MENU",pos+1,( g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )) ) + new end = start + 7 new keys = MENU_KEY_0|MENU_KEY_8 - + if (end > g_menuPlayersNum[id]) end = g_menuPlayersNum[id] - - for(new a = start; a < end; ++a) - { + + for (new a = start; a < end; ++a) { i = g_menuPlayers[id][a] get_user_name(i,name,31) iteam = get_user_team(i,team,3) - - if ( (iteam == (g_menuOption[id] ? 1 : 2)) || (get_user_flags(i)&ADMIN_IMMUNITY) ) - { + + if ( (iteam == (g_menuOption[id] ? 1 : 2)) || access(i,ADMIN_IMMUNITY) ) { ++b if ( g_coloredMenus ) len += format(menuBody[len],511-len,"\d%d. %s\R%s^n\w",b,name,team) else len += format(menuBody[len],511-len,"#. %s %s^n",name,team) - } - else - { + else { keys |= (1<= g_menuPlayersNum[id]) start = pos = g_menuPosition[id] = 0 - + new len = format(menuBody,511, g_coloredMenus ? - "\yClient Cmds Menu\R%d/%d^n\w^n" : "Client Cmds Menu %d/%d^n^n", - pos+1,( g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )) ) - + "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", + id, "CL_CMD_MENU", pos+1,( g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )) ) + new end = start + 7 new keys = MENU_KEY_0|MENU_KEY_8 - + if (end > g_menuPlayersNum[id]) end = g_menuPlayersNum[id] - - for(new a = start; a < end; ++a) - { + + for (new a = start; a < end; ++a) { i = g_menuPlayers[id][a] get_user_name(i,name,31) - - if ( !g_menuSelectNum[id] || get_user_flags(i)&ADMIN_IMMUNITY ) - { + + if ( !g_menuSelectNum[id] || access(i,ADMIN_IMMUNITY) ) { ++b if ( g_coloredMenus ) len += format(menuBody[len],511-len,"\d%d. %s^n\w",b,name) else len += format(menuBody[len],511-len,"#. %s^n",name) - } - else - { + else { keys |= (1< 3 ) { while ( replace( g_clcmdCmd[ g_clcmdNum ] ,63,"\'","^"") ) { // do nothing } - + g_clcmdMisc[ g_clcmdNum ][1] = read_flags ( szFlags ) g_clcmdMisc[ g_clcmdNum ][0] = read_flags ( szAccess ) g_clcmdNum++ } } - + return 1 } \ No newline at end of file diff --git a/plugins/restmenu.sma b/plugins/restmenu.sma index 17ba0d00..73e4baaa 100755 --- a/plugins/restmenu.sma +++ b/plugins/restmenu.sma @@ -149,47 +149,47 @@ new g_WeaponNames[MAXMENUPOS][] = { } new g_MenuItem[MAXMENUPOS][] = { - "\yHandguns^n\w^n%d. %s\y\R%s^n\w", - "%d. %s\y\R%s^n\w", - "%d. %s\y\R%s^n\w", - "%d. %s\y\R%s^n\w", - "%d. %s\y\R%s^n\w", - "%d. %s\y\R%s^n\w^n", + "\yHandguns^n\w^n%d. %s\y\R%L^n\w", + "%d. %s\y\R%L^n\w", + "%d. %s\y\R%L^n\w", + "%d. %s\y\R%L^n\w", + "%d. %s\y\R%L^n\w", + "%d. %s\y\R%L^n\w^n", - "\yShotguns^n\w^n%d. %s\y\R%s^n\w", - "%d. %s\y\R%s^n\w^n", + "\yShotguns^n\w^n%d. %s\y\R%L^n\w", + "%d. %s\y\R%L^n\w^n", "\ySub-Machine Guns^n\w^n%d. %s\y\R%s^n\w", - "%d. %s\y\R%s^n\w", - "%d. %s\y\R%s^n\w", - "%d. %s\y\R%s^n\w", - "%d. %s\y\R%s^n\w^n", + "%d. %s\y\R%L^n\w", + "%d. %s\y\R%L^n\w", + "%d. %s\y\R%L^n\w", + "%d. %s\y\R%L^n\w^n", "\yAssault Rifles^n\w^n%d. %s\y\R%s^n\w", - "%d. %s\y\R%s^n\w", - "%d. %s\y\R%s^n\w", - "%d. %s\y\R%s^n\w", - "%d. %s\y\R%s^n\w", - "%d. %s\y\R%s^n\w^n", + "%d. %s\y\R%L^n\w", + "%d. %s\y\R%L^n\w", + "%d. %s\y\R%L^n\w", + "%d. %s\y\R%L^n\w", + "%d. %s\y\R%L^n\w^n", "\ySniper Rifles^n\w^n%d. %s\y\R%s^n\w", - "%d. %s\y\R%s^n\w", - "%d. %s\y\R%s^n\w", - "%d. %s\y\R%s^n\w^n", + "%d. %s\y\R%L^n\w", + "%d. %s\y\R%L^n\w", + "%d. %s\y\R%L^n\w^n", - "\yMachine Guns^n\w^n%d. %s\y\R%s^n\w^n", + "\yMachine Guns^n\w^n%d. %s\y\R%L^n\w^n", - "\yEquipment^n\w^n%d. %s\y\R%s^n\w", - "%d. %s\y\R%s^n\w", - "%d. %s\y\R%s^n\w", - "%d. %s\y\R%s^n\w", - "%d. %s\y\R%s^n\w", - "%d. %s\y\R%s^n\w", - "%d. %s\y\R%s^n\w", - "%d. %s\y\R%s^n\w^n", + "\yEquipment^n\w^n%d. %s\y\R%L^n\w", + "%d. %s\y\R%L^n\w", + "%d. %s\y\R%L^n\w", + "%d. %s\y\R%L^n\w", + "%d. %s\y\R%L^n\w", + "%d. %s\y\R%L^n\w", + "%d. %s\y\R%L^n\w", + "%d. %s\y\R%L^n\w^n", - "\yAmmunition^n\w^n%d. %s\y\R%s^n\w", - "%d. %s\y\R%s^n\w" + "\yAmmunition^n\w^n%d. %s\y\R%L^n\w", + "%d. %s\y\R%L^n\w" } new g_Aliases[MAXMENUPOS][] = { @@ -281,7 +281,7 @@ new g_Aliases2[MAXMENUPOS][] = { new g_Autobuy[33][AUTOBUYLENGTH + 1] //new g_Rebuy[33][AUTOBUYLENGTH + 1] -setWeapon( a , action ){ +setWeapon( a , action ) { new b, m = g_Keys[a][0] * 8 if (g_Keys[a][1] != -1) { b = m + g_Keys[a][1] @@ -298,7 +298,7 @@ setWeapon( a , action ){ g_blockPos[ b ] = action } - for(new i = 0; i < g_AliasBlockNum; ++i) + for (new i = 0; i < g_AliasBlockNum; ++i) if ( g_AliasBlock[ i ] == a ){ if ( !action || action == 2 ) { --g_AliasBlockNum @@ -311,58 +311,58 @@ setWeapon( a , action ){ g_AliasBlock[ g_AliasBlockNum++ ] = a } -findMenuId( name[] ){ +findMenuId( name[] ) { for(new i = 0; i < 7 ; ++i) if( equal( name , g_menusNames[i] ) ) return i return -1 } -findAliasId( name[] ){ +findAliasId( name[] ) { for(new i = 0; i < MAXMENUPOS ; ++i) if( equal( name , g_Aliases[i] ) ) return i return -1 } -switchCommand( id, action ){ +switchCommand( id, action ) { new c = read_argc() - if ( c < 3 ){ + if ( c < 3 ) { setc( g_blockPos, 112, action ) - console_print( id , "Equipment and weapons have been %srestricted" , action ? "" : "un" ) + console_print( id, "%L", id, action ? "EQ_WE_RES" : "EQ_WE_UNRES" ) g_Modified = true } else { new arg[32], a new bool:found = false - for(new b = 2; b < c; ++b){ + for (new b = 2; b < c; ++b) { read_argv(b,arg,31) - if ( (a = findMenuId( arg )) != -1 ){ + if ( (a = findMenuId( arg )) != -1 ) { c = g_menusSets[a][1] - for(new i = g_menusSets[a][0]; i < c; ++i) + for (new i = g_menusSets[a][0]; i < c; ++i) setWeapon( i , action ) - console_print( id , "%s %s been %srestricted" , g_MenuTitle[a], (a<5) ? "have" : "has" , action ? "" : "un" ) + console_print( id , "%s %L %L", g_MenuTitle[a], id, (a<5) ? "HAVE_BEEN" : "HAS_BEEN" , action ? "RESTRICTED" : "UNRESTRICTED" ) g_Modified = found = true } - else if ( (a = findAliasId( arg )) != -1 ){ + else if ( (a = findAliasId( arg )) != -1 ) { g_Modified = found = true setWeapon( a , action ) - console_print( id , "%s has been %srestricted" , g_WeaponNames[a], action ? "" : "un" ) + console_print( id , "%s %L %L", g_WeaponNames[a], id, "HAS_BEEN", id, action ? "RESTRICTED" : "UNRESTRICTED " ) } } if ( !found ) - console_print( id , "Couldn't find such equipment or weapon" ) + console_print( id , "%L", id, "NO_EQ_WE" ) } } positionBlocked( a ) { new m = g_Keys[a][0] * 8 new d = ( g_Keys[a][1]==-1) ? 0 : g_blockPos[ m + g_Keys[a][1] ] - d += ( g_Keys[a][2]==-1) ? 0 : g_blockPos[ m + g_Keys[a][2] + 56 ] + d += ( g_Keys[a][2]==-1) ? 0 : g_blockPos[ m + g_Keys[a][2] + 56 ] return d } -public cmdRest(id,level,cid){ +public cmdRest(id,level,cid) { if (!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED new cmd[8] @@ -378,140 +378,146 @@ public cmdRest(id,level,cid){ if (start >= MAXMENUPOS) start = MAXMENUPOS - 1 new end = start + 10 if (end > MAXMENUPOS) end = MAXMENUPOS - console_print(id, "^n----- Weapons Restriction: -----") - console_print(id, " %-32.31s %-10.9s %-9.8s","name","value","status") + new lName[16],lValue[16],lStatus[16],lOnOf[16] + format(lName,15,"%L",id,"NAME") + format(lValue,15,"%L",id,"VALUE") + format(lStatus,15,"%L",id,"STATUS") + format(lOnOff,15,"%L",id,positionBlocked(a) ? "ON" : "OFF") + console_print(id, "^n----- %L: -----", id, "WEAP_RES") + console_print(id, " %-32.31s %-10.9s %-9.8s",lName,lValue,lStatus) if ( start != -1 ) { - for(new a = start; a < end; ++a){ + for (new a = start; a < end; ++a) { console_print(id, "%3d: %-32.31s %-10.9s %-9.8s",a + 1, - g_WeaponNames[a], g_Aliases[a], positionBlocked(a) ? "ON" : "OFF") + g_WeaponNames[a], g_Aliases[a], lOnOff) } } - console_print(id,"----- Entries %i - %i of %i -----",start+1,end,MAXMENUPOS) + console_print(id,"----- %L -----",id,"ENTRIES_OF",start+1,end,MAXMENUPOS) if (end < MAXMENUPOS) - console_print(id,"----- Use 'amx_restrict list %i' for more -----",end+1) + console_print(id,"----- %L -----",id,"USE_MORE",end+1) else - console_print(id,"----- Use 'amx_restrict list 1' for begin -----") + console_print(id,"----- %L -----",id,"USE_BEGIN") } else if ( equali( "save" , cmd ) ) { if ( saveSettings( g_saveFile ) ){ - console_print( id , "Configuration has been saved (file ^"%s^")" , g_saveFile ) + console_print( id , "%L", id, "CONF_SAVED", g_saveFile ) g_Modified = false } - else console_print( id , "Couldn't save configuration (file ^"%s^")" , g_saveFile ) + else console_print( id, "%L", id, "COULDNT_SAVE", g_saveFile ) } else if ( equali( "load" , cmd ) ) { setc( g_blockPos, 112, 0 ) // Clear current settings new arg1[64] - if ( read_argv(2, arg1 , 63 ) ) - { + if ( read_argv(2, arg1 , 63 ) ) { new configsdir[32] get_configsdir(configsdir,31) format(arg1,63,"%s/%s",configsdir,arg1) } - if ( loadSettings( arg1 ) ){ - console_print( id , "Configuration has been loaded (file ^"%s^")" , arg1 ) + if ( loadSettings( arg1 ) ) { + console_print( id, "%L", id, "CONF_LOADED", arg1 ) g_Modified = true } - else console_print( id , "Couldn't load configuration (file ^"%s^")" , arg1 ) + else console_print( id, "%L", id, "COULDNT_LOAD", arg1 ) } else { - console_print(id,"Usage: amx_restrict [value]") - console_print(id,"Commands:") - console_print(id,"^ton - set restriction on whole equipment") - console_print(id,"^toff - remove restriction from whole equipment") - console_print(id,"^ton [...] - set specified restriction") - console_print(id,"^toff [...] - remove specified restriction") - console_print(id,"^tlist - display list of available equipment and weapons") - console_print(id,"^tsave - save restriction") - console_print(id,"^tload [file] - load restriction [from a file]") - console_print(id,"Available values to restrict are:^nammo, equip, pistol, shotgun, sub, rifle, machine") - console_print(id,"Type 'amx_restrict list' for more specified values") + console_print(id,"%L",id,"COM_USAGE") + console_print(id,"%L",id,"COM_COMMANDS") + console_print(id,"%L",id,"COM_ON") + console_print(id,"%L",id,"COM_OFF") + console_print(id,"%L",id,"COM_ON") + console_print(id,"%L",id,"COM_OFF") + console_print(id,"%L",id,"COM_LIST") + console_print(id,"%L",id,"COM_SAVE") + console_print(id,"%L",id,"COM_LOAD") + console_print(id,"%L",id,"COM_VALUES") + console_print(id,"%L",id,"COM_TYPE") } return PLUGIN_HANDLED } -displayMenu(id,pos){ - if (pos < 0) return - new menubody[512], start = pos * 7 - if (start >= MAXMENUPOS) start = pos = g_Position[id] = 0 - new len = format(menubody,511,"\yRestrict Weapons\R%d/5^n\w^n",pos+1) - new end = start + 7, keys = MENU_KEY_0|MENU_KEY_8, k = 0 - if (end > MAXMENUPOS) end = MAXMENUPOS - for(new a = start; a < end; ++a){ - keys |= (1<= MAXMENUPOS) start = pos = g_Position[id] = 0 + new len = format(menubody,511,"\y%L\R%d/5^n\w^n",id,"REST_WEAP",pos+1) + new end = start + 7, keys = MENU_KEY_0|MENU_KEY_8, k = 0 + if (end > MAXMENUPOS) end = MAXMENUPOS + for (new a = start; a < end; ++a) { + keys |= (1< 11 ) /* Longest buy command has 11 chars so if command is longer then don't care */ - return PLUGIN_CONTINUE + if ( read_argv( 0, arg , 12 ) > 11 ) /* Longest buy command has 11 chars so if command is longer then don't care */ + return PLUGIN_CONTINUE - new a = 0 + new a = 0 - do { - if ( equal( g_Aliases[g_AliasBlock[ a ]] , arg ) || - equal( g_Aliases2[g_AliasBlock[ a ]] , arg ) ) { - client_print(id,print_center,g_Restricted ) - return PLUGIN_HANDLED - } - } while( ++a < g_AliasBlockNum ) - } - return PLUGIN_CONTINUE + do { + if ( equal( g_Aliases[g_AliasBlock[ a ]] , arg ) || + equal( g_Aliases2[g_AliasBlock[ a ]] , arg ) ) + { + client_print(id,print_center,g_Restricted ) + return PLUGIN_HANDLED + } + } while( ++a < g_AliasBlockNum ) + } + return PLUGIN_CONTINUE } // JGHG: Send weapon string to this function and it returns true if weapon is blocked or false if not blocked... -stock WeaponIsBlocked(weapon[]) { - for (new a = 0; a < g_AliasBlockNum; a++) { - server_print("%d", a) - server_print(weapon) - server_print(g_Aliases[g_AliasBlock[ a ]]) - server_print(g_Aliases2[g_AliasBlock[ a ]]) +WeaponIsBlocked(weapon[]) { + for (new a = 0; a < g_AliasBlockNum; a++) { + server_print("%d", a) + server_print(weapon) + server_print(g_Aliases[g_AliasBlock[ a ]]) + server_print(g_Aliases2[g_AliasBlock[ a ]]) - if ( equal( g_Aliases[g_AliasBlock[ a ]] , weapon ) || - equal( g_Aliases2[g_AliasBlock[ a ]] , weapon ) ) { - return true // blocked - } - } + if ( equal( g_Aliases[g_AliasBlock[ a ]] , weapon ) || + equal( g_Aliases2[g_AliasBlock[ a ]] , weapon ) ) + { + return true // blocked + } + } - return false // not blocked + return false // not blocked } public blockcommand(id) { - client_print(id,print_center, g_Restricted ) - return PLUGIN_HANDLED + client_print(id,print_center, g_Restricted ) + return PLUGIN_HANDLED } public cmdMenu(id,level,cid){ @@ -540,13 +546,13 @@ public menuRifle(id,key) return checkRest(id,4,key) public menuMachine(id,key) return checkRest(id,5,key) public menuItem(id,key) return checkRest(id,6,key) -saveSettings(filename[]){ +saveSettings(filename[]) { if (file_exists(filename)) delete_file(filename) if (!write_file(filename,"; Generated by Restrict Weapons Plugin. Do not modify!^n; value name")) return 0 new text[64] - for(new a = 0; a < MAXMENUPOS; ++a){ + for(new a = 0; a < MAXMENUPOS; ++a) { if ( positionBlocked( a ) ) { format(text,63,"%-16.15s ; %s", g_Aliases[a] , g_WeaponNames[a]) write_file(filename,text) @@ -559,7 +565,7 @@ loadSettings(filename[]){ if (!file_exists(filename)) return 0 new text[16] new a, pos = 0 - while (read_file(filename,pos++,text,15, a )){ + while (read_file(filename,pos++,text,15, a )) { if ( text[0] == ';' || !a ) continue // line is a comment parse( text, text , 15 ) if ( (a = findAliasId( text )) != -1 ) @@ -570,125 +576,126 @@ loadSettings(filename[]){ // JGHG public fn_setautobuy(id) { - // Don't do anything if no items are blocked. - if (!g_AliasBlockNum) - return PLUGIN_CONTINUE + // Don't do anything if no items are blocked. + if (!g_AliasBlockNum) + return PLUGIN_CONTINUE - // Empty user's autobuy prefs. (unnecessary?) - g_Autobuy[id][0] = '^0' + // Empty user's autobuy prefs. (unnecessary?) + g_Autobuy[id][0] = '^0' - new argCount = read_argc() + new argCount = read_argc() - new arg[128] - new autobuyLen = 0 - for (new i = 1; i < argCount; i++) { // Start at parameter 1; parameter 0 is just "cl_setautobuy" - read_argv(i, arg, 127) + new arg[128] + new autobuyLen = 0 + for (new i = 1; i < argCount; i++) { // Start at parameter 1; parameter 0 is just "cl_setautobuy" + read_argv(i, arg, 127) - // Add this parameter to user's autobuy prefs - autobuyLen += format(g_Autobuy[id][autobuyLen], AUTOBUYLENGTH - autobuyLen, "%s", arg) - // If we detect more parameters, add a space - if (i + 1 < argCount) - autobuyLen += format(g_Autobuy[id][autobuyLen], AUTOBUYLENGTH - autobuyLen, " ") - } + // Add this parameter to user's autobuy prefs + autobuyLen += format(g_Autobuy[id][autobuyLen], AUTOBUYLENGTH - autobuyLen, "%s", arg) + // If we detect more parameters, add a space + if (i + 1 < argCount) + autobuyLen += format(g_Autobuy[id][autobuyLen], AUTOBUYLENGTH - autobuyLen, " ") + } - // Strip any blocked items - new strippedItems[AUTOBUYLENGTH + 1] - if (!StripBlockedItems(g_Autobuy[id], strippedItems)) - return PLUGIN_CONTINUE // don't touch anything if we didn't strip anything... + // Strip any blocked items + new strippedItems[AUTOBUYLENGTH + 1] + if (!StripBlockedItems(g_Autobuy[id], strippedItems)) + return PLUGIN_CONTINUE // don't touch anything if we didn't strip anything... - //server_print("Stripped items: ^"%s^"", strippedItems) - engclient_cmd(id, "cl_setautobuy", strippedItems) - return PLUGIN_HANDLED + //server_print("Stripped items: ^"%s^"", strippedItems) + engclient_cmd(id, "cl_setautobuy", strippedItems) + return PLUGIN_HANDLED - /* - // Check g_Autobuy[id] for blocked items. - if (g_AliasBlockNum > 0) { - new blockedItem[AUTOBUYLENGTH + 1] - if (CheckBlockedItems(g_Autobuy[id], blockedItem)) { - client_print(id, print_center, "%c%s is blocked!", blockedItem[0] < 'a' || blockedItem[0] > 'z' ? blockedItem[0] : blockedItem[0] - 32, blockedItem[1]) // Tell what item is blocked (if first char is a letter it will be capital) - return PLUGIN_HANDLED - } - } - */ + /* + // Check g_Autobuy[id] for blocked items. + if (g_AliasBlockNum > 0) { + new blockedItem[AUTOBUYLENGTH + 1] + if (CheckBlockedItems(g_Autobuy[id], blockedItem)) { + client_print(id, print_center, "%c%s is blocked!", blockedItem[0] < 'a' || blockedItem[0] > 'z' ? blockedItem[0] : blockedItem[0] - 32, blockedItem[1]) // Tell what item is blocked (if first char is a letter it will be capital) + return PLUGIN_HANDLED + } + } + */ - //return PLUGIN_CONTINUE + //return PLUGIN_CONTINUE } // Returns true if this strips any items, else false. StripBlockedItems(inString[AUTOBUYLENGTH + 1], outString[AUTOBUYLENGTH + 1]) { - // First copy string - format(outString, AUTOBUYLENGTH, inString) + // First copy string + format(outString, AUTOBUYLENGTH, inString) - // Then strip those that are blocked. - for (new i = 0; i < g_AliasBlockNum; i++) { - while (contain(outString, g_Aliases[g_AliasBlock[i]]) != -1) - replace(outString, AUTOBUYLENGTH, g_Aliases[g_AliasBlock[i]], "") - while (contain(outString, g_Aliases2[g_AliasBlock[i]]) != -1) - replace(outString, AUTOBUYLENGTH, g_Aliases2[g_AliasBlock[i]], "") - } + // Then strip those that are blocked. + for (new i = 0; i < g_AliasBlockNum; i++) { + while (contain(outString, g_Aliases[g_AliasBlock[i]]) != -1) + replace(outString, AUTOBUYLENGTH, g_Aliases[g_AliasBlock[i]], "") + while (contain(outString, g_Aliases2[g_AliasBlock[i]]) != -1) + replace(outString, AUTOBUYLENGTH, g_Aliases2[g_AliasBlock[i]], "") + } - // We COULD trim white space from outString here, but I don't think it really is necessary currently... + // We COULD trim white space from outString here, but I don't think it really is necessary currently... - if (strlen(outString) < strlen(inString)) - return true // outstring is shorter: we stripped items, return true + if (strlen(outString) < strlen(inString)) + return true // outstring is shorter: we stripped items, return true - return false // else end here, return false, no items were stripped + return false // else end here, return false, no items were stripped } // Returns true if any of the items in items[] are blocked, else false. -stock CheckBlockedItems(items[], blockedItem[AUTOBUYLENGTH + 1]) { - if (g_AliasBlockNum <= 0) - return false +CheckBlockedItems(items[], blockedItem[AUTOBUYLENGTH + 1]) { + if (g_AliasBlockNum <= 0) + return false - new l_items[AUTOBUYLENGTH + 1] - format(l_items, AUTOBUYLENGTH, items) + new l_items[AUTOBUYLENGTH + 1] + format(l_items, AUTOBUYLENGTH, items) - new aValueWasParsed, parsedItem[128] - do { - aValueWasParsed = parse(l_items, parsedItem, 127) - if (strlen(parsedItem) == 0) - return false // no more items + new aValueWasParsed, parsedItem[128] + do { + aValueWasParsed = parse(l_items, parsedItem, 127) + if (strlen(parsedItem) == 0) + return false // no more items - if (aValueWasParsed) { - replace(l_items, AUTOBUYLENGTH, parsedItem, "") // Remove first parameter + if (aValueWasParsed) { + replace(l_items, AUTOBUYLENGTH, parsedItem, "") // Remove first parameter - if (WeaponIsBlocked(parsedItem)) { - format(blockedItem, AUTOBUYLENGTH, parsedItem) - return true // item is blocked, return true - } - } - else - break - } - while (aValueWasParsed) + if (WeaponIsBlocked(parsedItem)) { + format(blockedItem, AUTOBUYLENGTH, parsedItem) + return true // item is blocked, return true + } + } + else + break + } while (aValueWasParsed) - return false // no blocked items found + return false // no blocked items found } public fn_autobuy(id) { - // Don't do anything if no items are blocked. - if (!g_AliasBlockNum) - return PLUGIN_CONTINUE + // Don't do anything if no items are blocked. + if (!g_AliasBlockNum) + return PLUGIN_CONTINUE - // Strip any blocked items - new strippedItems[AUTOBUYLENGTH + 1] - if (!StripBlockedItems(g_Autobuy[id], strippedItems)) - return PLUGIN_CONTINUE // don't touch anything if we didn't strip anything... + // Strip any blocked items + new strippedItems[AUTOBUYLENGTH + 1] + if (!StripBlockedItems(g_Autobuy[id], strippedItems)) + return PLUGIN_CONTINUE // don't touch anything if we didn't strip anything... - //server_print("Stripped items: ^"%s^"", strippedItems) - engclient_cmd(id, "cl_setautobuy", strippedItems) - return PLUGIN_HANDLED + //server_print("Stripped items: ^"%s^"", strippedItems) + engclient_cmd(id, "cl_setautobuy", strippedItems) + return PLUGIN_HANDLED } public plugin_init() { register_plugin("Restrict Weapons",AMXX_VERSION_STR,"AMXX Dev Team") + register_dictionary("restmenu.txt") + register_dictionary("common.txt") register_clcmd("buyammo1","ammoRest1") register_clcmd("buyammo2","ammoRest2") register_clcmd("cl_setautobuy", "fn_setautobuy") register_clcmd("cl_autobuy", "fn_autobuy") register_clcmd("amx_restmenu","cmdMenu",ADMIN_CFG,"- displays weapons restriction menu") register_menucmd(register_menuid("#Buy", 1 ),511,"menuBuy") - register_menucmd(register_menuid("\yRestrict Weapons"),1023,"actionMenu") + register_menucmd(register_menuid("Restrict Weapons"),1023,"actionMenu") register_menucmd(register_menuid("BuyPistol", 1 ),511,"menuPistol") register_menucmd(register_menuid("BuyShotgun", 1 ),511,"menuShotgun") register_menucmd(register_menuid("BuySub", 1 ),511,"menuSub") diff --git a/plugins/scrollmsg.sma b/plugins/scrollmsg.sma index 11c799df..aae26b8e 100755 --- a/plugins/scrollmsg.sma +++ b/plugins/scrollmsg.sma @@ -45,35 +45,35 @@ new Float:g_xPos new g_Length new g_Frequency -public plugin_init(){ +public plugin_init() { register_plugin("Scrolling Message",AMXX_VERSION_STR,"AMXX Dev Team") + register_dictionary("scrollmsg.txt") register_srvcmd("amx_scrollmsg","setMessage") } -public showMsg(){ +public showMsg() { new a = g_startPos, i = 0 - + while( a < g_endPos ) g_displayMsg[i++] = g_scrollMsg[a++] - + g_displayMsg[i] = 0 - + if (g_endPos < g_Length) g_endPos++ - + if (g_xPos > 0.35) g_xPos -= 0.0063 - else - { + else { g_startPos++ g_xPos = 0.35 } - + set_hudmessage(200, 100, 0, g_xPos, 0.90, 0, SPEED, SPEED, 0.05, 0.05, 2) show_hudmessage(0,g_displayMsg) } -public msgInit(){ +public msgInit() { g_endPos = 1 g_startPos = 0 g_xPos = 0.65 @@ -81,9 +81,7 @@ public msgInit(){ client_print(0,print_console,g_scrollMsg) } -public setMessage(id,level,cid) { - if (!cmd_access(id,level,cid,3)) - return PLUGIN_HANDLED +public setMessage() { remove_task(123) /* remove current messaging */ read_argv(1,g_scrollMsg,380) new hostname[64] @@ -96,14 +94,14 @@ public setMessage(id,level,cid) { if (g_Frequency > 0) { new minimal = floatround((g_Length + 48) * (SPEED + 0.1)) if (g_Frequency < minimal) { - console_print(id,"Minimal frequency for this message is %d seconds",minimal) + server_print("%L",LANG_SERVER,"MIN_FREQ",minimal) g_Frequency = minimal } - console_print(id,"Scrolling message displaying frequency: %d:%02d minutes", + server_print("%L",LANG_SERVER,"MSG_FREQ") g_Frequency/60,g_Frequency%60) set_task(float(g_Frequency),"msgInit",123,"",0,"b") } else - console_print(id,"Scrolling message disabled") + server_print("%L",LANG_SERVER,"MSG_DISABLED") return PLUGIN_HANDLED } \ No newline at end of file diff --git a/plugins/statscfg.sma b/plugins/statscfg.sma index df566db5..8c4c5e11 100755 --- a/plugins/statscfg.sma +++ b/plugins/statscfg.sma @@ -45,8 +45,10 @@ new g_menuPosition[33] new g_fileToSave[64] new bool:g_modified -public plugin_precache(){ +public plugin_precache() { register_clcmd("amx_statscfgmenu","cmdCfgMenu",ADMIN_CFG,"- displays stats configuration menu") + register_dictionary("statscfg.txt") + register_dictionary("common.txt") register_concmd("amx_statscfg","cmdCfg",ADMIN_CFG,"- displays help for stats configuration") } @@ -58,10 +60,10 @@ public plugin_init() { loadSettings(g_fileToSave) } -public cmdCfg( id,level,cid ){ +public cmdCfg( id,level,cid ) { if (!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED - + new cmds[32] read_argv(1,cmds,31) new option = equali(cmds, "on" ) ? 1 : 0 @@ -69,7 +71,7 @@ public cmdCfg( id,level,cid ){ if ( read_argc() > 2 && option ) { new var[32], enabled = 0 read_argv( 2 , var , 31 ) - for( new a = 0; a < g_menuDataNum; ++a ) { + for ( new a = 0; a < g_menuDataNum; ++a ) { if ( containi( g_menuDataVar[ a ] , var ) != -1 ) { g_modified = true ++enabled @@ -84,25 +86,25 @@ public cmdCfg( id,level,cid ){ } } if ( enabled ) - console_print(id,"Total %d", enabled ) + console_print(id,"%L", id, "TOTAL_NUM", enabled ) else - console_print(id,"Couldn't find option(s) with such variable (name ^"%s^")", var ) + console_print(id,"%L",id,"NO_OPTION",var ) } else if ( equali(cmds, "save" ) ) { if ( saveSettings( g_fileToSave ) ){ g_modified = false - console_print(id,"Stats configuration saved successfully") + console_print(id,"%L",id,"CONF_SAVED") } else - console_print(id,"Failed to save stats configuration!!!") + console_print(id,"%L",id,"CONF_FAILED") } else if ( equali(cmds, "load" ) ) { if ( loadSettings( g_fileToSave ) ){ g_modified = false - console_print(id,"Stats configuration loaded successfully") + console_print(id,"%L",id,"CONF_LOADED") } else - console_print(id,"Failed to load stats configuration!!!") + console_print(id,"%L",id,"CONF_FAIL_LOAD") } else if ( equali(cmds, "list" ) ) { new arg1[8] @@ -111,87 +113,94 @@ public cmdCfg( id,level,cid ){ if (start >= g_menuDataNum) start = g_menuDataNum - 1 new end = start + 10 if (end > g_menuDataNum) end = g_menuDataNum - console_print(id, "^n----- Stats Configuration: -----") - console_print(id, " %-29.28s %-24.23s %-9.8s","name","variable","status") + + new lName[16],lVariable[16],lStatus[16] + format(lName,15,"%L",id,"NAME") + format(lVariable,15,"%L",id,"VARIABLE") + format(lStatus,15,"%L",id,"STATUS") + console_print(id, "^n----- %L: -----",id,"STATS_CONF") + console_print(id, " %-29.28s %-24.23s %-9.8s",lName,lVariable,lStatus) if ( start != -1 ) { - for(new a = start; a < end; ++a){ + new lOnOff[16] + for (new a = start; a < end; ++a) { + format(lOnOff,15,"%L",id,get_xvar_num( g_menuDataId[ a ] ) ? "ON" : "OFF") console_print(id, "%3d: %-29.28s %-24.23s %-9.8s",a + 1, - g_menuData[a], g_menuDataVar[a], get_xvar_num( g_menuDataId[ a ] ) ? "ON" : "OFF") + g_menuData[a], g_menuDataVar[a], lOnOff) } } - console_print(id,"----- Entries %i - %i of %i -----",start+1,end,g_menuDataNum) + console_print(id,"----- %L -----",id,"ENTRIES_OF",start+1,end,g_menuDataNum) if (end < g_menuDataNum) - console_print(id,"----- Use 'amx_statscfg list %i' for more -----",end+1) + console_print(id,"----- %L -----",id,"USE_MORE",end+1) else - console_print(id,"----- Use 'amx_statscfg list 1' for begin -----") + console_print(id,"----- %L -----",id,"USE_BEGIN") } else if ( equali(cmds, "add" ) && read_argc() > 3 ) { - if ( g_menuDataNum < MAX_MENU_DATA ) { - read_argv(2, g_menuData[g_menuDataNum] , 31 ) - read_argv(3, g_menuDataVar[g_menuDataNum] , 31 ) - g_menuDataId[g_menuDataNum] = get_xvar_id( g_menuDataVar[g_menuDataNum] ) - ++g_menuDataNum - } - else console_print(id, "Can't add stats to the list, limit reached!") + if ( g_menuDataNum < MAX_MENU_DATA ) { + read_argv(2, g_menuData[g_menuDataNum] , 31 ) + read_argv(3, g_menuDataVar[g_menuDataNum] , 31 ) + g_menuDataId[g_menuDataNum] = get_xvar_id( g_menuDataVar[g_menuDataNum] ) + ++g_menuDataNum + } + else console_print(id, "%L",id,"CANT_ADD") } else { - console_print(id,"Usage: amx_statscfg [parameters] ...") - console_print(id,"Commands:") - console_print(id,"^ton - enable specified option") - console_print(id,"^toff - disable specified option") - console_print(id,"^tsave - save stats configuration") - console_print(id,"^tload - load stats configuration") - console_print(id,"^tlist [id] - list stats status") - console_print(id,"^tadd - add stats to the list") + console_print(id,"%L",id,"COM_USAGE") + console_print(id,"%L",id,"COM_COM") + console_print(id,"%L",id,"COM_ON") + console_print(id,"%L",id,"COM_OFF") + console_print(id,"%L",id,"COM_SAVE") + console_print(id,"%L",id,"COM_LOAD") + console_print(id,"%L",id,"COM_LIST") + console_print(id,"%L",id,"COM_ADD") } - + return PLUGIN_HANDLED } -public cmdCfgMenu(id,level,cid){ +public cmdCfgMenu(id,level,cid) { if (cmd_access(id,level,cid,1)) displayCfgMenu(id,g_menuPosition[id] = 0) return PLUGIN_HANDLED } -displayCfgMenu(id,pos){ +displayCfgMenu(id,pos) { if (pos < 0) return new menu_body[512], start = pos * 7 if (start >= g_menuDataNum) start = pos = g_menuPosition[id] = 0 - new len = format(menu_body,511,"\yStats Configuration\R%d/%d^n\w^n", - pos + 1,((g_menuDataNum/7)+((g_menuDataNum%7)?1:0))) + new len = format(menu_body,511,"\y%L\R%d/%d^n\w^n", + id,"STATS_CONF",pos + 1,((g_menuDataNum/7)+((g_menuDataNum%7)?1:0))) new end = start + 7, keys = MENU_KEY_0|MENU_KEY_8, k = 0 if (end > g_menuDataNum) end = g_menuDataNum - for(new a = start; a < end; ++a){ + for (new a = start; a < end; ++a) { keys |= (1<<%s><>^" teleport ^"%s<%d><%s><>^"", name,get_user_userid(id),authid, name2,get_user_userid(player),authid2 ) - switch(get_cvar_num("amx_show_activity")) { - case 2: client_print(0,print_chat,"ADMIN %s: teleport %s",name,name2) - case 1: client_print(0,print_chat,"ADMIN: teleport %s",name2) + switch (get_cvar_num("amx_show_activity")) { + case 2: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_TELEPORT_2",name,name2) + case 1: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_TELEPORT_1",name2) } displayTelMenu(id,g_menuPosition[id]) @@ -123,8 +125,8 @@ displayTelMenu(id,pos) { start = pos = g_menuPosition[id] = 0 new len = format(menuBody,511, g_coloredMenus ? - "\yTeleport Menu\R%d/%d^n\w^n" : "Teleport Menu %d/%d^n^n" , - pos+1,( g_menuPlayersNum[id] / 6 + ((g_menuPlayersNum[id] % 6) ? 1 : 0 )) ) + "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n" , + id, "TELE_MENU", pos+1,( g_menuPlayersNum[id] / 6 + ((g_menuPlayersNum[id] % 6) ? 1 : 0 )) ) new end = start + 6 new keys = MENU_KEY_0|MENU_KEY_8 @@ -156,30 +158,30 @@ displayTelMenu(id,pos) { } else if ( g_menuOption[id] ) { // -1 if ( g_coloredMenus ) - len += format(menuBody[len],511-len,"^n\d7. Current Location^n\w") + len += format(menuBody[len],511-len,"^n\d7. %L^n\w",id,"CUR_LOC") else - len += format(menuBody[len],511-len,"^n#. Current Location^n") + len += format(menuBody[len],511-len,"^n#. %L^n",id,"CUR_LOC") } else { // 0 keys |= MENU_KEY_7 - len += format(menuBody[len],511-len,"^n7. Current Location^n") + len += format(menuBody[len],511-len,"^n7. %L^n",id,"CUR_LOC") } - len += format(menuBody[len],511-len,"8. Save Location^n") + len += format(menuBody[len],511-len,"8. %L^n",id,"SAVE_LOC") if (end != g_menuPlayersNum[id]) { - format(menuBody[len],511-len,"^n9. More...^n0. %s", pos ? "Back" : "Exit") + format(menuBody[len],511-len,"^n9. %L...^n0. %s", id, "MORE", id, pos ? "BACK" : "EXIT") keys |= MENU_KEY_9 } else - format(menuBody[len],511-len,"^n0. %s", pos ? "Back" : "Exit") + format(menuBody[len],511-len,"^n0. %L", id, pos ? "BACK" : "EXIT") - show_menu(id,keys,menuBody) + show_menu(id,keys,menuBody,-1,"Teleport Menu") } public cmdTelMenu(id,level,cid) { if (cmd_access(id,level,cid,1)) displayTelMenu(id,g_menuPosition[id] = 0) - + return PLUGIN_HANDLED } \ No newline at end of file diff --git a/plugins/timeleft.sma b/plugins/timeleft.sma index 28be587b..ca9a0d00 100755 --- a/plugins/timeleft.sma +++ b/plugins/timeleft.sma @@ -41,6 +41,7 @@ new g_Switch public plugin_init() { register_plugin("TimeLeft",AMXX_VERSION_STR,"AMXX Dev Team") + register_dictionary("timeleft.txt") register_cvar("amx_time_voice","1") register_srvcmd("amx_time_display","setDisplaying") register_cvar("amx_timeleft","00:00",FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY) @@ -50,7 +51,7 @@ public plugin_init() { } public sayTheTime(id){ - if ( get_cvar_num("amx_time_voice") ){ + if ( get_cvar_num("amx_time_voice") ) { new mhours[6], mmins[6], whours[32], wmins[32], wpm[6] get_time("%H",mhours,5) get_time("%M",mmins,5) @@ -74,11 +75,11 @@ public sayTheTime(id){ } new ctime[64] get_time("%m/%d/%Y - %H:%M:%S",ctime,63) - client_print(0,print_chat, "The time: %s",ctime ) + client_print(0,print_chat, "%L: %s",LANG_PLAYER,"THE_TIME",ctime ) return PLUGIN_CONTINUE } -public sayTimeLeft(id){ +public sayTimeLeft(id) { if (get_cvar_float("mp_timelimit")) { new a = get_timeleft() if ( get_cvar_num("amx_time_voice") ) { @@ -86,35 +87,35 @@ public sayTimeLeft(id){ setTimeVoice( svoice , 127 , 0 , a ) client_cmd( id , svoice ) } - client_print(0,print_chat, "Time Left: %d:%02d", (a / 60) , (a % 60) ) + client_print(0,print_chat, "%L: %d:%02d", LANG_PLAYER, "TIME_LEFT", (a / 60) , (a % 60) ) } else - client_print(0,print_chat, "No Time Limit" ) + client_print(0,print_chat, "%L",LANG_PLAYER,"NO_T_LIMIT" ) return PLUGIN_CONTINUE } -setTimeText(text[],len,tmlf){ +setTimeText(text[],len,tmlf,id) { new secs = tmlf % 60 new mins = tmlf / 60 if (secs == 0) - format(text,len,"%d minute%s", mins , (mins > 1) ? "s" : "" ) + format(text,len,"%d %L", mins, id, (mins > 1) ? "MINUTES" : "MINUTE" ) else if (mins == 0) - format(text,len,"%d second%s", secs,(secs > 1) ? "s" : "" ) + format(text,len,"%d %L", secs, id, (secs > 1) ? "SECONDS" : "SECOND" ) else - format(text,len,"%d minute%s %d second%s", mins , (mins > 1) ? "s" : "" ,secs ,(secs > 1) ? "s" : "" ) + format(text,len,"%d %L %d %L", mins, id, (mins > 1) ? "MINUTES" : "MINUTE", secs, id, (secs > 1) ? "SECONDS" : "SECOND" ) } -setTimeVoice(text[],len,flags,tmlf){ +setTimeVoice(text[],len,flags,tmlf) { new temp[7][32] new secs = tmlf % 60 new mins = tmlf / 60 - for(new a = 0;a < 7;++a) + for (new a = 0;a < 7;++a) temp[a][0] = 0 if (secs > 0){ num_to_word(secs,temp[4],31) if (!(flags & 8)) temp[5] = "seconds " /* there is no "second" in default hl */ } - if (mins > 59){ + if (mins > 59) { new hours = mins / 60 num_to_word(hours,temp[0],31) if (!(flags & 8)) temp[1] = "hours " @@ -128,10 +129,10 @@ setTimeVoice(text[],len,flags,tmlf){ return format(text,len,"spk ^"vox/%s%s%s%s%s%s%s^"", temp[0],temp[1],temp[2],temp[3],temp[4],temp[5],temp[6] ) } -findDispFormat(time){ - for(new i = 0;g_TimeSet[i][0];++i){ - if (g_TimeSet[i][1] & 16){ - if (g_TimeSet[i][0] > time){ +findDispFormat(time) { + for(new i = 0;g_TimeSet[i][0];++i) { + if (g_TimeSet[i][1] & 16) { + if (g_TimeSet[i][0] > time) { if (!g_Switch) { g_CountDown = g_Switch = time remove_task(8648458) @@ -140,18 +141,18 @@ findDispFormat(time){ return i } } - else if (g_TimeSet[i][0] == time){ + else if (g_TimeSet[i][0] == time) { return i } } return -1 } -public setDisplaying(){ +public setDisplaying() { new arg[32], flags[32], num[32] new argc = read_argc() - 1 new i = 0 - while (i < argc && i < 32){ + while (i < argc && i < 32) { read_argv(i+1,arg,31) parse(arg,flags,31,num,31) g_TimeSet[i][0] = str_to_num(num) @@ -162,7 +163,7 @@ public setDisplaying(){ return PLUGIN_HANDLED } -public timeRemain(param[]){ +public timeRemain(param[]) { new gmtm = get_timeleft() new tmlf = g_Switch ? --g_CountDown : gmtm new stimel[12] @@ -174,21 +175,25 @@ public timeRemain(param[]){ set_task(0.8,"timeRemain",8648458,"",0,"b") return } - if (tmlf > 0 && g_LastTime != tmlf){ + if (tmlf > 0 && g_LastTime != tmlf) { g_LastTime = tmlf new tm_set = findDispFormat(tmlf) if ( tm_set != -1){ new flags = g_TimeSet[tm_set][1] new arg[128] - if (flags & 1){ - setTimeText(arg,127,tmlf) - if (flags & 16) - set_hudmessage(255, 255, 255, -1.0, 0.85, 0, 0.0, 1.1, 0.1, 0.5, 1) - else - set_hudmessage(255, 255, 255, -1.0, 0.85, 0, 0.0, 3.0, 0.0, 0.5, 1) - show_hudmessage(0,arg) + if (flags & 1) { + new players[32],pnum + get_players(players,pnum,"c") + for (new i=0;i