Error with my SaveAccount
#10

Unless someone has come across this specifically, you'll have to use your own debug code (such as printf statements) to find a way around this, if there is one.

Best suggestion I can give is the SA:MP Wiki, see what kind of call backs are available to you, such as:

OnGameModeExit - https://sampwiki.blast.hk/wiki/OnGameModeExit
OnPlayerDisconnect - https://sampwiki.blast.hk/wiki/OnPlayerDisconnect
OnRconCommand - https://sampwiki.blast.hk/wiki/OnRconCommand

OnPlayerDisconnect (reason) will return 0 on a crash. But I guess you have already tried that and you get your floats as 0.

Other than those, a timer is your only option, all you have to do is:

Create a public function that saves only what your having trouble saving upon crashing (you could save all data this way, but it's probably better to minimize it as much as possible). Let us for examples sake, say that you named this public function "SaveCrashData", to use a timer, probably best to put this in OnGameModeInit or OnFilterScriptInit, whichever is applicable:

pawn Код:
SetTimer("SaveCrashData", 60000, true);
If this was in OnGameModeInit, it would call SaveCrashData every 60 seconds (you have to supply it time in ms) and will loop indefinitely (on GameMode/FilterScript Exit you would call KillTimer to kill it).

The wiki for SetTimer: https://sampwiki.blast.hk/wiki/SetTimer
and for KillTimer: https://sampwiki.blast.hk/wiki/KillTimer

You can also use SetTimerEx, if you want to pass values to it (as many as you want, similarly to using format).

So if you end up using a timer, set an appropriate ms value (whether you want it to save non saveable crash data every 10, 20, 30, 60 seconds etc, in ms of course) and in your function just loop through players and save that float data or any other data you have trouble with .
Reply


Messages In This Thread
Error with my SaveAccount - by mitosking - 10.10.2011, 17:06
Re: Error with my SaveAccount - by Backwardsman97 - 10.10.2011, 17:20
Re: Error with my SaveAccount - by mitosking - 10.10.2011, 20:05
Re: Error with my SaveAccount - by Kush - 10.10.2011, 20:18
Re: Error with my SaveAccount - by mitosking - 10.10.2011, 20:35
Re: Error with my SaveAccount - by GrimR - 10.10.2011, 20:49
Re: Error with my SaveAccount - by mitosking - 10.10.2011, 20:56
Re: Error with my SaveAccount - by Backwardsman97 - 10.10.2011, 21:29
Re: Error with my SaveAccount - by mitosking - 11.10.2011, 10:34
Re: Error with my SaveAccount - by GrimR - 11.10.2011, 11:08

Forum Jump:


Users browsing this thread: 1 Guest(s)