Any reason why this wouldn't work?

Forum Archive - from http://theuniversal.net
Locked
User avatar
zaroba
World Owner
World Owner
Posts: 7257
Joined: Fri Oct 10, 2003 11:06 pm
Location: Hereford, PA
Contact:

Any reason why this wouldn't work?

Post 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
Last edited by zaroba on Sat Aug 10, 2013 2:59 pm, edited 1 time in total.
User avatar
matias
World Owner
World Owner
Posts: 46
Joined: Wed Apr 24, 2013 7:37 pm

Post by matias »

I think you have a mistake in writing twice if
User avatar
zaroba
World Owner
World Owner
Posts: 7257
Joined: Fri Oct 10, 2003 11:06 pm
Location: Hereford, PA
Contact:

Post by zaroba »

oops, fixed that.
2nd one was supposed to be if the var equals 1. thanks for noticing.
Locked