18.11.2009, 10:44
I'm trying to delete the accounts banned. But when this function opens the file, some accounts have the value 1 or 0. But when he finds the value 1 it does not delete the account but sends the printf.
Код:
new cmdt[256];
new idx;
cmdt = strtok(cmd, idx);
if(strcmp(cmd,"delbans",true)==0){
new File:fp = fopen("allplayers.txt", io_read), tmp[128];
while(fread(fp, tmp, sizeof tmp)){
printf("Player File: %s", tmp);
new File:file=fopen(PlayerFile(tmp),io_read);
new valor = strval(GetValue(PlayerFile(tmp),"Ban"));
printf("Ban Value: %d", valor);
if(valor == 1){
fremove(PlayerFile(tmp));
printf("ACC %s deleted", tmp);
}
fclose(file);
}
}
Код:
stock PlayerFile(name[]){
new str[50];
format(str,sizeof(str),"Players/%s",name);
return str;
}

