View Single Post
  #13  
Old 07-24-2011, 10:27 AM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Quote:
Originally Posted by ffcmike View Post
Good idea, are you checking player.isobserver as a condition to process SQL normally?
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.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote