09.08.2014, 11:48
This command isn't working properly.. please help me fixing it
.
Its not unbanning the IP. this is what it prints:
2 & 3 doesn't print the ip, when it should..

pawn Код:
enum pInfo
{
pIP[16]
}
new PlayerInfo[MAX_PLAYERS][pInfo];
pawn Код:
{
new playerb[32], string[256], file[256], cmdstring[44], ipstring[16];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(PlayerInfo[playerid][pAdmin] < 6) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
if(sscanf(params, "s[32]", playerb)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /uban [name]");
if(RPIDFN(playerb) != INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, "Player is connected to the server.");
format(file, sizeof(file), "UserDB/%s.ini", playerb);
if(!dini_Exists(file)) return SendClientMessage(playerid, COLOR_GREY, "Player name not found.");
new INI:File = INI_Open(file);
INI_SetTag(File,"PlayerData");
INI_WriteString(File, "BanReason", "None");
INI_WriteString(File, "BannedBy", "None");
INI_WriteInt(File, "Banned", 0);
INI_Close(File);
INI_ParseFile(file, "LoadIP_%s", .bExtra = true , .extra = playerid);
printf("1) %s", file);
format(ipstring, sizeof(ipstring), "%s", PlayerInfo[playerid][pIP]);
new File:ban = fopen("ban.cfg", io_read);
new idx = 1;
while(fread(ban, ipstring))
{
if(!strcmp(ipstring, string, true, strlen(ipstring)))
{
fdeleteline("ban.cfg", idx);
//done = 1;
}
idx++;
}
fclose(ban);
printf("2) %s", ipstring);
//if(!done) return SendClientMessage(playerid, COLOR_GREY, "IP is not banned.");
format(cmdstring, sizeof(cmdstring), "unbanip %s", ipstring);
SendRconCommand(cmdstring);
printf("3) %s", cmdstring);
SendRconCommand("reloadbans");
format(string, sizeof(string), "{F81414}AdmWarn: %s has {DAE368}unbanned{F81414} %s [IP: %s].", RPN(playerid), playerb, ipstring);
SendClientMessageToAll(COLOR_YELLOW, string);
//SendAdminMessage(COLOR_DARKRED, 1, string);
return 1;
}
pawn Код:
forward LoadIP_data(playerid,name[],value[]);
public LoadIP_data(playerid,name[],value[])
{
INI_String("IP", PlayerInfo[playerid][pIP], 16);
return 1;
}
pawn Код:
[14:46:34] 1) UserDB/Ricardo_James.ini
[14:46:34] 2)
[14:46:34] 3) unbanip