/*************************************************************************** * plugin_angrysand_tod.sma Date: 05/09/2002 * * Written by Angrysand (angrysand@boneville.net) * * many thanks to Sank and Eric; i spent quite some time learning this * admin-mod scripting stuff from looking at their scripts * * * This plugin lets people do a "say time" to get the * server's current time of day. **************************************************************************/ //access required to get the time of day #define ACCESS_TOD 0 /****************************************************************************/ /************** DO NOT MODIFY CONTENTS BELOW THIS LINE !!! ******************/ /****************************************************************************/ #include <core> #include <console> #include <string> #include <admin> #include <adminlib> new STRING_VERSION[MAX_DATA_LENGTH] = "1.00"; new THour[MAX_DATA_LENGTH]; new TMinute[MAX_DATA_LENGTH]; new TValue[MAX_DATA_LENGTH]; new TWDay[MAX_DATA_LENGTH]; new TMonth[MAX_DATA_LENGTH]; new TDay[MAX_DATA_LENGTH]; new TYear[MAX_DATA_LENGTH]; /****************************************************************************/ /************************** Plugin Entry Point ******************************/ /****************************************************************************/ public plugin_init() { plugin_registerinfo("Time of Day Plugin", "Prints the current time of day", STRING_VERSION); plugin_registercmd("say", "HandleSay", ACCESS_TOD); return PLUGIN_CONTINUE; } public HandleSay(HLCommand, HLData, HLUserName, UserIndex) { new Data[MAX_DATA_LENGTH]; new Text[MAX_TEXT_LENGTH]; new Key[MAX_TEXT_LENGTH] = "time"; new Red = random(256); new Green = random(256); new Blue = random(256); //prep the incoming data convert_string(HLData, Data, MAX_DATA_LENGTH); strstripquotes(Data); if(strncasecmp(Data, Key, 4) == 0) { //get current time servertime(THour, MAX_DATA_LENGTH, "%I"); servertime(TMinute, MAX_DATA_LENGTH, "%M"); servertime(TValue, MAX_DATA_LENGTH, "%p"); servertime(TWDay, MAX_DATA_LENGTH, "%A"); servertime(TMonth, MAX_DATA_LENGTH, "%B"); servertime(TDay, MAX_DATA_LENGTH, "%d"); servertime(TYear, MAX_DATA_LENGTH, "%Y"); snprintf(Text, MAX_TEXT_LENGTH, "The server thinks it is %s, %s %s, %s. %s:%s %s", TWDay, TMonth, TDay, TYear, THour, TMinute, TValue); typesay(Text, 5, Red, Green, Blue); } return PLUGIN_CONTINUE; }