/* $id plugin_cavey_psay.sma, v 0.1 18:27 21/02/2002 $ */ #include <core> #include <console> #include <string> #include <admin> #include <adminlib> new STRING_VERSION[MAX_DATA_LENGTH] = "2.50.26"; public admin_pcsay(HLCommand,HLData,HLUserName,UserIndex) { new Command[MAX_COMMAND_LENGTH]; new Data[MAX_DATA_LENGTH]; new Msg[MAX_TEXT_LENGTH]; new Target[MAX_TEXT_LENGTH]; new TargetName[MAX_NAME_LENGTH]; new Text[MAX_TEXT_LENGTH]; new User[MAX_NAME_LENGTH]; convert_string(HLCommand,Command,MAX_COMMAND_LENGTH); convert_string(HLData,Data,MAX_DATA_LENGTH); convert_string(HLUserName,User,MAX_NAME_LENGTH); strbreak(Data, Target, Msg, MAX_TEXT_LENGTH); if (strlen(Msg) == 0) { selfmessage( "Unparsable format: no message found."); return PLUGIN_HANDLED; } else if (check_user(Target) == 0) { selfmessage("Unrecognized player: "); selfmessage(Target); return PLUGIN_HANDLED; } get_username(Target,TargetName,MAX_NAME_LENGTH); snprintf(Text, MAX_TEXT_LENGTH, "(Private Msg to %s): %s", User, Msg); messageex(User, Text, print_chat); if (streq(Command, "admin_pcsay")==1) { messageex(TargetName, Msg, print_pretty); } else if (streq(Command, "admin_ptsay")==1) { messageex(TargetName, Msg, print_tty); } log_command(User,Command,Data); return PLUGIN_HANDLED; } public plugin_init() { plugin_registerinfo("Cavey's private say plugin","Enables private Tsay and Csay",STRING_VERSION); plugin_registercmd("admin_ptsay","admin_pcsay",ACCESS_SAY,"admin_ptsay <User> <Message>: Private typesay to a user"); plugin_registercmd("admin_pcsay","admin_pcsay",ACCESS_SAY,"admin_pcsay <User> <Message>: Private centersay to a user"); return PLUGIN_CONTINUE; }