Posts: 278
Threads: 100
Joined: May 2011
Reputation:
0
Hi guys , i want make a file with player stats using YSI\y_ini , i know how to do that(i know how to save score ,health ,and others) but how to save timers? for example " if someone go in jail for 60000 seconds , i use a timer, but if he disconnect while the timer running how do i save the remaining time? so when he connect again then the timer starts from the remaining time! someone help me , its very important for my script.
thanks for your time
Posts: 694
Threads: 2
Joined: Oct 2012
Reputation:
0
use gettime or gettickcount functions to save the time they got jailed in some variable when you jail them, when they leave if it's been less than 60 (or 60000 for the tickcount) save current (gettime-your_variable) , that much is remaining from their jail time.
Posts: 319
Threads: 7
Joined: Jul 2012
Reputation:
0
I would save the current-time (using gettime()) and add the jailtime (60 seconds) to it and save it in a variable.
Suppose gettime() returns 500000, then save 500060 to that variable.
I would also run a permanent timer that checks every second if they're jailed (gettime() < jailtime).
And also check if they somehow left jail (exited the interior or moved further away than a certain radius) and spawns them again inside the jail to keep them there.
You can save that jailtime as well and check if they're still jailed upon connecting.
When they spawn after connecting and their jailtime hasn't ran out yet, spawn them inside the jail again.
It would be hard to cheat and stay out of jail when they're meant to be jailed that way.