21.02.2013, 21:31
Okay, I made a /unbanacc command which allows you to unban someone ofc. I used the same function as /unbanip and that works but here is doesn't. Whats it doing? = Opening the users file searching for the pIP = xx.xx.xx.xx and then Sends a rcon command to unban the ip. It's just not working. It sends me the message of "unbanip xx.xx.xx.xx" but doesn't unban through the samp.ban file.
pawn Код:
CMD:unbanacc(playerid, params[])
{
if(isnull(params)) {
return SendClientMessage(playerid, -1, "Usage: /unbanacc [PlayerFile]");
}
new filename[MAX_PLAYER_NAME+18];
format(filename, sizeof(filename), "/ZMA/Users/%s.ini", params);
if(!fexist(filename)) {
return SendClientMessage(playerid, -1, "That account doesn't exist!");
}
new
File:file = fopen(filename, io_read),
string[128],
Name[20],
Value[128],
cash;
while(fread(file, string)) {
if(!sscanf(string, "p<=>s[20]s[128]", Name, Value)) {
if(!strcmp(Name, "pIP ")) {
cash = strval(Value);
format(string, sizeof(string), "unbanip%s", cash);
SendClientMessage(playerid, -1, string);
SendRconCommand(string);
SendRconCommand("reloadbans");
break;
}
}
}
return true;
}