Ich wollte ein universales Plugin schreiben, doch leider funktioniert der zweite Teil nicht. HL kann nicht zwischen den Namen und den Befehl entscheiden. Der Quellcode sieht folgendermaßen aus:
Code:
/* All commands for Server and Client */
/*$Id: plugin_loser_do.sma,v 1.0 4/14/2004 player ICQ: 172913668 Exp $*/
#include <core>
#include <console>
#include <string>
#include <admin>
#include <adminlib>
#define ACCESS_DO 131071
#define ACCESS_DOTARGET 65023
new STRING_VERSION[MAX_DATA_LENGTH] = "2.51.00";
public admin_dotarget(HLCommand,HLData,HLUserName,UserIndex) {
new Command[MAX_COMMAND_LENGTH];
new Data[MAX_DATA_LENGTH];
new User[MAX_NAME_LENGTH];
new target_user[MAX_DATA_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(target_user) == 1) {
new real_user[MAX_NAME_LENGTH];
get_username(target_user,real_user,MAX_NAME_LENGTH);
say_command(User,Command,real_user);
execclient(real_user, Data);
} else {
selfmessage("Unrecognized player: ");
selfmessage(Data);
}
return PLUGIN_HANDLED;
}
public admin_do(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);
execute_command(User,Command,"",Data);
return PLUGIN_HANDLED;
}
public plugin_init() {
plugin_registerinfo("All DoD commands","Also do commands on a players HL.",STRING_VERSION);
plugin_registercmd("admin_dotarget","admin_dotarget",ACCESS_DO,"admin_dotarget <target> [<data>]: Let you execute commands on the targets HL.");
plugin_registercmd("admin_do","admin_do",ACCESS_DOTARGET,"admin_do <data>: execute every server command on server(for example: exit");
return PLUGIN_CONTINUE;
}
*Code tags bitte beim nächsten Mal nicht vergessen (Sir D.)*