From 89b4ef92b50ff10e328a9a911eca7569aafd5f81 Mon Sep 17 00:00:00 2001 From: Felix Geyer Date: Thu, 5 Aug 2004 11:09:16 +0000 Subject: [PATCH] updated to use the multi-lingual system | better code style --- plugins/cmdmenu.sma | 141 ++++++++----------- plugins/imessage.sma | 23 ++- plugins/mapchooser.sma | 111 ++++++++------- plugins/mapsmenu.sma | 300 ++++++++++++++++++--------------------- plugins/menufront.sma | 113 ++++++++------- plugins/miscstats.sma | 311 +++++++++++++++++++++-------------------- plugins/nextmap.sma | 41 +++--- plugins/pausecfg.sma | 208 ++++++++++++++------------- 8 files changed, 609 insertions(+), 639 deletions(-) diff --git a/plugins/cmdmenu.sma b/plugins/cmdmenu.sma index c5579e99..6bafc4c0 100755 --- a/plugins/cmdmenu.sma +++ b/plugins/cmdmenu.sma @@ -39,25 +39,25 @@ #define MAX_CMDS_LAYERS 3 -new g_cmdMenuName[ MAX_CMDS_LAYERS ][ ] = { - "Commands Menu", - "Configs Menu", - "Speech Menu" +new g_cmdMenuName[ MAX_CMDS_LAYERS ][] = { + "CMD_MENU", + "CONF_MENU", + "SPE_MENU" } -new g_cmdMenuCmd[ MAX_CMDS_LAYERS ][ ] = { +new g_cmdMenuCmd[ MAX_CMDS_LAYERS ][] = { "amx_cmdmenu", "amx_cfgmenu", "amx_speechmenu" } -new g_cmdMenuCfg[ MAX_CMDS_LAYERS ][ ] = { +new g_cmdMenuCfg[ MAX_CMDS_LAYERS ][] = { "cmds.ini", "configs.ini", "speech.ini" } -new g_cmdMenuHelp[ MAX_CMDS_LAYERS ][ ] = { +new g_cmdMenuHelp[ MAX_CMDS_LAYERS ][] = { "- displays commands menu", "- displays configs menu", "- displays speech menu" @@ -86,15 +86,17 @@ new g_menuLayer[33] new g_coloredMenus -public plugin_init() -{ +public plugin_init() { register_plugin("Commands Menu",AMXX_VERSION_STR,"AMXX Dev Team") + register_dictionary("cmdmenu.txt") + register_dictionary("common.txt") - new configsDir[64]; - get_configsdir(configsDir, 63); - new config[64] - for(new a = 0; a < MAX_CMDS_LAYERS; ++a) { - register_menucmd(register_menuid( g_cmdMenuName[ a ] ),1023,"actionCmdMenu") + new configsDir[64],config[64] + get_configsdir(configsDir, 63) + for (new a = 0; a < MAX_CMDS_LAYERS; ++a) { + new MenuName[64] + format(MenuName,63,"%L","en",g_cmdMenuName[a]) + register_menucmd(register_menuid( MenuName ),1023,"actionCmdMenu") register_clcmd( g_cmdMenuCmd[ a ] ,"cmdCmdMenu",ADMIN_MENU, g_cmdMenuHelp[ a ] ) format(config,63,"%s/%s",configsDir,g_cmdMenuCfg[a]) loadCmdSettings(config,a) @@ -112,12 +114,11 @@ public plugin_init() /* Commands menu */ -public actionCmdMenu(id,key) -{ - switch(key){ - case 8: displayCmdMenu(id,++g_menuPosition[id]) - case 9: displayCmdMenu(id,--g_menuPosition[id]) - default:{ +public actionCmdMenu(id,key) { + switch (key) { + case 8: displayCmdMenu(id,++g_menuPosition[id]) + case 9: displayCmdMenu(id,--g_menuPosition[id]) + default:{ new option = g_menuSelect[ id ][ g_menuPosition[id] * 8 + key ] new flags = g_cmdMisc[ option ][ 1 ] if ( flags & 1) @@ -133,8 +134,7 @@ public actionCmdMenu(id,key) } -displayCmdMenu(id,pos){ - +displayCmdMenu(id,pos) { if (pos < 0) return new menuBody[512] @@ -145,7 +145,7 @@ displayCmdMenu(id,pos){ start = pos = g_menuPosition[id] = 0 new len = format(menuBody,511,g_coloredMenus ? - "\y%s\R%d/%d^n\w^n" : "%s %d/%d^n^n" , g_cmdMenuName[ g_menuLayer[id] ], + "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n" , id, g_cmdMenuName[ g_menuLayer[id] ], pos+1,( g_menuSelectNum[id] / 8 + ((g_menuSelectNum[id] % 8) ? 1 : 0 )) ) new end = start + 8 @@ -154,33 +154,31 @@ displayCmdMenu(id,pos){ if (end > g_menuSelectNum[id]) end = g_menuSelectNum[id] - for(new a = start; a < end; ++a) - { - if ( g_cmdCmd[ g_menuSelect[id][ a ] ][0] == '-' ) - { + for(new a = start; a < end; ++a) { + if ( g_cmdCmd[ g_menuSelect[id][ a ] ][0] == '-' ) { if ( g_coloredMenus ) len += format(menuBody[len],511-len,"\d%s^n\w",g_cmdName[ g_menuSelect[id][ a ] ] ) else len += format(menuBody[len],511-len,"%s^n",g_cmdName[ g_menuSelect[id][ a ] ] ) ++b } - else - { + else { keys |= (1< 3 ) - { + g_cmdCmd[ c ] ,63,szFlags,31,szAccess,31 ) > 3 ) { while ( replace( g_cmdCmd[ c ] ,63,"\'","^"") ) { // do nothing } @@ -256,13 +248,11 @@ loadCmdSettings( szFilename[], level ) /* Cvars menu */ -public actionCvarMenu(id,key) -{ - switch(key){ - case 8: displayCvarMenu(id,++g_menuPosition[id]) - case 9: displayCvarMenu(id,--g_menuPosition[id]) - default:{ - +public actionCvarMenu(id,key) { + switch (key){ + case 8: displayCvarMenu(id,++g_menuPosition[id]) + case 9: displayCvarMenu(id,--g_menuPosition[id]) + default: { new option = g_menuSelect[ id ][ g_menuPosition[id] * 8 + key ] new szValue[32] @@ -271,10 +261,8 @@ public actionCvarMenu(id,key) new end = g_cvarMisc[ option ][ 2 ] new start = g_cvarMisc[ option ][ 1 ] - for(new i = start ; ; ++i ) - { - if ( i < end ) - { + for (new i = start ; ; ++i ) { + if ( i < end ) { if ( equal( szValue , g_cvarCmd[ i ] ) ) { if (++i >= end) @@ -285,8 +273,7 @@ public actionCvarMenu(id,key) break } } - else - { + else { set_cvar_string( g_cvarNames[ option ], g_cvarCmd[ start ] ) break } @@ -299,30 +286,28 @@ public actionCvarMenu(id,key) } -displayCvarMenu(id,pos){ - +displayCvarMenu(id,pos) { if (pos < 0) return - + new menuBody[512] new b = 0 new start = pos * 8 - + if (start >= g_menuSelectNum[id]) start = pos = g_menuPosition[id] = 0 - + new len = format(menuBody,511, g_coloredMenus ? "\yCvars Menu\R%d/%d^n\w^n" : "Cvars Menu %d/%d^n^n", pos+1,( g_menuSelectNum[id] / 8 + ((g_menuSelectNum[id] % 8) ? 1 : 0 )) ) - + new end = start + 8 new keys = MENU_KEY_0 new szValue[64] - + if (end > g_menuSelectNum[id]) end = g_menuSelectNum[id] - - for(new a = start; a < end; ++a) - { + + for(new a = start; a < end; ++a) { get_cvar_string( g_cvarNames[ g_menuSelect[id][ a ] ],szValue,31) keys |= (1< #include -#define MAX_MESSAGES 6 -#define X_POS -1.0 -#define Y_POS 0.30 -#define HOLD_TIME 12.0 +#define MAX_MESSAGES 6 +#define X_POS -1.0 +#define Y_POS 0.30 +#define HOLD_TIME 12.0 new g_Values[MAX_MESSAGES][3] new g_Messages[MAX_MESSAGES][384] new g_MessagesNum new g_Current -public plugin_init(){ +public plugin_init() { register_plugin("Info. Messages",AMXX_VERSION_STR,"AMXX Dev Team") + register_dictionary("imessage.txt") register_srvcmd("amx_imessage","setMessage") register_cvar("amx_freq_imessage","10") new lastinfo[8] @@ -55,7 +56,7 @@ public plugin_init(){ set_localinfo("lastinfomsg","") } -public infoMessage(){ +public infoMessage() { if (g_Current >= g_MessagesNum) g_Current = 0 set_hudmessage(g_Values[g_Current][0], g_Values[g_Current][1], g_Values[g_Current][2], @@ -67,11 +68,9 @@ public infoMessage(){ if ( freq_im > 0.0 ) set_task( freq_im ,"infoMessage",12345) } -public setMessage(id,level,cid) { - if (!cmd_access(id,level,cid,3)) - return PLUGIN_HANDLED - if (g_MessagesNum >= MAX_MESSAGES) { - console_print(id,"Information Messages limit reached!") +public setMessage() { + if (g_MessagesNum >= MAX_MESSAGES) { + server_print("%L",LANG_SERVER,"INF_REACH") return PLUGIN_HANDLED } remove_task(12345) @@ -93,7 +92,7 @@ public setMessage(id,level,cid) { return PLUGIN_HANDLED } -public plugin_end(){ +public plugin_end() { new lastinfo[8] num_to_str(g_Current,lastinfo,7) set_localinfo("lastinfomsg",lastinfo) diff --git a/plugins/mapchooser.sma b/plugins/mapchooser.sma index 7d1a50bc..521deefd 100755 --- a/plugins/mapchooser.sma +++ b/plugins/mapchooser.sma @@ -50,10 +50,13 @@ new g_lastMap[32] new g_coloredMenus new bool:g_selected = false -public plugin_init() -{ +public plugin_init() { register_plugin("Nextmap Chooser",AMXX_VERSION_STR,"AMXX Dev Team") - register_menucmd(register_menuid("AMX Choose nextmap:"),(-1^(-1<<(SELECTMAPS+2))),"countVote") + register_dictionary("mapchooser.txt") + register_dictionary("common.txt") + new MenuName[64] + format(MenuName,63,"%L","en","CHOOSE_NEXTM") + register_menucmd(register_menuid(MenuName),(-1^(-1<<(SELECTMAPS+2))),"countVote") register_cvar("amx_extendmap_max","90") register_cvar("amx_extendmap_step","15") @@ -63,7 +66,7 @@ public plugin_init() get_localinfo("lastMap",g_lastMap,31) set_localinfo("lastMap","") - new maps_ini_file[64]; + new maps_ini_file[64] get_configsdir(maps_ini_file, 63); format(maps_ini_file, 63, "%s/maps.ini", maps_ini_file); if (!file_exists(maps_ini_file)) @@ -74,50 +77,50 @@ public plugin_init() g_coloredMenus = colored_menus() } -public checkVotes(){ - new b = 0 - for(new a = 0; a < g_mapVoteNum; ++a) - if (g_voteCount[b] < g_voteCount[a]) - b = a - if ( g_voteCount[SELECTMAPS] > g_voteCount[b] ) { - new mapname[32] - get_mapname(mapname,31) - new Float:steptime = get_cvar_float("amx_extendmap_step") - set_cvar_float("mp_timelimit", get_cvar_float("mp_timelimit") + steptime ) - client_print(0,print_chat,"Choosing finished. Current map will be extended to next %.0f minutes", steptime ) - log_amx("Vote: Voting for the nextmap finished. Map %s will be extended to next %.0f minutes", - mapname , steptime ) - return - } - if ( g_voteCount[b] && g_voteCount[SELECTMAPS+1] <= g_voteCount[b] ) - set_cvar_string("amx_nextmap", g_mapName[g_nextName[b]] ) - new smap[32] - get_cvar_string("amx_nextmap",smap,31) - client_print(0,print_chat,"Choosing finished. The nextmap will be %s", smap ) - log_amx("Vote: Voting for the nextmap finished. The nextmap will be %s", smap) +public checkVotes() { + new b = 0 + for (new a = 0; a < g_mapVoteNum; ++a) + if (g_voteCount[b] < g_voteCount[a]) + b = a + if ( g_voteCount[SELECTMAPS] > g_voteCount[b] ) { + new mapname[32] + get_mapname(mapname,31) + new Float:steptime = get_cvar_float("amx_extendmap_step") + set_cvar_float("mp_timelimit", get_cvar_float("mp_timelimit") + steptime ) + client_print(0,print_chat,"%L", LANG_PLAYER, "CHO_FIN_EXT", steptime ) + log_amx("Vote: Voting for the nextmap finished. Map %s will be extended to next %.0f minutes", + mapname , steptime ) + return + } + if ( g_voteCount[b] && g_voteCount[SELECTMAPS+1] <= g_voteCount[b] ) + set_cvar_string("amx_nextmap", g_mapName[g_nextName[b]] ) + new smap[32] + get_cvar_string("amx_nextmap",smap,31) + client_print(0,print_chat,"%L", LANG_PLAYER, "CHO_FIN_NEXT", smap ) + log_amx("Vote: Voting for the nextmap finished. The nextmap will be %s", smap) } -public countVote(id,key){ - if ( get_cvar_float("amx_vote_answers") ) { - new name[32] - get_user_name(id,name,31) - if ( key == SELECTMAPS ) - client_print(0,print_chat,"%s chose map extending", name ) - else if ( key < SELECTMAPS ) - client_print(0,print_chat,"%s chose %s", name, g_mapName[g_nextName[key]] ) - } - ++g_voteCount[key] - return PLUGIN_HANDLED +public countVote(id,key) { + if ( get_cvar_float("amx_vote_answers") ) { + new name[32] + get_user_name(id,name,31) + if ( key == SELECTMAPS ) + client_print(0,print_chat,"%L", LANG_PLAYER, "CHOSE_EXT", name ) + else if ( key < SELECTMAPS ) + client_print(0,print_chat,"%L", LANG_PLAYER, "X_CHOSE_X", name, g_mapName[g_nextName[key]] ) + } + ++g_voteCount[key] + return PLUGIN_HANDLED } -bool:isInMenu(id){ - for(new a=0; a SELECTMAPS) ? SELECTMAPS : g_mapNums for(g_mapVoteNum = 0;g_mapVoteNum 50 ) { g_choosed = g_voteSelected[id][a] - client_print(0,print_chat, "%s %s" , g_voteSuccess , g_mapName[ g_choosed ] ) - log_amx("Vote: %s %s" , g_voteSuccess , g_mapName[ g_choosed ] ) + client_print(0,print_chat, "%L %s", LANG_PLAYER, "VOTE_SUCCESS", g_mapName[ g_choosed ] ) + log_amx("Vote: %L %s", "en", "VOTE_SUCCESS", g_mapName[ g_choosed ] ) } if ( g_choosed != -1 ) { - if ( is_user_connected( id ) ) { + if ( is_user_connected( id ) ) { new menuBody[512] - new len = format(menuBody,511,g_coloredMenus ? "\yThe winner: \w%s^n^n" : "The winner: %s^n^n", g_mapName[ g_choosed ] ) - len += copy( menuBody[len] ,511 - len, g_coloredMenus ? "\yDo you want to continue?^n\w" : "Do you want to continue?^n" ) - copy( menuBody[len] ,511 - len, "^n1. Yes^n2. No") - show_menu( id ,0x03 ,menuBody, 10 ) + new len = format(menuBody,511,g_coloredMenus ? "\y%L: \w%s^n^n" : "%L: %s^n^n", id, "THE_WINNER", g_mapName[ g_choosed ] ) + len += format( menuBody[len] ,511 - len, g_coloredMenus ? "\y%L^n\w" : "%L^n", id, "WANT_CONT" ) + format( menuBody[len], 511-len, "^n1. %L^n2. %L",id,"YES",id,"NO") + new menuName[64] + format(menuName,63,"%L","en","THE_WINNER") + show_menu( id, 0x03, menuBody, 10, menuName ) set_task(10.0,"autoRefuse",4545454) } - else { + else { message_begin(MSG_ALL, SVC_INTERMISSION) message_end() - set_task(2.0,"delayedChange",0, g_mapName[ g_choosed ] , strlen(g_mapName[ g_choosed ]) + 1 ) + set_task(2.0,"delayedChange",0, g_mapName[ g_choosed ] , strlen(g_mapName[ g_choosed ]) + 1 ) } } else { - client_print(0,print_chat, g_VoteFailed ) - log_amx("Vote: %s" , g_VoteFailed) + client_print(0,print_chat, "%L", LANG_PLAYER, "VOTE_FAILED" ) + log_amx("Vote: %L", "en", "VOTE_FAILED") } remove_task(34567 + id) } -public voteCount(id,key) -{ +public voteCount(id,key) { if (key > 3) { - client_print(0,print_chat,"Voting has been canceled") + client_print(0,print_chat,"%L",LANG_PLAYER,"VOT_CANC") remove_task(34567 + id) set_cvar_float( "amx_last_voting" , get_gametime() ) log_amx("Vote: Cancel vote session") @@ -147,130 +142,119 @@ public voteCount(id,key) if (get_cvar_float("amx_vote_answers")) { new name[32] get_user_name(id,name,31) - client_print(0,print_chat,"%s voted for option #%d", name , key + 1 ) + client_print(0,print_chat,"%L", LANG_PLAYER, "X_VOTED_FOR", name , key + 1 ) } ++g_voteCount[key] return PLUGIN_HANDLED } -isMapSelected( id , pos ) -{ - for( new a = 0 ; a < g_voteSelectedNum[ id ]; ++a ) +isMapSelected( id , pos ) { + for ( new a = 0 ; a < g_voteSelectedNum[ id ]; ++a ) if ( g_voteSelected[ id ][ a ] == pos ) return 1 return 0 } -displayVoteMapsMenu(id,pos) -{ - +displayVoteMapsMenu(id,pos) { if (pos < 0) return new menuBody[512], b = 0 , start = pos * 7 - + if (start >= g_mapNums) start = pos = g_menuPosition[id] = 0 - + new len = format(menuBody,511, g_coloredMenus ? - "\yVotemap Menu\R%d/%d^n\w^n" : "Votemap Menu %d/%d^n^n", - pos+1,( g_mapNums / 7 + (( g_mapNums % 7) ? 1 : 0 )) ) + "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", + id,"VOTEMAP_MENU",pos+1,( g_mapNums / 7 + (( g_mapNums % 7) ? 1 : 0 )) ) new end = start + 7, keys = MENU_KEY_0 if (end > g_mapNums) end = g_mapNums - for(new a = start; a < end; ++a) - { - if ( g_voteSelectedNum[id]==4 || isMapSelected( id , pos * 7 + b ) ) - { + for (new a = start; a < end; ++a) { + if ( g_voteSelectedNum[id]==4 || isMapSelected( id , pos * 7 + b ) ) { ++b if ( g_coloredMenus) len += format(menuBody[len],511-len,"\d%d. %s^n\w", b ,g_mapName[ a ]) else len += format(menuBody[len],511-len,"#. %s^n", g_mapName[ a ]) } - else - { + else { keys |= (1< get_gametime() ) - { - client_print(id,print_chat,"There is already one voting...") + if ( get_cvar_float("amx_last_voting") > get_gametime() ) { + client_print(id,print_chat,"%L",id,"ALREADY_VOT") return PLUGIN_HANDLED } - + g_voteSelectedNum[id] = 0 - if ( g_mapNums ) - { + if ( g_mapNums ) { displayVoteMapsMenu(id,g_menuPosition[id] = 0) } - else - { - console_print(id,"There are no maps in menu") - client_print(id,print_chat,"There are no maps in menu") + else { + console_print(id,"%L",id,"NO_MAPS_MENU") + client_print(id,print_chat,"%L",id,"NO_MAPS_MENU") } return PLUGIN_HANDLED } -public cmdMapsMenu(id,level,cid) -{ +public cmdMapsMenu(id,level,cid) { if (!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED - if ( g_mapNums ) - { + if ( g_mapNums ) { displayMapsMenu(id,g_menuPosition[id] = 0) } - else - { - console_print(id,"There are no maps in menu") - client_print(id,print_chat,"There are no maps in menu") + else { + console_print(id,"%L",id,"NO_MAPS_MENU") + client_print(id,print_chat,"%L",id,"NO_MAPS_MENU") } - + return PLUGIN_HANDLED } @@ -278,69 +262,68 @@ public delayedChange(mapname[]) server_cmd("changelevel %s",mapname) -public actionVoteMapMenu(id,key) -{ - switch(key){ - case 7:{ - +public actionVoteMapMenu(id,key) { + switch (key) { + case 7: { new Float:voting = get_cvar_float("amx_last_voting") - if ( voting > get_gametime() ){ - client_print(id,print_chat,"There is already one voting...") - return PLUGIN_HANDLED + if ( voting > get_gametime() ) { + client_print(id,print_chat,"%L",id,"ALREADY_VOT") + return PLUGIN_HANDLED } - if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime()) { - client_print(id,print_chat,"Voting not allowed at this time") + if (voting && voting + get_cvar_float("amx_vote_delay") > get_gametime()) { + client_print(id,print_chat,"%L",id,"VOT_NOW_ALLOW") return PLUGIN_HANDLED } - + g_voteCount = { 0 , 0 , 0 , 0 , 0 } - + new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0 set_cvar_float("amx_last_voting", get_gametime() + vote_time ) new iVoteTime = floatround( vote_time ) set_task( vote_time , "checkVotes",34567 + id) - + new menuBody[512] new players[32] new pnum, keys, len get_players(players,pnum) - - if ( g_voteSelectedNum[id] > 1 ) - { + + if ( g_voteSelectedNum[id] > 1 ) { len = format(menuBody,511,g_coloredMenus ? - "\yWhich map do you want?^n\w^n" : "Which map do you want?^n^n") - for(new c = 0; c < g_voteSelectedNum[id] ; ++c) - { + "\y%L^n\w^n" : "%L^n^n", id, "WHICH_MAP") + for (new c = 0; c < g_voteSelectedNum[id] ; ++c) { len += format(menuBody[len],511,"%d. %s^n", c + 1 , g_mapName[ g_voteSelected[id][ c ] ] ) keys |= (1<<%s><>^" vote maps (map#1 ^"%s^") (map#2 ^"%s^") (map#3 ^"%s^") (map#4 ^"%s^")", @@ -350,12 +333,11 @@ public actionVoteMapMenu(id,key) g_voteSelectedNum[id] > 2 ? g_mapName[ g_voteSelected[id][ 2 ] ] : "", g_voteSelectedNum[id] > 3 ? g_mapName[ g_voteSelected[id][ 3 ] ] : "") } - case 8: displayVoteMapsMenu(id,++g_menuPosition[id]) - case 9: displayVoteMapsMenu(id,--g_menuPosition[id]) - default: - { + case 8: displayVoteMapsMenu(id,++g_menuPosition[id]) + case 9: displayVoteMapsMenu(id,--g_menuPosition[id]) + default: { g_voteSelected[id][ g_voteSelectedNum[id]++ ] = g_menuPosition[id] * 7 + key - + displayVoteMapsMenu(id,g_menuPosition[id]) } } @@ -363,12 +345,11 @@ public actionVoteMapMenu(id,key) } -public actionMapsMenu(id,key) -{ - switch(key){ - case 8: displayMapsMenu(id,++g_menuPosition[id]) - case 9: displayMapsMenu(id,--g_menuPosition[id]) - default: +public actionMapsMenu(id,key) { + switch (key) { + case 8: displayMapsMenu(id,++g_menuPosition[id]) + case 9: displayMapsMenu(id,--g_menuPosition[id]) + default: { new a = g_menuPosition[id] * 8 + key @@ -379,9 +360,9 @@ public actionMapsMenu(id,key) get_user_authid(id,authid,31) get_user_name(id,name,31) - switch(get_cvar_num("amx_show_activity")) { - case 2: client_print(0,print_chat,"ADMIN %s: changelevel %s",name,g_mapName[ a ]) - case 1: client_print(0,print_chat,"ADMIN: changelevel %s",g_mapName[ a ]) + switch (get_cvar_num("amx_show_activity")) { + case 2: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_CHANGEL_2",name,g_mapName[ a ]) + case 1: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_CHANGEL_2",g_mapName[ a ]) } log_amx("Cmd: ^"%s<%d><%s><>^" changelevel ^"%s^"", @@ -395,63 +376,60 @@ public actionMapsMenu(id,key) return PLUGIN_HANDLED } -displayMapsMenu(id,pos) -{ - +displayMapsMenu(id,pos) { if (pos < 0) return new menuBody[512] new start = pos * 8 new b = 0 - + if (start >= g_mapNums) start = pos = g_menuPosition[id] = 0 - + new len = format(menuBody,511, g_coloredMenus ? - "\yChangelevel Menu\R%d/%d^n\w^n" : "Changelevel Menu %d/%d^n^n", - pos+1,( g_mapNums / 8 + (( g_mapNums % 8) ? 1 : 0 )) ) - + "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", + id,"CHANGLE_MENU",pos+1,( g_mapNums / 8 + (( g_mapNums % 8) ? 1 : 0 )) ) + new end = start + 8 new keys = MENU_KEY_0 - + if (end > g_mapNums) end = g_mapNums - - for(new a = start; a < end; ++a) - { + + for (new a = start; a < end; ++a) { keys |= (1< +#include public MultiKill public MultiKillSound @@ -66,78 +66,78 @@ public FirstBloodSound new g_streakKills[33][2] new g_multiKills[33][2] -new g_Planter -new g_Defuser -new g_C4Timer -new g_Defusing -new Float:g_LastOmg -new Float:g_LastPlan +new g_Planter +new g_Defuser +new g_C4Timer +new g_Defusing +new Float:g_LastOmg +new Float:g_LastPlan new g_LastAnnounce new g_roundCount new Float:g_doubleKill new g_doubleKillId -new g_friend[33] +new g_friend[33] new g_firstBlood -new g_MultiKillMsg[7][] = { - "Multi-Kill! %s^nwith %d kills (%d hs)", - "Ultra-Kill!!! %s^nwith %d kills (%d hs)", - "%s IS ON A KILLING SPREE!!!^nwith %d kills (%d hs)", - "RAMPAGE!!! %s^nwith %d kills (%d hs)" , - "%s IS UNSTOPPABLE!!!^nwith %d kills (%d hs)" , - "%s IS A MONSTER!^nwith %d kills (%d hs)", - "%s IS GODLIKE!!!!^nwith %d kills (%d hs)" +new g_MultiKillMsg[7][] = { + "Multi-Kill! %s^n%L %d kills (%d hs)", + "Ultra-Kill!!! %s^n%L %d kills (%d hs)", + "%s IS ON A KILLING SPREE!!!^n%L %d kills (%d hs)", + "RAMPAGE!!! %s^n%L %d kills (%d hs)" , + "%s IS UNSTOPPABLE!!!^n%L %d kills (%d hs)", + "%s IS A MONSTER!^n%L %d kills (%d hs)", + "%s IS GODLIKE!!!!^n%L %d kills (%d hs)" } -new g_Sounds[7][] = { - "multikill", - "ultrakill", - "killingspree", - "rampage", - "unstoppable", +new g_Sounds[7][] = { + "multikill", + "ultrakill", + "killingspree", + "rampage", + "unstoppable", "monsterkill", - "godlike" + "godlike" } new g_KillingMsg[7][] = { "%s: Multi-Kill!", "%s: Ultra-Kill!!!", "%s IS ON A KILLING SPREE!!!", - "%s: RAMPAGE!!!", - "%s IS UNSTOPPABLE!!!", + "%s: RAMPAGE!!!", + "%s IS UNSTOPPABLE!!!", "%s IS A MONSTER!", "%s IS GODLIKE!!!" } -new g_KinfeMsg[4][] = { - "%s sliced and diced %s", - "%s pulled out knife and gutted %s", - "%s sneaks carefully behind and knifed %s", - "%s knived %s" +new g_KinfeMsg[4][] = { + "KNIFE_MSG_1", + "KNIFE_MSG_2", + "KNIFE_MSG_3", + "KNIFE_MSG_4" } -new g_LastMessages[4][] = { - "Now all depend on you!", - "I hope you still have a healthpack.", - "All your teammates were killed. Good luck!", - "Now you are alone. Have fun!" -} -new g_HeMessages[4][] = { - "%s sends a little gift to %s", - "%s throws a small present to %s", - "%s made a precision throw to %s", - "%s got a big explosion for %s" +new g_LastMessages[4][] = { + "LAST_MSG_1", + "LAST_MSG_2", + "LAST_MSG_3", + "LAST_MSG_4" } -new g_SHeMessages[4][] = { - "%s detonated himself with a grenade", - "%s trys the effect of an HE Grenade", - "%s swallows grenades whole!", - "%s explodes!" +new g_HeMessages[4][] = { + "HE_MSG_1", + "HE_MSG_2", + "HE_MSG_3", + "HE_MSG_4" +} +new g_SHeMessages[4][] = { + "SHE_MSG_1", + "SHE_MSG_2", + "SHE_MSG_3", + "SHE_MSG_4", } new g_HeadShots[7][] = { - "$kn killed $vn with a well^nplaced shot to the head!", - "$kn removed $vn's^nhead with the $wn", - "$kn turned $vn's head^ninto pudding with the $wn", - "$vn got pwned by $kn", - "$vn's head has been^nturned into red jello", - "$kn has superb aim with the $wn,^nas $vn well knows.", - "$vn's head stayed in $kn's^ncrosshairs a bit too long..." + "HS_MSG_1", + "HS_MSG_2", + "HS_MSG_3", + "HS_MSG_4", + "HS_MSG_5", + "HS_MSG_6", + "HS_MSG_7" } new g_teamsNames[2][] = { @@ -145,8 +145,9 @@ new g_teamsNames[2][] = { "CT" } -public plugin_init(){ +public plugin_init() { register_plugin("CS Misc. Stats",AMXX_VERSION_STR,"AMXX Dev Team") + register_dictionary("miscstats.txt") register_event("DeathMsg","eDeathMsg","a") register_event("TextMsg","eRestart","a","2&#Game_C","2&#Game_w") register_event("SendAudio", "eEndRound", "a", "2&%!MRAD_terwin","2&%!MRAD_ctwin","2&%!MRAD_rounddraw") @@ -156,59 +157,59 @@ public plugin_init(){ register_event("StatusValue","hideStatus","be","1=1","2=0") new mapname[32] get_mapname(mapname,31) - if (equali(mapname,"de_",3)||equali(mapname,"csde_",5)){ - register_event("StatusIcon", "eGotBomb", "be", "1=1", "1=2", "2=c4") - register_event("SendAudio", "eBombPlanted", "a", "2&%!MRAD_BOMBPL") - register_event("SendAudio", "eBombDef", "a", "2&%!MRAD_BOMBDEF") - register_event("TextMsg", "eBombFail", "a", "2&#Target_B") - register_event("BarTime", "eBombDefG", "be", "1=10", "1=5","1=3") - register_event("BarTime", "eBombDefL", "be", "1=0") - register_event("TextMsg", "eBombPickUp", "bc", "2&#Got_bomb") - register_event("TextMsg", "eBombDrop", "bc", "2&#Game_bomb_d") + if (equali(mapname,"de_",3)||equali(mapname,"csde_",5)) { + register_event("StatusIcon", "eGotBomb", "be", "1=1", "1=2", "2=c4") + register_event("SendAudio", "eBombPlanted", "a", "2&%!MRAD_BOMBPL") + register_event("SendAudio", "eBombDef", "a", "2&%!MRAD_BOMBDEF") + register_event("TextMsg", "eBombFail", "a", "2&#Target_B") + register_event("BarTime", "eBombDefG", "be", "1=10", "1=5","1=3") + register_event("BarTime", "eBombDefL", "be", "1=0") + register_event("TextMsg", "eBombPickUp", "bc", "2&#Got_bomb") + register_event("TextMsg", "eBombDrop", "bc", "2&#Game_bomb_d") } - else if ( equali( mapname , "cs_italy" ) ) { - register_event( "23" , "chickenKill", "a" , "1=108" , /*"12=106",*/ "15=4" ) - register_event( "23" , "radioKill", "a" , "1=108" , /*"12=294",*/ "15=2" ) + else if ( equali( mapname , "cs_italy" ) ) { + register_event( "23" , "chickenKill", "a" , "1=108" , /*"12=106",*/ "15=4" ) + register_event( "23" , "radioKill", "a" , "1=108" , /*"12=294",*/ "15=2" ) } } -public plugin_cfg(){ +public plugin_cfg() { new g_addStast[] = "amx_statscfg add ^"%s^" %s" - server_cmd(g_addStast,"MultiKill","MultiKill") - server_cmd(g_addStast,"MultiKillSound","MultiKillSound") + server_cmd(g_addStast,"MultiKill","MultiKill") + server_cmd(g_addStast,"MultiKillSound","MultiKillSound") server_cmd(g_addStast,"Bomb Planting","BombPlanting") - server_cmd(g_addStast,"Bomb Defusing","BombDefusing") - server_cmd(g_addStast,"Bomb Planted","BombPlanted") + server_cmd(g_addStast,"Bomb Defusing","BombDefusing") + server_cmd(g_addStast,"Bomb Planted","BombPlanted") server_cmd(g_addStast,"Bomb Defuse Succ.","BombDefused") - server_cmd(g_addStast,"Bomb Def. Failure","BombFailed") - server_cmd(g_addStast,"Bomb PickUp","BombPickUp") + server_cmd(g_addStast,"Bomb Def. Failure","BombFailed") + server_cmd(g_addStast,"Bomb PickUp","BombPickUp") server_cmd(g_addStast,"Bomb Drop","BombDrop") - server_cmd(g_addStast,"Bomb Count Down","BombCountVoice") + server_cmd(g_addStast,"Bomb Count Down","BombCountVoice") server_cmd(g_addStast,"Bomb Count Down (def)","BombCountDef") server_cmd(g_addStast,"Bomb Site Reached","BombReached") - server_cmd(g_addStast,"Italy Bonus Kill","ItalyBonusKill") + server_cmd(g_addStast,"Italy Bonus Kill","ItalyBonusKill") server_cmd(g_addStast,"Last Man","LastMan") - server_cmd(g_addStast,"Knife Kill","KnifeKill") - server_cmd(g_addStast,"Knife Kill Sound","KnifeKillSound") + server_cmd(g_addStast,"Knife Kill","KnifeKill") + server_cmd(g_addStast,"Knife Kill Sound","KnifeKillSound") server_cmd(g_addStast,"Grenade Kill","GrenadeKill") server_cmd(g_addStast,"Grenade Suicide","GrenadeSuicide") - server_cmd(g_addStast,"HeadShot Kill","HeadShotKill") + server_cmd(g_addStast,"HeadShot Kill","HeadShotKill") server_cmd(g_addStast,"HeadShot Kill Sound","HeadShotKillSound") server_cmd(g_addStast,"Round Counter","RoundCounter") server_cmd(g_addStast,"Round Counter Sound","RoundCounterSound") - server_cmd(g_addStast,"Killing Streak","KillingStreak") - server_cmd(g_addStast,"Killing Streak Sound","KillingStreakSound") - server_cmd(g_addStast,"Enemy Remaining","EnemyRemaining") - server_cmd(g_addStast,"Double Kill","DoubleKill") - server_cmd(g_addStast,"Double Kill Sound","DoubleKillSound") - server_cmd(g_addStast,"Player Name","PlayerName") - server_cmd(g_addStast,"First Blood Sound","FirstBloodSound") + server_cmd(g_addStast,"Killing Streak","KillingStreak") + server_cmd(g_addStast,"Killing Streak Sound","KillingStreakSound") + server_cmd(g_addStast,"Enemy Remaining","EnemyRemaining") + server_cmd(g_addStast,"Double Kill","DoubleKill") + server_cmd(g_addStast,"Double Kill Sound","DoubleKillSound") + server_cmd(g_addStast,"Player Name","PlayerName") + server_cmd(g_addStast,"First Blood Sound","FirstBloodSound") } public client_putinserver(id) g_multiKills[id] = g_streakKills[ id ] = { 0 , 0 } -public eDeathMsg(){ +public eDeathMsg() { new killerId = read_data(1) if ( killerId == 0 ) return new victimId = read_data(2) @@ -232,7 +233,7 @@ public eDeathMsg(){ set_hudmessage(0, 100, 255, 0.05, 0.55, 2, 0.02, 6.0, 0.01, 0.1, 3) show_hudmessage(0,g_KillingMsg[ a ], name ) } - if ( KillingStreakSound ) client_cmd( 0 , "spk misc/%s" , g_Sounds[ a ] ) + if ( KillingStreakSound ) client_cmd( 0, "spk misc/%s", g_Sounds[ a ] ) } } if ( MultiKill || MultiKillSound ) { @@ -249,7 +250,7 @@ public eDeathMsg(){ new ppl[32], pplnum new team = get_user_team( victimId ) - 1 get_players(ppl,pplnum,"e", g_teamsNames[1 - team] ) - if (pplnum){ + if (pplnum) { new eppl[32], epplnum get_players(eppl,epplnum,"ae",g_teamsNames[team]) if (epplnum) { @@ -265,7 +266,7 @@ public eDeathMsg(){ new cts[32], ts[32], ctsnum, tsnum get_players(cts,ctsnum,"ae", g_teamsNames[1] ) get_players(ts,tsnum,"ae", g_teamsNames[0] ) - if ( ctsnum == 1 && tsnum == 1 ){ + if ( ctsnum == 1 && tsnum == 1 ) { new ctname[32], tname[32] get_user_name(cts[0],ctname,31) get_user_name(ts[0],tname,31) @@ -285,51 +286,54 @@ public eDeathMsg(){ oposite = ctsnum team = 1 } - if (g_LastAnnounce){ + if (g_LastAnnounce) { new name[32] get_user_name(g_LastAnnounce,name,31) set_hudmessage(0, 255, 255, -1.0, 0.35, 0, 6.0, 6.0, 0.5, 0.15, 3) - show_hudmessage(0,"%s (%d HP) vs. %d %s%s: %s",name, - get_user_health(g_LastAnnounce),oposite, - g_teamsNames[team],(oposite==1)?"":"S" ,g_LastMessages[ random_num(0,3) ] ) + show_hudmessage(0,"%s (%d HP) vs. %d %s%s: %L",name, + get_user_health(g_LastAnnounce),oposite, + g_teamsNames[team],(oposite==1)?"":"S",LANG_PLAYER,g_LastMessages[ random_num(0,3) ] ) client_cmd(g_LastAnnounce,"spk misc/oneandonly") } } } new arg[4] - read_data( 4 , arg , 3 ) - if ( equal( arg, "kni" ) && ( KnifeKill || KnifeKillSound ) ) { + read_data( 4 , arg , 3 ) + if ( equal( arg, "kni" ) && ( KnifeKill || KnifeKillSound ) ) { if ( KnifeKill ) { new killer[32], victim[32] get_user_name(killerId,killer,31) get_user_name(victimId,victim,31) set_hudmessage(255, 100, 100, -1.0, 0.25, 1, 6.0, 6.0, 0.5, 0.15, 1) - show_hudmessage(0,g_KinfeMsg[ random_num(0,3) ],killer,victim) + show_hudmessage(0,"%L",LANG_PLAYER,g_KinfeMsg[ random_num(0,3) ],killer,victim) } if ( KnifeKillSound ) client_cmd(0,"spk misc/humiliation") } - else if ( equal( arg, "gre" ) && (GrenadeKill || GrenadeSuicide) ) { + else if ( equal( arg, "gre" ) && (GrenadeKill || GrenadeSuicide) ) { new killer[32], victim[32] get_user_name(killerId,killer,32) get_user_name(victimId,victim,32) set_hudmessage(255, 100, 100, -1.0, 0.25, 1, 6.0, 6.0, 0.5, 0.15, 1) - if ( killerId != victimId ){ - if ( GrenadeKill ) show_hudmessage(0,g_HeMessages[ random_num(0,3)],killer,victim) + if ( killerId != victimId ) { + if ( GrenadeKill ) show_hudmessage(0,"%L",LANG_PLAYER,g_HeMessages[ random_num(0,3)],killer,victim) } - else if ( GrenadeSuicide ) show_hudmessage(0,g_SHeMessages[ random_num(0,3) ],victim) + else if ( GrenadeSuicide ) show_hudmessage(0,"%L",LANG_PLAYER,g_SHeMessages[ random_num(0,3) ],victim) } - if ( headshot && (HeadShotKill || HeadShotKillSound) ) { - if ( HeadShotKill ){ - new killer[32], victim[32], weapon[32], message[128] + if ( headshot && (HeadShotKill || HeadShotKillSound) ) { + if ( HeadShotKill ) { + new killer[32], victim[32], weapon[32], message[128], players[32], pnum get_user_name(killerId,killer,31) get_user_name(victimId,victim,31) read_data( 4 , weapon , 31 ) - copy( message, 127, g_HeadShots[ random_num(0,6) ] ) - replace( message, 127 , "$vn", victim ) - replace( message, 127 , "$wn", weapon ) - replace( message, 127 , "$kn", killer ) - set_hudmessage(100, 100, 255, -1.0, 0.29, 0, 6.0, 6.0, 0.5, 0.15, 1) - show_hudmessage(0,message ) + get_players(players,pnum,"c") + for (new i=0;i= 2 ) - client_print( i , print_chat , "* You've killed %d in a row so far", g_streakKills[ i ][ 0 ] ) - else if ( g_streakKills[ i ][ 1 ] >= 2 ) - client_print( i , print_chat , "* Careful! You've died %d rounds in a row now...", g_streakKills[ i ][ 1 ] ) + client_print( i , print_chat , "* %L", i, "KILLED_ROW", g_streakKills[ i ][ 0 ] ) + else if ( g_streakKills[ i ][ 1 ] >= 2 ) + client_print( i , print_chat , "* %L", i, "DIED_ROUNDS", g_streakKills[ i ][ 1 ] ) } } } -public eRestart(){ +public eRestart() { eEndRound() g_roundCount = 0 g_firstBlood = 1 } -public eEndRound(){ +public eEndRound() { g_C4Timer = -2 g_LastPlan = 0.0 g_LastOmg = 0.0 @@ -422,18 +428,18 @@ public eEndRound(){ g_LastAnnounce = 0 } -public checkKills(param[]){ +public checkKills(param[]) { new id = param[0] new a = param[1] - if (a == g_multiKills[id][0]){ + if (a == g_multiKills[id][0]) { a -= 3 - if ( a > -1 ){ + if ( a > -1 ) { if ( MultiKill ) { new name[32] get_user_name(id,name,31) set_hudmessage(255, 0, 100, 0.05, 0.65, 2, 0.02, 6.0, 0.01, 0.1, 2) if ( a > 6 ) a = 6 - show_hudmessage(0,g_MultiKillMsg[a],name,g_multiKills[id][0],g_multiKills[id][1]) + show_hudmessage(0,g_MultiKillMsg[a],name,LANG_PLAYER,"WITH",g_multiKills[id][0],g_multiKills[id][1]) } if ( MultiKillSound ) client_cmd(0,"spk misc/%s",g_Sounds[a]) } @@ -441,40 +447,41 @@ public checkKills(param[]){ } } -public chickenKill() - if ( ItalyBonusKill ) announceEvent( 0 , "Somebody killed a chicken!!!" ) +public chickenKill() + if ( ItalyBonusKill ) announceEvent( 0 , "KILLED_CHICKEN" ) -public radioKill() - if ( ItalyBonusKill ) announceEvent( 0 , "Somebody blew up the radio!!!" ) +public radioKill() { + if ( ItalyBonusKill ) announceEvent( 0 , "BLEW_RADIO" ) +} -announceEvent( id , message[] ){ +announceEvent( id, message[] ) { new name[32] get_user_name(id, name , 31) set_hudmessage(255, 100, 50, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1) - show_hudmessage(0,message,name) + show_hudmessage(0,"%L",LANG_PLAYER,message,name) } -public eGotBomb(id){ +public eGotBomb(id) { g_Planter = id g_Defuser = g_Defusing = 0 - if ( BombReached && read_data(1)==2 && g_LastOmg 0){ +public bombTimer() { + if (--g_C4Timer > 0) { if (BombCountVoice) { - if (g_C4Timer == 30 || g_C4Timer == 20){ + if (g_C4Timer == 30 || g_C4Timer == 20) { new temp[48] num_to_word(g_C4Timer,temp,47) client_cmd(0,"spk ^"vox/%s seconds until explosion^"",temp) } - else if (g_C4Timer < 11){ + else if (g_C4Timer < 11) { new temp[48] num_to_word(g_C4Timer,temp,47) client_cmd(0,"spk ^"vox/%s^"",temp) @@ -510,13 +517,13 @@ public bombTimer(){ } public eBombDef() - if (BombDefused) announceEvent(g_Defuser , "%s defused the bomb!" ) + if (BombDefused) announceEvent(g_Defuser, "DEFUSED_BOMB" ) public eBombFail() - if (BombFailed && g_Defuser ) announceEvent(g_Defuser , "%s failed to defuse the bomb..." ) + if (BombFailed && g_Defuser ) announceEvent(g_Defuser , "FAILED_DEFU" ) public eBombPickUp(id) - if (BombPickUp) announceEvent(id , "%s pick up the bomb...") + if (BombPickUp) announceEvent(id , "PICKED_BOMB") public eBombDrop() - if (BombDrop) announceEvent(g_Planter , "%s dropped the bomb!!!") + if (BombDrop) announceEvent(g_Planter , "DROPPED_BOMB") \ No newline at end of file diff --git a/plugins/nextmap.sma b/plugins/nextmap.sma index f520dcbb..a090d4cf 100755 --- a/plugins/nextmap.sma +++ b/plugins/nextmap.sma @@ -43,29 +43,29 @@ new g_nextMap[32] new g_mapCycle[32] new g_pos -public plugin_init() -{ +public plugin_init() { register_plugin("NextMap",AMXX_VERSION_STR,"AMXX Dev Team") + register_dictionary("nextmap.txt") register_event("30","changeMap","a") register_clcmd("say nextmap","sayNextMap",0,"- displays nextmap") register_cvar("amx_nextmap","",FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_SPONLY) - + new szString[32], szString2[32], szString3[8] get_localinfo( "lastmapcycle", szString , 31 ) parse( szString, szString2, 31, szString3 , 7 ) g_pos = str_to_num( szString3 ) get_cvar_string( "mapcyclefile" , g_mapCycle , 31 ) - + if ( !equal( g_mapCycle , szString2 ) ) g_pos = 0 // mapcyclefile has been changed - go from first - - readMapCycle( g_mapCycle , g_nextMap , 31 ) + + readMapCycle( g_mapCycle , g_nextMap , 31 ) set_cvar_string( "amx_nextmap", g_nextMap ) format( szString3 , 31, "%s %d", g_mapCycle , g_pos ) // save lastmapcycle settings - set_localinfo( "lastmapcycle", szString3 ) + set_localinfo( "lastmapcycle", szString3 ) } -getNextMapName(szArg[],iMax){ +getNextMapName(szArg[],iMax) { new len = get_cvar_string("amx_nextmap",szArg,iMax) if ( is_map_valid(szArg) ) return len len = copy(szArg,iMax,g_nextMap) @@ -73,18 +73,18 @@ getNextMapName(szArg[],iMax){ return len } -public sayNextMap(){ +public sayNextMap() { new name[32] getNextMapName(name,31) client_print(0,print_chat,"Next Map: %s",name) } -public delayedChange( param[] ){ +public delayedChange( param[] ) { set_cvar_float("mp_chattime",get_cvar_float("mp_chattime")-2.0) server_cmd( "changelevel %s", param ) } -public changeMap(){ +public changeMap() { new string[32] new Float:chattime = get_cvar_float("mp_chattime") set_cvar_float( "mp_chattime" , chattime + 2.0 ) // make sure mp_chattime is long @@ -96,23 +96,23 @@ new g_warning[] = "WARNING: Couldn't find a valid map or the file doesn't exist #if defined OBEY_MAPCYCLE -readMapCycle(szFileName[], szNext[], iNext ){ +readMapCycle(szFileName[], szNext[], iNext ) { new b, i = 0, iMaps = 0 new szBuffer[32], szFirst[32] if ( file_exists( szFileName ) ) { - while( read_file( szFileName , i++ , szBuffer , 31 , b ) ) { + while( read_file( szFileName , i++ , szBuffer , 31 , b ) ) { if ( !isalpha( szBuffer[0] ) || !is_map_valid( szBuffer ) ) continue if ( !iMaps ) copy( szFirst, 31, szBuffer ) if ( ++iMaps > g_pos ) { - copy( szNext , iNext , szBuffer ) + copy( szNext , iNext , szBuffer ) g_pos = iMaps return } } } if ( !iMaps ) { - log_message( g_warning , szFileName ) - get_mapname( szFirst , 31 ) + log_amx( g_warning , szFileName ) + get_mapname( szFirst , 31 ) } copy( szNext , iNext , szFirst ) g_pos = 1 @@ -120,13 +120,12 @@ readMapCycle(szFileName[], szNext[], iNext ){ #else -readMapCycle(szFileName[], szNext[], iNext ) -{ +readMapCycle(szFileName[], szNext[], iNext ) { new b, i = 0, iMaps = 0 new szBuffer[32], szFirst[32], szCurrent[32] get_mapname( szCurrent , 31 ) new a = g_pos - + if ( file_exists( szFileName ) ) { while( read_file( szFileName , i++ , szBuffer , 31 , b ) ) { if ( !isalpha( szBuffer[0] ) || !is_map_valid( szBuffer ) ) continue @@ -134,7 +133,7 @@ readMapCycle(szFileName[], szNext[], iNext ) iMaps = 1 copy( szFirst, 31, szBuffer ) } - if ( iMaps == 1 ){ + if ( iMaps == 1 ) { if ( equali( szCurrent , szBuffer ) ) { if ( a-- == 0 ) iMaps = 2 @@ -151,7 +150,7 @@ readMapCycle(szFileName[], szNext[], iNext ) } } if ( !iMaps ) { - log_message( g_warning , szFileName ) + log_amx( g_warning , szFileName ) copy( szNext ,iNext , szCurrent ) } else copy( szNext ,iNext , szFirst ) diff --git a/plugins/pausecfg.sma b/plugins/pausecfg.sma index a55e3b29..44c41abd 100755 --- a/plugins/pausecfg.sma +++ b/plugins/pausecfg.sma @@ -46,14 +46,15 @@ new g_menuPos[33] new g_fileToSave[64] new g_coloredMenus new g_Modified -new g_couldntFind[] = "Couldn't find a plugin matching ^"%s^"" -new g_pluginMatch[] = "Plugin matching ^"%s^" %s" +new g_pluginMatch[] = "" new g_addCmd[] = "amx_pausecfg add ^"%s^"" new g_system[MAX_SYSTEM] new g_systemNum public plugin_init() { register_plugin("Pause Plugins",AMXX_VERSION_STR,"AMXX Dev Team") + register_dictionary("pausecfg.txt") + register_dictionary("common.txt") register_concmd("amx_pausecfg","cmdPlugin",ADMIN_CFG,"- list commands for pause/unpause managment") register_clcmd("amx_pausecfgmenu","cmdMenu",ADMIN_CFG,"- pause/unpause plugins with menu") #if defined DIRECT_ONOFF @@ -64,7 +65,7 @@ public plugin_init() { g_coloredMenus = colored_menus() get_configsdir(g_fileToSave, 63); format(g_fileToSave, 63, "%s/pausecfg.ini", g_fileToSave); - + return PLUGIN_CONTINUE } @@ -95,40 +96,40 @@ public plugin_cfg() { server_cmd(g_addCmd, "NextMap" ) server_cmd(g_addCmd, "Admin Help" ) server_cmd(g_addCmd, "Admin Base" ) - server_cmd(g_addCmd, "Admin Votes" ) + server_cmd(g_addCmd, "Admin Votes" ) server_cmd(g_addCmd, "Welcome Message" ) server_cmd(g_addCmd, "Stats Configuration" ) server_cmd(g_addCmd, "Commands Menu" ) server_cmd(g_addCmd, "Maps Menu" ) server_cmd(g_addCmd, "Menus Front-End" ) - server_cmd(g_addCmd, "Admin Base for MySQL" ) + server_cmd(g_addCmd, "Admin Base (SQL)" ) server_cmd(g_addCmd, "Players Menu" ) server_cmd(g_addCmd, "Teleport Menu" ) } public actionMenu(id,key) { - switch(key){ - case 6:{ + switch (key) { + case 6: { if (file_exists(g_fileToSave)){ delete_file(g_fileToSave) - client_print(id,print_chat,"* Configuration file cleared. Reload the map if needed") + client_print(id,print_chat,"* %L",id,"CONF_CLEARED") } else - client_print(id,print_chat,"* Configuration was already cleared!") - displayMenu(id,g_menuPos[id]) - } - case 7:{ - if (saveSettings(g_fileToSave)){ - g_Modified = 0 - client_print(id,print_chat,"* Configuration saved successfully") - } - else - client_print(id,print_chat,"* Configuration saving failed!!!") + client_print(id,print_chat,"* %L",id,"ALR_CLEARED") displayMenu(id,g_menuPos[id]) } - case 8: displayMenu(id,++g_menuPos[id]) - case 9: displayMenu(id,--g_menuPos[id]) - default:{ + case 7: { + if (saveSettings(g_fileToSave)){ + g_Modified = 0 + client_print(id,print_chat,"* %L",id,"CONF_SAVED") + } + else + client_print(id,print_chat,"* %L",id,"SAVE_FAILED") + displayMenu(id,g_menuPos[id]) + } + case 8: displayMenu(id,++g_menuPos[id]) + case 9: displayMenu(id,--g_menuPos[id]) + default:{ new option = g_menuPos[id] * 6 + key new file[32],status[2] get_plugin(option,file,31,status,0,status,0,status,0,status,1) @@ -149,13 +150,13 @@ public actionMenu(id,key) { return PLUGIN_HANDLED } -getStatus( code, arg[], iarg ) { - switch(code){ - case 'r': copy( arg, iarg , "ON" ) - case 's': copy( arg, iarg , "STOPPED" ) - case 'p': copy( arg, iarg , "OFF" ) - case 'b': copy( arg, iarg , "ERROR" ) - default: copy( arg, iarg , "LOCKED" ) +getStatus( id, code, arg[], iarg ) { + switch (code) { + case 'r': format( arg, iarg, "%L", id, "ON" ) + case 's': format( arg, iarg, "%L", id, "STOPPED" ) + case 'p': format( arg, iarg, "%L", id, "OFF" ) + case 'b': format( arg, iarg, "%L", id, "ERROR" ) + default: format( arg, iarg, "%L", id, "LOCKED" ) } } @@ -173,13 +174,13 @@ displayMenu(id, pos) { new menu_body[512], start = pos * 6, k = 0 if (start >= datanum) start = pos = g_menuPos[id] = 0 new len = format(menu_body,511, - g_coloredMenus ? "\yPause/Unpause Plugins\R%d/%d^n\w^n" : "Pause/Unpause Plugins %d/%d^n^n" , - pos + 1,((datanum/6)+((datanum%6)?1:0))) + g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n" , + id,"PAUSE_UNPAUSE"pos + 1,((datanum/6)+((datanum%6)?1:0))) new end = start + 6, keys = MENU_KEY_0|MENU_KEY_8|MENU_KEY_7 if (end > datanum) end = datanum - for(new a = start; a < end; ++a){ + for (new a = start; a < end; ++a) { get_plugin(a,filename,31,title,31,status,0,status,0,status,1) - getStatus( status[0] , status , 7 ) + getStatus( id, status[0] , status , 7 ) if ( isSystem( a ) || (status[0]!='O'&&status[0]!='S')) { if ( g_coloredMenus ) { len += format(menu_body[len],511-len, "\d%d. %s\R%s^n\w",++k, title, status ) @@ -194,24 +195,24 @@ displayMenu(id, pos) { len += format(menu_body[len],511-len,g_coloredMenus ? "%d. %s\y\R%s^n\w" : "%d. %s %s^n",++k,title, status ) } } - len += format(menu_body[len],511-len,"^n7. Clear file with stopped^n") - len += format(menu_body[len],511-len,g_coloredMenus ? "8. Save stopped \y\R%s^n\w" - : "8. Save stopped %s^n" ,g_Modified ? "*" : "") + len += format(menu_body[len],511-len,"^n7. %L^n",id,"CLEAR_STOPPED") + len += format(menu_body[len],511-len,g_coloredMenus ? "8. %L \y\R%s^n\w" + : "8. %L %s^n", id, "SAVE_STOPPED", g_Modified ? "*" : "") if (end != datanum){ - format(menu_body[len],511-len,"^n9. More...^n0. %s", pos ? "Back" : "Exit") + format(menu_body[len],511-len,"^n9. %L...^n0. %s", id, "MORE", id, pos ? "BACK" : "EXIT") keys |= MENU_KEY_9 } - else format(menu_body[len],511-len,"^n0. %s", pos ? "Back" : "Exit") - show_menu(id,keys,menu_body) + else format(menu_body[len],511-len,"^n0. %s", id, pos ? "BACK" : "EXIT") + show_menu(id,keys,menu_body,-1,"Pause/Unpause Plugins") } -public cmdMenu(id,level,cid){ +public cmdMenu(id,level,cid) { if (cmd_access(id,level,cid,1)) displayMenu(id,g_menuPos[id] = 0) return PLUGIN_HANDLED } -pausePlugins(id){ +pausePlugins(id) { new filename[32],title[32],status[2] new count = 0, imax = get_pluginsnum() for (new a=0;a= plgnum) start = plgnum - 1 - console_print(id,"^n----- Pause Plugins: Loaded plugins -----") - console_print(id, " %-18.17s %-8.7s %-17.16s %-16.15s %-9.8s","name","version","author","file","status") - new plugin[32],title[32],version[16],author[32],status[16] - new end = start + 10 - if (end > plgnum) end = plgnum - for (new a = start; a < end; ++a){ - get_plugin(a,plugin,31,title,31,version,15,author,31,status,15) - if (status[0] == 'r') ++running - console_print(id, " [%3d] %-18.17s %-8.7s %-17.16s %-16.15s %-9.8s",a+1,title,version,author,plugin, status ) - - } - console_print(id,"----- Entries %d - %d of %d (%d running) -----",start+1,end,plgnum,running) - if (end < plgnum) - console_print(id,"----- Use 'amx_pausecfg list %d' for more -----",end+1) - else - console_print(id,"----- Use 'amx_pausecfg list 1' for begin -----") + else if ( equal(cmds, "list" ) ) { + new lName[32],lVersion[32],lAuthor[32],lFile[32],lStatus[32] + format(lName,31,"%L",id,"NAME") + format(lVersion,31,"%L",id,"VERSION") + format(lAuthor,31,"%L",id,"AUTHOR") + format(lFile,31,"%L",id,"FILE") + format(lStatus,31,"%L",id,"STATUS") + new arg1[8], running = 0 + new start = read_argv(2,arg1,7) ? str_to_num(arg1) : 1 + if (--start < 0) start = 0 + new plgnum = get_pluginsnum() + if (start >= plgnum) start = plgnum - 1 + console_print(id,"^n----- %L -----",id,"PAUSE_LOADED") + console_print(id, " %-18.17s %-8.7s %-17.16s %-16.15s %-9.8s",lName,lVersion,lAuthor,lFile,lStatus) + new plugin[32],title[32],version[16],author[32],status[16] + new end = start + 10 + if (end > plgnum) end = plgnum + for (new a = start; a < end; ++a) { + get_plugin(a,plugin,31,title,31,version,15,author,31,status,15) + if (status[0] == 'r') ++running + console_print(id, " [%3d] %-18.17s %-8.7s %-17.16s %-16.15s %-9.8s",a+1,title,version,author,plugin, status ) + } + console_print(id,"----- %L -----",id,"ENTRIES",start+1,end,plgnum,running) + if (end < plgnum) + console_print(id,"----- %L -----",id,"USE_MORE",end+1) + else + console_print(id,"----- %L -----",id,"USE_BEGIN") } else { - console_print(id,"Usage: amx_pausecfg [name]") - console_print(id,"Commands:") - console_print(id,"^toff - pauses all plugins not in the list") - console_print(id,"^ton - unpauses all plugins") - console_print(id,"^tstop - stops a plugin") - console_print(id,"^tpause - pauses a plugin") - console_print(id,"^tenable - enables a plugin") - console_print(id,"^tsave - saves a list of stopped plugins") - console_print(id,"^tclear - clears a list of stopped plugins") - console_print(id,"^tlist [id] - lists plugins") - console_print(id,"^tadd - marks a plugin as unpauseable") + console_print(id,"%L",id,"USAGE") + console_print(id,"%L:",id,"COMMANDS") + console_print(id,"%L",id,"COM_TOFF") + console_print(id,"%L",id,"COM_TON") + console_print(id,"%L",id,"COM_TSTOP") + console_print(id,"%L",id,"COM_TPAUSE") + console_print(id,"%L",id,"COM_TENABLE") + console_print(id,"%L",id,"COM_TSAVE") + console_print(id,"%L",id,"COM_TCLEAR") + console_print(id,"%L",id,"COM_TLIST") + console_print(id,"%L",id,"COM_TADD") } return PLUGIN_HANDLED } -saveSettings(filename[]){ +saveSettings(filename[]) { if (file_exists(filename)) delete_file(filename) new text[256], file[32],title[32],status[2] new inum = get_pluginsnum() if (!write_file(filename,";Generated by Pause Plugins Plugin. Do not modify!^n;Title Filename")) return 0 - for(new a = 0; a < inum; ++a){ + for (new a = 0; a < inum; ++a) { get_plugin(a,file,31,title,31,status,0,status,0,status,1) if ( status[0] == 's' ){ format(text,255,"^"%s^" ;%s",title,file) @@ -374,7 +380,7 @@ saveSettings(filename[]){ return 1 } -loadSettings(filename[]){ +loadSettings(filename[]) { if (!file_exists(filename)) return 0 new name[256], file[32], i, pos = 0 while (read_file(filename,pos++,name,255,i)){ @@ -383,4 +389,4 @@ loadSettings(filename[]){ pause("dc", file ) } return 1 -} +} \ No newline at end of file