Und so sieht das ganze aus, wenn ich es umschreiben muesste. (Was ich hiermit getan habe, damit das ein Ende hat).
Code:
#include <core>
#include <string>
#include <admin>
#include <adminlib>
new STRING_VERSION[] = "2.50.1";
public eingabe(HLCommand, HLData, HLUserName, UserIndex)
{
new Command[MAX_COMMAND_LENGTH];
new Speech[MAX_DATA_LENGTH];
new User[MAX_NAME_LENGTH];
new Text[MAX_TEXT_LENGTH];
new maxplayers = maxplayercount();
new i;
new Name[MAX_NAME_LENGTH];
new SessionID;
new Team;
new WONID;
new admincheck = false;
new Map[MAX_NAME_LENGTH];
new ip[18];
new port[7];
currentmap(Map, MAX_NAME_LENGTH);
convert_string(HLCommand, Command, MAX_COMMAND_LENGTH);
convert_string(HLData, Speech, MAX_DATA_LENGTH);
convert_string(HLUserName, User, MAX_NAME_LENGTH];
strstripquotes(Speech);
/* Check for 'ff' */
if ( strcasestr(Speech, "ff") == 0 ) {
if ( getvar("mp_friendlyfire") == 1 ) {
say("Friendly fire is ON. ! DANGER !");
} else {
say("Friendly fire is OFF. *puh*");
}
return PLUGIN_HANDLED;
}
/* Check for 'admin' */
if ( strcasestr(Speech, "admin") == 0 ) {
for (i = 1; i <= maxplayers; i++) {
strinit(Name);
if ( playerinfo(i, Name, MAX_NAME_LENGTH, SessionID, WONID, Team) == 1 ) {
if ( access(ACCESS_VOTE_MAP, Name) != 0 ) {
snprintf( Text, MAX_TEXT_LENGTH, "%s, %s", Text, Name );
admincheck = true;
}
}
}
if (admincheck) {
snprintf(Text, MAX_TEXT_LENGTH, "Anwesende Admins:^n%s", Text);
say(Text);
} else {
say("Keine Admins anwesend.");
}
return PLUGIN_HANDLED;
}
/* Check for 'serverip' */
if ( strcasestr(Speech, "serverip") == 0 ) {
get_vaultdata("serverip", ip, sizeof(ip));
get_vaultdata("serverport", port, sizeof(port));
snprintf(Text, MAX_TEXT_LENGTH, "IP des Servers ist: %s:%s", ip, port);
say(Text);
return PLUGIN_HANDLED;
}
/* Check for 'map' */
if (strcasestr(Speech, "map") == 0 ) {
snprintf(Text, MAX_TEXT_LENGTH, "Derzeitiege Map: %s", Map);
say(Text);
return PLUGIN_HANDLED;
}
/* Check for profanity */
if (strcasestr(Speech, "lamer") != -1 && access(ACCESS_VOTE_MAP, Name) == 0) {
snprintf(Text, MAX_TEXT_LENGTH," ^"%s^" 2", User);
plugin_exec("admin_gag", Text);
snprintf(Text, MAX_TEXT_LENGTH, "[ADMIN]: %s ist fuer 2min geknebelt.", User);
say(Text);
return PLUGIN_HANDLED;
}
return PLUGIN_CONTINUE;
}
public plugin_init()
{
plugin_registerinfo("Admin abfrage","Codet bei MrSpoocy www.foc-clan.de", STRING_VERSION);
plugin_registercmd("say", "eingabe", ACCESS_ALL,
"Dieses script reagiert auf chateingaben. ff,admin,serverip,map");
plugin_registercmd("say_team", "eingabe", ACCESS_ALL,
"Dieses script reagiert auf chateingaben. ff,admin,serverip,map");
return PLUGIN_CONTINUE;
}
Ist teilweise getestet und laeuft.