30.01.2013, 11:07
(
Последний раз редактировалось denNorske; 30.01.2013 в 12:03.
)
Hi !
My problem is, that when i use /banip [ip adress] [Reason], it creates the file successfully, but the filename is corrupted. The name of the file which should be the IP i entered with the command, is not there, instead the file which get created by the server is named " .ini" only.
So, i have tried to locate the problem myself, but it seemed difficult.
Here is the code the cmd uses:
The INI_unban: (dont care about why it is "unban" but try to read the code)
"unbanadress" is the variable holding the string.
What am i doing wrong?
Thanks in advance!
My problem is, that when i use /banip [ip adress] [Reason], it creates the file successfully, but the filename is corrupted. The name of the file which should be the IP i entered with the command, is not there, instead the file which get created by the server is named " .ini" only.
So, i have tried to locate the problem myself, but it seemed difficult.
Here is the code the cmd uses:
pawn Код:
CMD:banip(playerid, params[])
{
new
reason[128],
year,month,date,
hour,minute,second,
string5[150],
string[160],
INI:acc = INI_Open(INI_unban());
//if(AccInfo[playerid][aLevel] < 4)
// return SendClientMessage(playerid, orange, " |- Only "cgreen"Level 4+"corange" can perform this command -| ");
if(sscanf(params,"s[16]s[128]", unbanadress, reason))
return SendClientMessage(playerid, orange, " - USAGE: "cblue"/BANIP [IP ADRESS] [REASON] "corange"- Will ban the selected IP. Be sure the IP is correct, and that you have a reason ^^ - ");
if(strlen(unbanadress) < 7 || strlen(unbanadress) >15)//checks if it is fewer/too many characters in the string than the ip can normally contain.
return SendClientMessage(playerid, red, " |- The IP is not entered correctly! -| ");
getdate(year, month, date);
gettime(hour,minute,second);
format(string5,sizeof(string5), "Time of ban: Date: %d/%02d/%02d -||- Time: %02d:%02d:%02d",date, month, year, hour, minute, second);
INI_SetTag (acc, "Baninfo");
INI_WriteString(acc, "BanTime", string5);
INI_WriteString(acc, "AdminName", PlayerName(playerid));
INI_WriteString(acc, "BanReason", reason);
INI_Close(acc);
format(string,sizeof(string), "You banned the IP: "cwhite"%s"cblue" Successfully. Be sure it is correct. If not, use \"/UNBANIP %s\" to remove it", unbanadress, unbanadress);
SendClientMessage(playerid, blue, string);
return 1;
}
The INI_unban: (dont care about why it is "unban" but try to read the code)
pawn Код:
stock INI_unban()
{
new file[70];
format(file, sizeof(file), "PowerAdmin/ipbans/%s.ini", unbanadress);
return file;
}
What am i doing wrong?
Thanks in advance!