FileManager help
#1

I need help with FileManager 1.2

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/Saved_%s.ini"
   
    if(file_exists(File)) file_delete(File);

    switch(format[0]) {
        case 's', 'z': {
            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
- Floats are at random.
Reply
#2

Still need help, please and thank you.
Reply
#3

pawn Код:
//this is for string to add
new result[128];

            for(new ResultPos = 0; getarg(3, ResultPos) != 0; ResultPos++) {
                Result[ResultPos] = getarg(3, ResultPos);
                StrCat(result,Result,sizeof(result));//or try this StrCat(result,Result[ResultPos],sizeof(result));
            }

            format(String, 100, "%s", result);
and make sure this for float

{Float,_}:...

and here is the tutorial

https://sampforum.blast.hk/showthread.php?tid=77000
Reply
#4

No this did not help. I just made my own file saving system, so this is no longer needed.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)