Quote:
Originally Posted by xXziroXx
I do it like this:
PHP Code:
function onActionPlayerOnline()
{
// What type is the account?
client.upgradeStatus = player.upgradestatus;
client.communityName = (player.communityname == "" ? player.account : player.communityname);
// Okay, if it's a trial, let's give some special treatment.
if (player.upgradestatus == "trial") {
// Just now logging on.
if (!player.isLoggedOn)
return initializePlayer();
}
else
initializePlayer();
}
function onSwitchPlayerToObserver(pl)
pl.isLoggedOn = true;
function onSwitchObserverToPlayer(pl)
scheduleevent(1, "HandleTrialAccount", pl);
function onHandleTrialAccount(pl)
{
// Sometimes the player logs off during observer mode but still triggers onSwitchObserverToPlayer
if (pl.level.name == "")
return;
with (pl)
initializePlayer();
}
EDIT: There's a short delay after onSwitchObserverToPlayer is triggered and when the player isn't observer anymore, hence why I use a scheduleevent.
|
I think I'd prefer this if there was a built-in simple way of knowing if somebody was logging on as an observer, for now I'll see how it goes just having SQL occurring within the original event rather than a subsequent trigger.