/* Plugin to help newbies bind neotf commands */ /* email me for any suggestions at MarlinThai15@Yahoo.com */ #include <core> #include <console> #include <string> #include <admin> #include <adminlib> #define ACCESS_FUN 8192 new STRING_VERSION[MAX_DATA_LENGTH] = "2.50.0"; new MessageMode[MAX_PLAYERS][MAX_DATA_LENGTH]; public admin_neobind(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, "bind p _special2"); execclient(TargetName, "bind \ buildspecial2"); execclient(TargetName, "bind l +hook"); execclient(TargetName, "bind k buildspecial"); execclient(TargetName, "bind o detspecial"); execclient(TargetName, "bind v tele"); snprintf(Text, MAX_TEXT_LENGTH, "Binding Neotf keys for %s.", TargetName); selfmessage(Text); messageex(TargetName, "p=builds default specials, \=builds secondary, o=detonates", print_chat); messageex(TargetName, "v=Teleport With Scouts Disk, l=Hook, k=Scouts Disk", print_chat); } else { selfmessage("Unrecognized player: "); selfmessage(Data); } log_command(User,Command,Data); return PLUGIN_HANDLED; } public admin_neobindall(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, "bind p _special2"); execclient(TargetName, "bind \ buildspecial2"); execclient(TargetName, "bind l +hook"); execclient(TargetName, "bind k buildspecial"); execclient(TargetName, "bind o detspecial"); execclient(TargetName, "bind v tele"); messageex(TargetName, "p=builds default specials, \=builds secondary, o=detonates", print_chat); messageex(TargetName, "v=Teleport With Scouts Disk, l=Hook, k=Scouts Disk", print_chat); } } } log_command(User,Command,Data); return PLUGIN_HANDLED; } public admin_neobindme(HLCommand,HLData,HLUserName,UserIndex) { new Command[MAX_COMMAND_LENGTH]; new Data[MAX_DATA_LENGTH]; new User[MAX_NAME_LENGTH]; convert_string(HLCommand,Command,MAX_NAME_LENGTH); convert_string(HLData,Data,MAX_NAME_LENGTH); convert_string(HLUserName,User,MAX_NAME_LENGTH); execclient(User, "bind p _special2"); execclient(User, "bind \ buildspecial2"); execclient(User, "bind l +hook"); execclient(User, "bind k buildspecial"); execclient(User, "bind o detspecial"); execclient(User, "bind v tele"); messageex(User, "p=builds default specials, \=builds secondary, o=detonates", print_chat); messageex(User, "v=Teleport With Scouts Disk, l=hook, k=Builds Scouts Disk", print_chat); log_command(User,Command,Data); return PLUGIN_HANDLED; } public HandleSay(HLCommand,HLData,HLUserName,UserIndex) { new Command[MAX_COMMAND_LENGTH]; new Data[MAX_DATA_LENGTH]; new User[MAX_NAME_LENGTH]; new Text[MAX_TEXT_LENGTH]; convert_string(HLCommand,Command,MAX_COMMAND_LENGTH); convert_string(HLData,Data,MAX_DATA_LENGTH); convert_string(HLUserName,User,MAX_NAME_LENGTH); strstripquotes(Data); if (strlen(MessageMode[UserIndex]) != 0 && UserIndex != 0) { if ( strcasestr(MessageMode[UserIndex], "admin_") >= 0 ) { // admin_* command plugin_exec( MessageMode[UserIndex], Data ); return PLUGIN_HANDLED; } else { // HL or MOD command snprintf(Text, MAX_TEXT_LENGTH, "%s %s", MessageMode[UserIndex], Data); execclient(User,Text); return PLUGIN_HANDLED; } } if (streq(Data, "neobindme")==1) { execclient(User, "admin_neobindme"); } return PLUGIN_CONTINUE; } 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("neobind Plugin","Binds keys needed for neotf commands",STRING_VERSION); plugin_registercmd("admin_neobind","admin_neobind",ACCESS_FUN,"admin_neobind <target>: Binds neotf commands for target client"); plugin_registercmd("admin_neobindall","admin_neobindall",ACCESS_FUN,"admin_neobindall: Binds neotf commands for all clients"); plugin_registercmd("admin_neobindme","admin_neobindme",ACCESS_ALL,"admin_neobindme: Binds neotf commands for client"); plugin_registercmd("say","HandleSay",ACCESS_ALL); plugin_registerhelp("say",ACCESS_ALL,"say neobindme: Binds neo-tf commands for client"); return PLUGIN_CONTINUE; }