/*************************************************************************** * plugin_belloq_timerem1.sma * Author: belloq * Version: 1.0b * Date: September 26, 2001 * Last Updated: August 26, 2002 * Added 25, 30, and 40-minute and 10-second reminders * * This plugin is a slight re-write of the timerem plugin. Timerem has a few * bugs related to getting the current time left on a map and dealing with * trying to execute commands to bots. * ***************************************************************************/ #include <core> #include <console> #include <string> #include <admin> #include <adminlib> // Version information new STRING_VERSION[MAX_DATA_LENGTH] = "1.00b"; // execute_all is a modified rip of the admin_execall command. This one is // stripped down, doesn't care about immunity, but makes sure that we don't // execute a command to a bot by checking the user's WonID. // public execute_all(theCommand[]) { // Player index counter new i; // Max number of players new maxplayers = maxplayercount(); // Client SessionID holder new SessionID; // Client name string new Target[MAX_NAME_LENGTH]; // Client team number new Team; // Client WonID new WONID; new Dead; new sAuthID[MAX_AUTHID_LENGTH]; // Loop through the player list for(i=1; i<=maxplayers; i++) { // Initialize (empty) the Target variable strinit(Target); // Gather the player information, making sure the call succeeds if(playerinfo(i,Target,MAX_NAME_LENGTH,SessionID,WONID,Team,Dead,sAuthID)==1) { // Bots usually have an AuthID "BOT". Don't continue if it is "BOT". if(streq(sAuthID,"BOT")!=1) { // Execute the passed command execclient(Target,theCommand); } } } // The plugin handled the event. return PLUGIN_HANDLED; } // ShowNextMap center-says the name of the next map. // public nextmap_thirty_sec() { // Create a local variable to hold the name of the next map new NextMap[MAX_DATA_LENGTH]; // Create a string for display text new NextMapCenterSay[MAX_DATA_LENGTH] = "Next map is "; // Put the name of the next map into the NextMap variable nextmap(NextMap, MAX_DATA_LENGTH); // Append the next map name to the display text variable, NextMapCenterSay strcat(NextMapCenterSay,NextMap,MAX_DATA_LENGTH); strcat(NextMapCenterSay,"^n30 seconds remaining",MAX_DATA_LENGTH); // Centersay the string we just created. centersay(NextMapCenterSay,10,255,255,0); execute_all("speak ^"fvox/thirty seconds remaining^""); } // ShowNextMap center-says the name of the next map. // public nextmap_three_min() { // Create a local variable to hold the name of the next map new NextMap[MAX_DATA_LENGTH]; // Create a string for display text new NextMapCenterSay[MAX_DATA_LENGTH] = "Next map is "; // Put the name of the next map into the NextMap variable nextmap(NextMap, MAX_DATA_LENGTH); // Append the next map name to the display text variable, NextMapCenterSay strcat(NextMapCenterSay,NextMap,MAX_DATA_LENGTH); // Centersay the string we just created. centersay(NextMapCenterSay,10,255,255,0); } // warn_ten_seconds executes a speech command and center-says that there // are 10 seconds remaining on the map. Executed via a timer during // plugin initialization. // public warn_ten_seconds() { centersay("10 seconds remaining",10,255,0,0); execute_all("speak ^"fvox/ten seconds remaining^""); } // warn_one_minute executes a speech command and center-says that there // are 60 seconds remaining on the map. Executed via a timer during // plugin initialization. // public warn_one_minute() { centersay("60 seconds remaining",10,255,0,0); execute_all("speak ^"fvox/sixty seconds remaining^""); } // warn_five_minutes executes a speech command and center-says that there // are five minutes remaining on the map. Executed via a timer during // plugin initialization. // public warn_five_minutes() { centersay("5 minutes remaining",10,0,255,0); execute_all("speak ^"fvox/five minutes remaining^""); } // warn_ten_minutes executes a speech command on the client // and center-says that there are ten minutes remaining on the map. // Executed via a timer during plugin initialization. // public warn_ten_minutes() { centersay("10 minutes remaining",10,0,255,0); execute_all("speak ^"fvox/ten minutes remaining^""); } // warn_fift_minutes executes a speech command on the client // and center-says that there are fifteen minutes remaining on the map. // Executed via a timer during plugin initialization. // public warn_fift_minutes() { centersay("15 minutes remaining",10,0,255,0); execute_all("speak ^"fvox/fifteen minutes remaining^""); } // warn_twty_minutes executes a speech command on the client // and center-says that there are twenty minutes remaining on the map. // Executed via a timer during plugin initialization. // public warn_twty_minutes() { centersay("20 minutes remaining",10,0,255,0); execute_all("speak ^"fvox/twenty minutes remaining^""); } // warn_twtyfv_minutes executes a speech command on the client // and center-says that there are twenty-five minutes remaining on the map. // Executed via a timer during plugin initialization. // public warn_twtyfv_minutes() { centersay("25 minutes remaining",10,0,255,0); execute_all("speak ^"fvox/twenty five minutes remaining^""); } // warn_thrty_minutes executes a speech command on the client // and center-says that there are thirty minutes remaining on the map. // Executed via a timer during plugin initialization. // public warn_thrty_minutes() { centersay("30 minutes remaining",10,0,255,0); execute_all("speak ^"fvox/thirty minutes remaining^""); } // warn_forty_minutes executes a speech command on the client // and center-says that there are forty minutes remaining on the map. // Executed via a timer during plugin initialization. // public warn_forty_minutes() { centersay("40 minutes remaining",10,0,255,0); execute_all("speak ^"fvox/forty minutes remaining^""); } // Plugin initialization routine public plugin_init() { // Register plugin information plugin_registerinfo("belloq's Timed Reminders","Announces time remaining and next maps at specified intervals",STRING_VERSION); // Get the map timelimit server variable (in minutes) and // multiply it by 60 to get the timelimite in seconds. // new thisMaptime = getvar("mp_timelimit") * 60; // Set up each of the timers. Comment out any you don't want. // // You comment out by adding // to the beginning of the line in front of the function call // // If you comment out or uncomment any line, you must recompile this plugin, place the amx // file in the correct place (cstrike/dlls) and restart the server // //set_timer("warn_forty_minutes", thisMaptime - 2400, 0); // 40-minute (2400 seconds) reminder //set_timer("warn_thrty_minutes", thisMaptime - 1800, 0); // 30-minute (1800 seconds) reminder //set_timer("warn_twtyfv_minutes", thisMaptime - 1500, 0); // 25-minute (1500 seconds) reminder //set_timer("warn_twty_minutes", thisMaptime - 1200, 0); // 20-minute (1200 seconds) reminder set_timer("warn_fift_minutes", thisMaptime - 900, 0); // 15-minute ( 900 seconds) reminder set_timer("warn_ten_minutes", thisMaptime - 600, 0); // 10-minute ( 600 seconds) reminder set_timer("warn_five_minutes", thisMaptime - 300, 0); // 5-minute ( 300 seconds) reminder set_timer("nextmap_three_min", thisMaptime - 180, 0); // 3-minute ( 180 seconds) reminder set_timer("warn_one_minute", thisMaptime - 60, 0); // 1-minute ( 60 seconds) reminder set_timer("nextmap_thirty_sec", thisMaptime - 30, 0); // 30-second reminder //set_timer("warn_ten_seconds", thisMaptime - 10, 0); // 10-second reminder // The plugin executed and the caller should continue. return PLUGIN_CONTINUE; }