Geht der Code eventuell besser und ressourcenschonender ?
public OnRconLoginAttempt(ip[],password[],success){
if(!success){
for(new i=0; i<MAX_PLAYERS; i++){
new string[128],hour,minute,second,pip[16];
GetPlayerIp(i,pip,sizeof(pip));
if(!strcmp(ip,pip,true)){
Ban(i);
gettime(hour,minute,second);
format(string,sizeof(string),"Sicherheitsban der IP %s. Verwendetes Passwort: %s. %02d:%02d:%02d.",ip,password,hour,minute,second);
LogCommand(string);
return 1;
}
}
}
return 1;
}
stock LogCommand(event[]){new File:log = fopen("sicherheitsban.txt", io_append); fwrite(log, event); fwrite(log, "\n"); fclose(log);}