Y_INI: no name of the created file? -
denNorske - 30.01.2013
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:
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;
}
"unbanadress" is the variable holding the string.
What am i doing wrong?
Thanks in advance!
Re: Y_INI: no name of the file, only .INI -
Roach_ - 30.01.2013
What is
unbanaddress ?
Re: Y_INI: no name of the file, only .INI -
denNorske - 31.01.2013
Quote:
Originally Posted by Roach_
What is unbanaddress ?
|
"unbanadress" is the variable holding the string. (the ip i entered as a parameter)
On top of the script, it is defined as
i am using the same string that i am using to hold the string for /unbanip. So don't care about why it is named like that
Is anyone familiar with getting only .ini files ? without a name, the name of the .ini is blank? Really annoying..
EDIT!
The variable is saved after prosessing the command, so the Y_ini didn't have a name to wirte
So next time i used the command the ip from last time got banned.
FIXED ^^