/********************************************************* * A IRC action plugin - Version 0.8 * ********************************************************* * * * Name: plugin_rindy_ircaction * * Author: Rinde (rinde@fiatnox.de) * * Released: 15/11/02 * * * * Credits: Idea and original code by greinder. I only * * added support for teamsay * * * * * * Commands: * * * * say "/me <action>": Converts say to IRC style action * * * * * * Changelog: * * * * Version 0.8 * * * * - Initial release * * * *********************************************************/ /* Includes */ #include <core> #include <console> #include <string> #include <plugin> #include <admin> #include <adminlib> /* Global Variables */ new g_Version[]="0.8"; /* Function Declarations */ forward HandleSay(HLCommand,HLData,HLUserName,UserIndex); /* Event Handlers */ public plugin_init() { plugin_registerinfo("IRC Action Plugin","Converts say to IRC type actions by typing /me <action>.",g_Version); plugin_registercmd("say","HandleSay",ACCESS_ALL); plugin_registercmd("say_team","HandleSay",ACCESS_ALL); plugin_registerhelp("say",ACCESS_ALL,"say /me <action>: Converts say to IRC style action."); return PLUGIN_CONTINUE; } /* Command Handlers */ public HandleSay(HLCommand, HLData, HLUserName, UserIndex) { new Command[MAX_COMMAND_LENGTH]; new Data[120]; new User[MAX_NAME_LENGTH]; new Text[MAX_TEXT_LENGTH]; new maxplayers = maxplayercount(); new UserTeam,ListenTeam; new UserDead,ListenDead; new Teamsay; new i; convert_string(HLData,Data,120); strstripquotes(Data); if(strncmp(Data,"/me",3) == 0 && (Data[3] == ' ' || Data[3] == 0)) { if(playerinfo(UserIndex,User,MAX_NAME_LENGTH,_,_,UserTeam,UserDead)) { convert_string(HLCommand,Command,MAX_COMMAND_LENGTH); Teamsay = strcmp(Command,"say"); if(Teamsay == 0) { snprintf(Text,MAX_TEXT_LENGTH,"*%s %s",User,Data[4]); } else { snprintf(Text,MAX_TEXT_LENGTH,"*(Team) %s %s",User,Data[4]); } for(i=1;i<=maxplayers;i++) { if(playerinfo(i,User,MAX_NAME_LENGTH,_,_,ListenTeam,ListenDead) && UserDead == ListenDead && (UserTeam == ListenTeam || Teamsay == 0)) { messageex(User,Text,print_chat); } } } return PLUGIN_HANDLED; } return PLUGIN_CONTINUE; }