PDA

View Full Version : WARNING: refusing to create relative path



Ni3ls
26th October 2015, 17:45
Hi all,

I want to create a file that contains part of a players ip. In this way I can check the players ip to a "banned" ip.

ipbanplayer(admin, reden,id, ip)
{
wait 1;
checkip = GetSubStr( ip, 0, 8 );
file = openfile("bans/ip/"+checkip+".txt","write");
if (file != -1)
{
fprintln(file, reden);
fprintln(file, self.name);
fprintln(file, admin.pers["loginname"]);
fprintln(file, ip);
closefile(file);
admin iprintlnbold("Banned "+self.name+ "!\nIP: " + ip + " | Reason: " + reden);
}
}
However, I get this weird error

WARNING: refusing to create relative path "/path/to/.callofduty2/test/scriptdata/bans/ip/217.103..txt"

How to solve this?

kung foo man
26th October 2015, 23:50
I never used openfile/closefile a lot, but I suspect it could be two things:

1) Either no sub-dirs allowed, so try openfile(checkip+".txt","write") instead of openfile("bans/ip/"+checkip+".txt","write")
2) Or the .. is interpreted as "evil", hence just remove double-dots (use u nice strtok(...) to split IP)

Prolly overused ... lel

IzNoGoD
27th October 2015, 01:04
its 2).
Also, why are you getting the substr of an ip? Just save the entire ip....

And its just the .. part, you can put whatever amount of dots in the filename, as long as there's not 2 dots right behind one another

Ni3ls
27th October 2015, 08:08
Because ppl change IP, mostly only the last part. Thats why i want to store only the first part. Ok i will try to fix this!

IzNoGoD
27th October 2015, 10:18
Check this instead:
http://killtube.org/showthread.php?2361-IP-range&p=12834#post12834

ban by /24