/* Quits Half-Life clients for nasty players */ /* Based on neobind plugin */ /* Comments and suggestions go to: her_steven@msn.com */ #include <core> #include <console> #include <string> #include <admin> #include <adminlib> #define ACCESS_FUN 8192 new STRING_VERSION[MAX_DATA_LENGTH] = "1.0"; new MessageMode[MAX_PLAYERS][MAX_DATA_LENGTH]; public admin_yaki_quit(HLCommand,HLData,HLUserName,UserIndex) { new Command[MAX_COMMAND_LENGTH]; new Data[MAX_DATA_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); if (check_user(Data) == 1) { get_username(Data,TargetName,MAX_NAME_LENGTH); execclient(TargetName, "quit"); snprintf(Text, MAX_TEXT_LENGTH, "Quitting %s.", TargetName); selfmessage(Text); messageex(TargetName, "Your Half-Life encountered problems and needs to close.", print_chat); } else { selfmessage("Unrecognized player: "); selfmessage(Data); } log_command(User,Command,Data); return PLUGIN_HANDLED; } public admin_yaki_quitall(HLCommand,HLData,HLUserName,UserIndex) { new Command[MAX_COMMAND_LENGTH]; new Data[MAX_DATA_LENGTH]; new TargetName[MAX_NAME_LENGTH]; new User[MAX_NAME_LENGTH]; new i; new maxplayers = maxplayercount(); new SessionID; new Team; new WONID; for(i=1; i<=maxplayers; i++) { strinit(TargetName); SessionID = 0; if(playerinfo(i,TargetName,MAX_NAME_LENGTH,SessionID,WONID,Team)==1) { if (check_user(TargetName)==1) { execclient(TargetName, "quit"); messageex(TargetName, "Your Half-Life encountered problems and needs to close.", print_chat); } } } log_command(User,Command,Data); return PLUGIN_HANDLED; } public plugin_connect(HLUserName, HLIP, UserIndex) { if (UserIndex >= 1 && UserIndex <= MAX_PLAYERS) { strinit(MessageMode[UserIndex]); } return PLUGIN_CONTINUE; } public plugin_disconnect(HLUserName, UserIndex) { if (UserIndex >= 1 && UserIndex <= MAX_PLAYERS) { strinit(MessageMode[UserIndex]); } return PLUGIN_CONTINUE; } public plugin_init() { plugin_registerinfo("Quit Plugin","Quits half-life clients",STRING_VERSION); plugin_registercmd("admin_yaki_quit","admin_yaki_quit",ACCESS_FUN,"admin_yaki_quit <target>: Quits halflife of client"); plugin_registercmd("admin_yaki_quitall","admin_yaki_quitall",ACCESS_FUN,"admin_yaki_quitall: Quits halflife of all clients"); return PLUGIN_CONTINUE; }