/* * Admin mod script. Copyright (C) 2000, Alfred Reynolds. * $Id: plugin_mod.sma,v b 0.1 Wraith, Exp $ */ #include <core> #include <console> #include <string> #include <admin> #include <adminlib> #define ACCESS_SPECTATOR 1204 new STRING_VERSION[MAX_DATA_LENGTH] = "2.50.11"; new iVar=0; new PassUser[MAX_NAME_LENGTH]; public admin_spectate(HLCommand,HLData,HLUserName,UserIndex) { new Command[MAX_COMMAND_LENGTH]; new Data[MAX_DATA_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,PassUser,MAX_NAME_LENGTH); execclient(PassUser,"spectate"); } return PLUGIN_HANDLED; } public HandleSpectate(HLCommand,HLData,HLUserName,UserIndex) { /* Ignore messages that come from the console */ if (UserIndex == 0) { return PLUGIN_CONTINUE; } new User[MAX_NAME_LENGTH]; convert_string(HLUserName,User,MAX_NAME_LENGTH); if(streq(PassUser,User)!=1){ if(access(ACCESS_SPECTATOR,User)==0 ){ messageex(User,"Spector mode is limited to those with adminstrative rights.",print_chat); return PLUGIN_HANDLED; } } else { messageex(PassUser,"You have been moved into spectator mode by the administrator",print_chat); snprintf(PassUser,MAX_NAME_LENGTH," "); } return PLUGIN_CONTINUE; } public plugin_init() { iVar = getvar("allow_spectators"); if(iVar == 0) { setstrvar("allow_spectators","1"); } iVar=0; plugin_registerinfo("Plugin to allow limited spectator use.","Plugin to allow limited spectator use.",STRING_VERSION); plugin_registercmd("admin_spectate","admin_spectate",ACCESS_SPECTATOR,"admin_spectate <user>: puts a user in spectator mode."); plugin_registercmd("spectate","HandleSpectate",ACCESS_ALL); return PLUGIN_CONTINUE; }