es ist mal wieder soweit. ich habe einen fehler, dessen herkunft mit ein absolutes rätsel ist
Code:
public plugin_init() {
...
plugin_registercmd("admin_unfake","UnFake",ACCESS_UNFAKE,"admin_unfake: Prints name(s) of all faked players.");
plugin_registercmd("specmode","Connect",ACCESS_ALL); //function called on connect
return PLUGIN_CONTINUE;
}
public Connect(HLCommand,HLData,HLUserName,UserIndex) {
...
g_Admin[UserIndex] = isadmin(UserIndex);
...
return PLUGIN_CONTINUE;
}
public UnFake(HLCommand,HLData,HLUserName,UserIndex) {
new Menutext[512];
new LineData[MAX_DATA_LENGTH];
new Name[MAX_NAME_LENGTH];
new UserName[MAX_NAME_LENGTH];
new Pass[MAX_NAME_LENGTH];
new players[MAX_PLAYERS];
new num_faked;
new pos;
new i,j;
if(!UserIndex) {
selfmessage("This command cannot be used from console.");
return PLUGIN_HANDLED;
}
for(i=1;i<=g_Maxplayers;i++) {
if(g_Lines[i][j] && i != UserIndex) {
if(playerinfo(i,UserName,MAX_NAME_LENGTH)) {
j = 0;
pos = 0;
if(!strncmp(UserName,"[FN]",4)) {
pos = (UserName[4] == ' ') ? 5 : 4;
}
do {
readfile(g_Nicksfile,LineData,g_Lines[i][j++],MAX_DATA_LENGTH);
players[num_faked] = 0;
if(strgsplit(LineData," ","^"","",0,Pass,MAX_NAME_LENGTH,Name,MAX_NAME_LENGTH) == 3) {
if(strcmp(Name,UserName[pos]) == 0) break;
} else if(strcmp(Pass,UserName[pos]) == 0) break;
players[num_faked] = i;
if(j == MAX_NICKS) break;
} while(g_Lines[i][j]);
if(players[num_faked]) num_faked++;
}
}
}
if(!num_faked) {
convert_string(HLUserName,UserName,MAX_NAME_LENGTH);
kill_menu(UserIndex);
menu(UserName,"^n^n^n^n^n^n\yCouldn't find faked players.",1023,0);
return PLUGIN_HANDLED;
}
strcpy(Menutext,"\yFaked players:",512);
for(i=0;i<num_faked;i++) {
strcat(Menutext,"^n\r",512);
playerinfo(players[i],UserName,MAX_NAME_LENGTH);
strcat(Menutext,UserName,512);
strcat(Menutext,"\w",512);
j = 0;
while(g_Lines[players[i]][j]) {
strcat(Menutext,"^n ",512);
readfile(g_Nicksfile,LineData,g_Lines[players[i]][j],MAX_DATA_LENGTH);
j++;
if(strgsplit(LineData," ","^"","",0,Pass,MAX_NAME_LENGTH,Name,MAX_NAME_LENGTH) == 3) {
strcat(Menutext,Name,512);
} else {
strcat(Menutext,Pass,512);
}
}
}
snprintf(UserName,MAX_NAME_LENGTH,"^n^n\y%i players",num_faked);
strcat(Menutext,UserName,512);
convert_string(HLUserName,UserName,MAX_NAME_LENGTH);
kill_menu(UserIndex);
menu(UserName,Menutext,1023,0);
snprintf(Menutext,512,"(Admin) %s used command admin_unfake",UserName);
for(i=1;i<g_Maxplayers;i++) {
if(i != UserIndex && playerinfo(i,Name,MAX_NAME_LENGTH) && access(ACCESS_UNFAKE,Name)) {
messageex(Name,Menutext,print_chat);
}
}
return PLUGIN_HANDLED;
}
isadmin(UserIndex) {
new LineData[MAX_DATA_LENGTH];
new AuthID[MAX_AUTHID_LENGTH];
new Line;
new i;
new result;
while(readfile(g_Nicksfile,LineData,++Line,MAX_DATA_LENGTH) == 1) {
if(!LineData[0] || LineData[0] == '#') continue;
strgsplit(LineData," ","^"",AuthID,MAX_AUTHID_LENGTH);
if(strcmp(AuthID,g_AuthID[UserIndex]) == 0) {
g_Lines[UserIndex][i] = Line;
i++;
if(i == MAX_NICKS) break;
}
}
result = i ? (auth("") ? 2 : 1) : 0;
while(i < MAX_NICKS) {
g_Lines[UserIndex][i] = 0;
i++;
}
return result;
}
es geht um die menüausgabe der unfake-funktion
an den letzten eintrag der liste, egal wieviele gefakte personen auf dem server sind, wird die wonid dieses spielers ohne das erste zeichen angehängt, nicht aber "^n^nxx players", dieser erschein gar nicht. nochmal zur verdeutlichung. wenn ich auf dem server fake, und ein andere admin benutzt das command, sieht er folgendes
\yFaked players:
\rMeinfakenick
\wRinde52676
meine wonid ist 452676
frage: wieso wird statt des "^n^n\y%i players",num_faked
meine wonid angehägt? und dann ohne das erste zeichen?