• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] possible to create a folder inside scriptfiles?
#1
hello,



title possibly explains exactly what i want. i'm looking to make a function that checks if there is a specific named folder on the scriptfiles folder. if there isn't, then it simply creates that folder. tried searching for a library that could help me but apart from filemanager which probably also doesn't do what i'm asking for i couldn't find anything else. grateful if anyone helps!
  Reply
#2
So you want to check if:

- A directory exists or not

and if not:

- Create it



Quote:apart from filemanager which probably also doesn't do what i'm asking for

What kind of stupid assumption is that? Did you even check out the plugin? It can do exactly what you want:



Code:
if (!dir_exists("scriptfiles/my_directory/"))

{

? ? dir_create("scriptfiles/my_directory/");

}



If you meant you want a function that does both things at once you'd have to create your own function.

And that's as simple as this:

Code:
dir_check(const dirname[])

{

? ? if (!dir_exists(dirname))

? ? {

? ? ? ? dir_create(dirname);

? ? }

}

Code:
dir_check("scriptfiles/my_directory.");



Consider using this one?https://github.com/JarnoKai/SA-MP-FileManager/
  Reply
#3
(2022-09-13, 05:34 AM)Kwarde Wrote: So you want to check if:
- A directory exists or not
and if not:
- Create it

correct.

Quote:What kind of stupid assumption is that? Did you even check out the plugin? It can do exactly what you want:

i did try it but it ended up sending an error message on server start up. here's the error:

Code:
Script[gamemodes/fps.amx]: Run time error 19: "File or function is not found"

and no matter if i use that version
Quote:https://github.com/JarnoKai/SA-MP-FileManager
or JaTochNietDan's version, the error will still pop up, even though there are no errors when compiling.
  Reply
#4
nevermind, i had to install its plugin... thanks for helping anyway
  Reply


Forum Jump: