ist das hier als ausgangspunkt zu gebrauchen?
Code:
/* plugin_rindy_admins: Responds to the chatmessage
"admin" with the names of all admins on server.
Written by Rinde (rinde@fetter-gehts-nicht.de)
visit www.fetter-gehts-nicht.de */
#include <string>
#include <admin>
#include <adminlib>
new STRING_VERSION[MAX_DATA_LENGTH] = "2.50.50";
public HandleSay(HLCommand,HLData,HLUserName,UserIndex) {
new Data[MAX_DATA_LENGTH];
new Name[MAX_NAME_LENGTH];
new Message[255];
new default_access = getvar("default_access");
new MaxPlayers = maxplayercount()+1;
new Admins = 0;
new i;
convert_string(HLData,Data,MAX_DATA_LENGTH);
strstripquotes(Data);
if(strcasecmp(Data,"admin") == 0) {
strcpy(Message,"Admins:\n",255);
for(i=1;i<MaxPlayers;i++) {
if(playerinfo(i,Name,MAX_NAME_LENGTH) == 1) {
if(get_accesslevel(Name) != default_access) {
Admins++;
strcat(Message,"\n ",255);
strcat(Message,Name,255);
}
}
}
if(Admins > 0) {
snprintf(Data,MAX_DATA_LENGTH,"\n\n %i Admins",Admins);
strcat(Message,Data,255);
} else {
strcpy(Message,"Currently there are no admins on the server.",255);
}
convert_string(HLUserName,Name,MAX_NAME_LENGTH);
messageex(Name,Message,print_tty);
return PLUGIN_HANDLED;
}
return PLUGIN_CONTINUE;
}
get_accesslevel(UserName[MAX_NAME_LENGTH]) {
new accesslevel = 0;
new i;
for(i=1;i<=131072;i*=2) {
if(access(i,UserName) == 1) {
accesslevel += i;
}
}
return accesslevel;
}
public plugin_init() {
plugin_registerinfo("Rinde's Admin Plugin","Returns all admins on server",STRING_VERSION);
plugin_registercmd("say","HandleSay",ACCESS_ALL,"say admin: Prints all admins and their adminlevels.");
return PLUGIN_CONTINUE;
}