[Plugin] [REL] FileManager 1.4 (24th of June 2012)

solved
Reply

Best plug-in ever!
Reply

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
Could I do this with this system?

pawn Код:
file_delete("gamemodes\filename.amx")
EDIT: It only works if I do this:

pawn Код:
file_delete("gamemodes/filename.amx");
Will this not work on Linux due to there needing to be a forward slash, instead of a backwards slash?
In this context, you only use forward slashes for either Operating System, as a blackslash is used as an escape character in most programming languages, including PAWN.

http://en.wikipedia.org/wiki/Backslash#Usage

Quote:
Originally Posted by SVRP
Посмотреть сообщение
Does the plugin support subfolders?
I want to create a directory within a directory, but when I perform the code the server shuts down because it can't create a file within the directory because the directory doesn't exists, and hasn't been created.

So, would this peace of code work?
pawn Код:
public createFolder(string[])
    {
        new dir[];
        format(dir, sizeof(dir), "folders/custom/%s",string);
        if(!dir_exists(dir))
        {
            dir_create(dir);
        }
        return 1;
    }
You will need to make sure that all of the directories above the subdirectory exist before trying to create it.

Quote:
Originally Posted by kizla
Посмотреть сообщение
is this a fastes thing with file,, for creating and reading?
There have been benchmarks performed throughout the forums between several "file systems". I cannot give you a definitive answer as I have not personally tested it myself. I can say that the benchmarks done seemed generally favourable of this plugin in certain situations.
Reply

i like this because some Server_Owners can not buy a vps or a Dedicated Server or even a server host where they give you a File Manager good job on this JaTochNietDan and keep up the good work bro +Reputation for you on this to That's All Thanks Again From Founder Tom_Fox Server_Owner Of Tom's Games Servers http://www.tomsgameservers.com
Reply

So I just downloaded the FileManager plugin and put it in my plugins folder, and added it to the plugins line in my server config. But what else do I need to do so that I can use the functions it has?
Reply

Quote:
Originally Posted by Dennis_Smith
Посмотреть сообщение
So I just downloaded the FileManager plugin and put it in my plugins folder, and added it to the plugins line in my server config. But what else do I need to do so that I can use the functions it has?
Put the include file in your pawno/includes directory and then include it in the project that you are working on. You can then use any functions that the plugin provides as intended.
Reply

Why doesn't this work? The file does exist with "Text" in it but doesn't return true.

Код:
if(!file_read("Dennis_Smith.txt","Text"))
	{
	   	print("Found file");
	}
Reply

Quote:
Originally Posted by Dennis_Smith
Посмотреть сообщение
Why doesn't this work? The file does exist with "Text" in it but doesn't return true.

Код:
if(!file_read("Dennis_Smith.txt","Text"))
	{
	   	print("Found file");
	}
That's not how file_read is intended to be used, the second argument of file_read is where you put an array to store the data that is read from the text file. For example:

pawn Код:
new str[48];

file_read("Dennis_Smith.txt", str);

if(!strcmp(str, "Text")) print("Found file");
Reply

Why is this not working correctly? Am I indexing the file wrong? The folders are already existing.

Код:
file_create("scriptfiles/users/Dennis_Smith.txt");
Reply

What am I doing wrong?

pawn Код:
stock SaveServer(Stat[], format[], {Float,_}) {
    if(!dir_exists("Saved/")) dir_create("Saved/");
   
    if(!dir_exists("Saved/Server/")) dir_create("Saved/Server/");
   
    new File[100],
        String[100];

    format(File, 100, ServerFile, Stat); // #define ServerFile    "Saved/Server/%s.ini"
   
    if(file_exists(File)) file_delete(File);

    switch(format[0]) {
        case 's': {
            new Result[100];

            for(new ResultPos = 0; getarg(3, ResultPos) != 0; ResultPos++) {
                Result[ResultPos] = getarg(3, ResultPos);
            }

            format(String, 100, "%s", Result);
        }
        case 'd', 'i': {
            new Result = getarg(3);
            format(String, 100, "%d", Result);
        }
        case 'f': {
            new Float: Result = Float: getarg(3);

            format(String, 100, "%f", Result);
        }
    }

    file_create(File);
    file_write(File, String);
    printf("%s", String);
    return true;
}
When it saves, it doesn't save the correct value.

Edit:
I've noticed:
- All strings save as 0€
- All values save as 35120
Reply

Updated to 1.3
  • Cleaned up the code
  • Fixed some minor return issues with file_read
  • Added file_copy - Requested function
  • Added a way to read files line by line - Requested feature
  • Added more comprehensible documentation
So you can now read from a file line by line, this was requested to me a couple of times. Here is an example of how to do it:

pawn Код:
new File: f = f_open("server.cfg"); // Open the file.
new string[100];

while(f_read(f, string)) // Returns true when a line is found
    print(string); // Will print each line of the server.cfg

f_close(f); // Make sure to close the file.
Also there was a request for a file_copy function, so that has also been added. It is the same as file_move except it copies the file.
Reply

I think this plugin may be usefull to help making security systems against GM stealing.

For example: you can load ur full GM as a Filterscript and then unload it and delete it if needed.
Reply

I do not know if it was already suggested, but an readdir() cannot be made? to read files info from a dir.
Reply

Quote:
Originally Posted by Mandrakke
Посмотреть сообщение
I do not know if it was already suggested, but an readdir() cannot be made? to read files info from a dir.
Your wish has been granted.

Update
  • dir_open, dir_close and dir_list have been added for listing a directory functionality, as requested
Reply

oh cool updates
thanks for it >: )
Reply

holy sh*t, finally a dir_list function


I once made one myself but this one is better
Reply

Quote:
Originally Posted by Rancho
Посмотреть сообщение
Nice but, f_write isn't so healthy.Because every f_write opens file, writes it, closes file.

I think that, f_write must be with f_open.
Update 1.5
  • Added f_write for use with f_open
Example to write to a file (wipes previous information in it)

pawn Код:
new File:file = f_open("horse.txt", "w");

fwrite("Welcome");
fwrite(" horses");

fclose(file);
Reply

FileManager 1.5.
Windows XP.
Error: "The procedure entry point GetTickCount64 could not be located in the dynamic link library KERNEL32.dll".
Reply

Nice work
Reply

I get this error whenever I start the server with this plugin:

"The procedure entry point GetTickCount64 could not be located in the dynamic link library KERNEL32.dll."



Using Windows XP Home Edition 32 bit, Service Pack 3.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)