SA-MP Forums Archive
Score wont save - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Score wont save (/showthread.php?tid=308930)



Score wont save - [NOR]John - 05.01.2012

When we finish a trucking mission and get +1 score, it wont save. It's not there anymore when i relogg. Anyone got an idea how to fix? And money. The money doesn't get saved.


Re: Score wont save - Stigg - 05.01.2012

We need to see the code. That might help.


Re: Score wont save - [NOR]John - 05.01.2012

Quote:
Originally Posted by Stigg
Посмотреть сообщение
We need to see the code. That might help.
What code?


Re: Score wont save - fiki574 - 05.01.2012

Your saving code! (code you use to scan players code and save it)


Re: Score wont save - Stigg - 05.01.2012

Quote:
Originally Posted by [NOR]John
Посмотреть сообщение
What code?
Your mission code Or at least your saving function.
So we can see what the problem might be.


Re: Score wont save - [NOR]John - 05.01.2012

I don't find it.


Re: Score wont save - fiki574 - 05.01.2012

OMFG!!! You cant find saving system in your GM?? Or you use someones other gamemode?


Re: Score wont save - [NOR]John - 05.01.2012

Dude, I am new to pawno, why do you think I ask for help?


Re: Score wont save - Stigg - 05.01.2012

Quote:
Originally Posted by [NOR]John
Посмотреть сообщение
I don't find it.
Your out of luck then.


Re: Score wont save - fiki574 - 05.01.2012

This means you dont even have saving system! Well, try this!

On top of script:
pawn Код:
#include <dini>
OnPlayerSpawn:
pawn Код:
new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    format(File,sizeof(File),"/YourFolder/Players/%s.txt",name);
    if(dini_Exists(File))
    {
        SetPlayerScore(playerid,dini_Int(File,"Score));
        GivePlayerMoney(playerid,dini_Int(File,"
Money"));
    }
    return 1;
}
OnPlayerUpdate:
pawn Код:
new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    format(File,sizeof(File),"/YourFolder/Players/%s.txt",name);
    if(dini_Exists(File))
    {
        dini_IntSet(File,"Score",GetPlayerScore(playerid));
        dini_IntSet(File,"Money",GetPlayerMoney(playerid));
    }
    return 1;
}