Quote:
Originally Posted by Astram
So it invokes something in 2hrs if the player is offline or not. And please explain the way simply. As timevar2 gets me confused.
|
timevar increases by 1 every 5 seconds
timevar2 increases by 1 every 1 second
With a little algebra, we can determine how much time has passed by setting a variable equal to a time variable, then later on, subtracting the variable you set from the time variable.
You can read and write some player variables even when the player is offline by creating a TServerPlayer object.
The 3 vars you are concerned with are "x", "y", and "levelname".
Here are some examples that might help you..
PHP Code:
// ex: getOfflinePlayerVar("Graal123456", "x");
// returns the player's x coordinate
function getOfflinePlayerVar(temp.account, temp.varname) {
temp.pl = new TServerPlayer(@account);
temp.rtn = makevar("pl." @ varname);
pl.destroy();
return rtn;
}
// ex: setOfflinePlayerVar("Graal123456", "x", 30);
// sets the player's x coordinate to 30.
// They will login at the new position.
function setOfflinePlayerVar(temp.account, temp.varname, temp.value) {
temp.pl = new TServerPlayer(@account);
makevar("pl." @ varname) = value;
pl.saveaccount();
pl.destroy();
}
e.
Depending on how your script works, you might not even need to use timevar or timevar2.
When you jail someone, schedule an event to release their account in however many seconds you wish...
then in the event:
PHP Code:
temp.pl = findplayer(acc);
if (pl == NULL)
// edit offline
else
// setlevel2