diff --git a/plugins/ppause.sma b/plugins/ppause.sma deleted file mode 100755 index 64242fa1..00000000 --- a/plugins/ppause.sma +++ /dev/null @@ -1,396 +0,0 @@ -/* AMX Mod script. - * - * (c) 2003, OLO - * This file is provided as is (no warranties). - * - * Admin commads: - * amx_pausemenu - displays menu by which you can pause, unpause and stop plugins - * amx_plugin - displays help for all commands for that plugin - * - * WARNING: Stopped plugins won't work properly after activation - * (without mapchange) due to unactive status during plugins initialization - * and at players connections. For proper activation clear the file with - * stopped plugins (option #7 in menu) or unstop selected one then change the map. - */ - -#include -#include - - -// Uncomment if you want to have two new commands -// amx_off - pause plugins not registered in the unpauseable list -// amx_on - enable all plugins not registered in the unpauseable list -//#define DIRECT_ONOFF - -#define MAX_PLGDATA 64 -#define MAX_PLUGINS 192 - -enum { - PLG_ERROR, - PLG_ON, - PLG_OFF, - PLG_STOPPED -} - -new g_pluginList[MAX_PLGDATA][32] -new g_pluginListNum -new g_menuPos[33] -new g_dontPause[MAX_PLGDATA] -new g_dontPauseNum -new g_pluginStatus[MAX_PLUGINS] -new bool:g_Modified - -new g_fileToSave[64] -new g_cstrikeRunning - -public plugin_init(){ - register_plugin("Pause Plugins","0.9","default") - -#if defined DIRECT_ONOFF - register_concmd("amx_off","cmdOFF",ADMIN_CFG,"- pause some plugins") - register_concmd("amx_on","cmdON",ADMIN_CFG,"- unpause some plugins") -#endif - - register_concmd("amx_plugin","cmdPause",ADMIN_CFG,"- list cmds. for pause/unpause managment") - register_clcmd("amx_pausemenu","cmdMenu",ADMIN_CFG,"- pause or unpause plugins via menu") - register_menucmd(register_menuid("Pause/Unpause Plugins"),1023,"actionMenu") - - get_localinfo( "amx_basedir", g_fileToSave , 31 ) - format( g_fileToSave , 63, "%s/ppause.ini" , g_fileToSave ) - - loadSettings(g_fileToSave) - - new mod_name[32] - get_modname(mod_name,31) - g_cstrikeRunning = equal(mod_name,"cstrike") -} - -new g_addCmd[] = "amx_plugin add ^"%s^"" - -public plugin_cfg() { - /* Put here titles of plugins which you don't want to pause. */ - server_cmd(g_addCmd , "Pause Plugins" ) - server_cmd(g_addCmd , "Admin Commands" ) - server_cmd(g_addCmd , "TimeLeft" ) - server_cmd(g_addCmd , "Slots Reservation" ) - server_cmd(g_addCmd , "Admin Chat" ) - server_cmd(g_addCmd , "NextMap" ) - server_cmd(g_addCmd , "Admin Menu" ) - server_cmd(g_addCmd , "Admin Help" ) - server_cmd(g_addCmd , "Admin Base" ) - server_cmd(g_addCmd , "Welcome Message" ) - server_cmd(g_addCmd , "Stats Settings" ) -} - -public actionMenu(id,key){ - switch(key){ - case 6:{ - if (file_exists(g_fileToSave)){ - delete_file(g_fileToSave) - client_print(id,print_chat,"* Configuration file cleared") - } - else - client_print(id,print_chat,"* Configuration was already cleared!") - displayMenu(id,g_menuPos[id]) - } - case 7:{ - if (saveSettings(g_fileToSave)){ - g_Modified = false - client_print(id,print_chat,"* Configuration saved successfully") - } - else - client_print(id,print_chat,"* Configuration saving 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 filename[32],title[32],version[2],author[2],status[2] - get_plugin(option,filename,31,title,31,version,0,author,0,status,1) - if (status[0]=='r'){ - pause("ac",filename) - g_pluginStatus[option]=PLG_OFF - } - else if ( g_pluginStatus[option]!=PLG_STOPPED && status[0]=='p' ){ - g_pluginStatus[option]=PLG_STOPPED - g_Modified = true - } - else { - unpause("ac",filename) - g_pluginStatus[option]=PLG_ON - } - displayMenu(id,g_menuPos[id]) - } - } - return PLUGIN_HANDLED -} - -displayMenu(id, pos){ - if (pos < 0) return - new filename[32],title[32],version[2],author[2],status[2] - new datanum = get_pluginsnum() - 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_cstrikeRunning ? "\yPause/Unpause Plugins\R%d/%d^n\w^n" : "Pause/Unpause Plugins %d/%d^n^n" , - pos + 1,((datanum/6)+((datanum%6)?1:0))) - new end = start + 6, keys = (1<<9)|(1<<7)|(1<<6) - if (end > datanum) end = datanum - for(new a = start; a < end; ++a){ - get_plugin(a,filename,31,title,31,version,0,author,0,status,1) - if (dontPause(a)||(status[0]!='r'&&status[0]!='p')) { - if (g_cstrikeRunning){ - len += format(menu_body[len],511-len, "\d%d. %s\R%s^n\w",++k, - title, ( status[0]=='r' ) ? "ON" : ( ( status[0]=='p' ) ? "OFF" : "ERROR" ) ) - } - else{ - ++k - len += format(menu_body[len],511-len, "#. %s %s^n", - title, ( status[0]=='r' ) ? "ON" : ( ( status[0]=='p' ) ? "OFF" : "ERROR" ) ) - } - } - else{ - keys |= (1< 2 ) { - if ( g_pluginListNum < MAX_PLGDATA ) - read_argv(2,g_pluginList[g_pluginListNum++],31) - else - console_print(id, "Can't add more plugins to the unpauseable list, limit reached!") - } - else { - console_print(id,"Usage: amx_plugin [name]") - console_print(id,"Commands:") - console_print(id,"^toff - pause all plugins not in the list") - console_print(id,"^ton - unpause all plugins") - console_print(id,"^tstop - stop plugin") - console_print(id,"^tpause - pause plugin") - console_print(id,"^tunpause - unpause plugin") - console_print(id,"^tsave - save list of stopped plugins") - console_print(id,"^tclear - clear list of stopped plugins") - console_print(id,"^tlist - list plugins") - console_print(id,"^tadd - add plugin to the unpauseable plugins list") - } - return PLUGIN_HANDLED -} - -chkStatus(){ - new filename[32],title[32],version[2],author[2],status[2] - new imax = get_pluginsnum() - for (new a=0;a<imax;++a){ - get_plugin(a,filename,31,title,31,version,0,author,0,status,1) - if (status[0]=='p'){ - if (g_pluginStatus[a]!=PLG_STOPPED)g_pluginStatus[a] = PLG_OFF - } - else if (status[0]=='r') - g_pluginStatus[a] = PLG_ON - else - g_pluginStatus[a] = PLG_ERROR - if (dontPausePre(title)) - g_dontPause[g_dontPauseNum++] = a - } -} - -bool:dontPause(myid) { - for(new a=0;a<g_dontPauseNum;++a) - if (g_dontPause[a]==myid) - return true - return false -} - -bool:dontPausePre(name[]) { - for(new a=0;a<g_pluginListNum;++a) - if (equali(g_pluginList[a],name)) - return true - return false -} - -saveSettings(filename[]){ - if (file_exists(filename)) - delete_file(filename) - new text[256], plugin[32],title[32],version[2],author[2],status[2] - new inum = get_pluginsnum() - if (!write_file(filename,";Generated by Pause Plugins Plugin. Do not modify!^n;Filename Description")) - return 0 - for(new a = 0; a < inum; ++a){ - if (g_pluginStatus[a]==PLG_STOPPED){ - get_plugin(a,plugin,31,title,31,version,0,author,0,status,1) - format(text,255,"%s ;%s",plugin,title) - write_file(filename,text) - } - } - return 1 -} - -loadSettings(filename[]){ - if (!file_exists(filename)) return 0 - new text[256], len, pos = 0 - while (read_file(filename,pos++,text,255,len)){ - if ( text[0] == ';' ) continue // line is a comment - parse(text,g_pluginList[g_pluginListNum++],31) - } - new plugin[32],title[32],version[2],author[2],status[2] - new inum = get_pluginsnum() - for(new a = 0; a < inum; ++a){ - get_plugin(a,plugin,31,title,31,version,0,author,0,status,1) - if (!dontPausePre(plugin)) continue - pause("ac",plugin) - g_pluginStatus[a] = PLG_STOPPED - } - g_pluginListNum = 0 - return 1 -} \ No newline at end of file