Results 1 to 5 of 5

Thread: WARNING: refusing to create relative path

  1. #1
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,012
    Thanks
    440
    Thanked 171 Times in 132 Posts

    WARNING: refusing to create relative path

    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.
    Code:
    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
    Code:
    WARNING: refusing to create relative path "/path/to/.callofduty2/test/scriptdata/bans/ip/217.103..txt"
    How to solve this?

  2. #2
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,011
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    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 [c]...[/c] lel
    timescale 0.01

  3. The Following User Says Thank You to kung foo man For This Useful Post:

    Ni3ls (27th October 2015)

  4. #3
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    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
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  5. The Following User Says Thank You to IzNoGoD For This Useful Post:

    Ni3ls (27th October 2015)

  6. #4
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,012
    Thanks
    440
    Thanked 171 Times in 132 Posts
    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!

  7. #5
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  8. The Following User Says Thank You to IzNoGoD For This Useful Post:

    Ni3ls (27th October 2015)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •