View Single Post
  #14  
Old 07-24-2011, 10:45 AM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to ffcmike
Quote:
Originally Posted by xXziroXx View Post
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.
Reply With Quote