SA-MP Forums Archive
Stat saving methods? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Stat saving methods? (/showthread.php?tid=111166)



Stat saving methods? - ReFuSeR - 30.11.2009

Hello everyone, I have a question...

What are the best methods of saving player stats?(so stats aren't lost in server crash or GMX) Timers? OnPlayerUpdate? What is the best method that is servercrashfree?

Another question, I am dealing with a very badly indented script that is 22k+ lines. Is there some kinda way to indent the script correctly automatically?


Re: Stat saving methods? - dre$tA - 30.11.2009

Quote:
Originally Posted by ReFuSeR
Hello everyone, I have a question...

What are the best methods of saving player stats?(so stats aren't lost in server crash or GMX) Timers? OnPlayerUpdate? What is the best method that is servercrashfree?

Another question, I am dealing with a very badly indented script that is 22k+ lines. Is there some kinda way to indent the script correctly automatically?
Dunno about the crashing, but you could make your own command for GMX which saves players accounts first, then starts a 2 second timer that restarts the server.

There is a program called Pawn Studio, which has auto indentation in it.


Re: Stat saving methods? - ReFuSeR - 30.11.2009

Quote:
Originally Posted by dre$tA
Quote:
Originally Posted by ReFuSeR
Hello everyone, I have a question...

What are the best methods of saving player stats?(so stats aren't lost in server crash or GMX) Timers? OnPlayerUpdate? What is the best method that is servercrashfree?

Another question, I am dealing with a very badly indented script that is 22k+ lines. Is there some kinda way to indent the script correctly automatically?
Dunno about the crashing, but you could make your own command for GMX which saves players accounts first, then starts a 2 second timer that restarts the server.

There is a program called Pawn Studio, which has auto indentation in it.
Thank you so much for the information on Pawn Studio. This program rocks...


Any other suggestions for saving stats on GMX and servercrash?


Re: Stat saving methods? - Giacomand - 30.11.2009

You could save the player's stats every three seconds.


Re: Stat saving methods? - Kinetic - 30.11.2009

Quote:
Originally Posted by Giacomand
You could save the player's stats every three seconds.
LOL that would take a lot of resources on a large server. And all you gotta do is save the player files often. try like every 5 minutes. nobody is going to get upset if the server crashes and they lose 5 minutes worth of gameplay.


Re: Stat saving methods? - ReFuSeR - 30.11.2009

Thanks for your input...


Anyone else have some good methods?


Is their a method where people absolutely don't lose anything when server crash? Is there a callback that I yet to hear of? "OnServerCrash?"



I will search the forums abit more to see if I can run across anything useful.




Re: Stat saving methods? - miokie - 30.11.2009

Maybe just make it so whenever something happens to a player stats update it to the file automatically, Example:

In a command you earn $100, At the end of the command Write the line of which you save the players money with, Or make a little function that saves all the players stats liek this:

pawn Код:
forward SavePlayer(playerid);
pawn Код:
public SavePlayer(playerid)
{
//Put saving stuff here
}
and at the end of the command put:
pawn Код:
SavePlayer(playerid);