Page 1 of 1

Any reason why this wouldn't work?

Posted: Fri Aug 09, 2013 9:43 pm
by zaroba
script to wipe players after 20 days of inactivity. Script will run once a day for *all* registered players on the world.

$gServerTimeVar2 counts production cycles on zoric which run every hour.
$gPlayerTimeVar2 records the last production cycle a player was active on the world.
$gPlayerVar50 just specifies whether a player is frozen or not, to eliminate this script from wiping them

I can't really test this script on zoric, so does anybody see any issues with it that would cause it to mess up and not work as intended?

Code: Select all

Event( "Custom", "wiper" )
	{
	$playerid=sysGetPlayerID("%player%")
	$online=sysIsPlayerIDOnline("$playerid")
	$wipetimer=$gPlayerTimeVar2+480
	$kicktimer=$gPlayerTimeVar2+240
	if ($online=0)
		{
		if ($gServerTimeVar2>$wipetimer)
			{
			if ($gPlayerVar50=0)
				{
				$var=$gServerTimeVar2-$gPlayerTimeVar2
				*log %player% wiped - $var cycles since last login
				*wipe %player%
				$wiped=$wiped+1
				}
			if ($gPlayerVar50=1)
				{
				$var=$gServerTimeVar2-$gPlayerTimeVar2
				*log %player% on vacation - not wiped. $var cycles since last login
				}
			}
		}
	if ($online=1)
		{
		if ($gServerTimeVar2>$kicktimer)
			{
			$var=$gServerTimeVar2-$gPlayerTimeVar2
			*log %player% autokicked - $var cycles since last login
			$gServerTimeVar2=$gPlayerTimeVar2
			*kick %player%
			}
		}
	}

Anytime a player logs in or accesses a building $gPlayerTimeVar2 is set to equal $gServerTimeVar2 to show their last active production cycle. If a player is online for 10 real days without accessing any building (because they are in their house that whole time) the script will kick them and update their timevar. If a player goes 20 real days without logging in, they get automatically wiped, unless they are in vacation mode.

This will keep the overall player record size down.

Image

Posted: Sat Aug 10, 2013 1:30 pm
by matias
I think you have a mistake in writing twice if

Posted: Sat Aug 10, 2013 3:01 pm
by zaroba
oops, fixed that.
2nd one was supposed to be if the var equals 1. thanks for noticing.