View Single Post
  #8  
Old 07-07-2011, 04:42 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Unless a function was added to handle it, I've been using a timeout loop. I.e:

PHP Code:
function onCreated() {
  
// Clear array of detected RCs
  
this.lastRCs = "";
  
// Start Loop
  
onTimeout();
}

function 
onTimeout() {
  
// Declare an Empty Array for RCs
  
temp.rcs = {};
  
// Loop through All Players currently online
  
for (temp.a: allplayers) {
    
// Check if they're in a level
    // No level usually means they're an RC
    
if (temp.a.level == NULL) {
      
// Player's level was NULL
      // Player is actually an RC
      // Add Player to Array of RCs
      
temp.rcs.add(temp.a);
    }
  }
  
// Check if the amount of RCs is greater than the last amount of RCs online.
  
if (temp.rcs.size() > this.lastRCs.size()) {
    
// RCs have logged on.
    
sendtorc("Staff Reminder! You're all special C:");
  }
  
// Record the new array of RCs for the next timeout
  
this.lastRCs = temp.rcs;
  
// Continue Looping
  
setTimer(0.5);
} 
That's just a way I've doing it though.

Also instead of maintaining a 'this.staff' array you can just directly reference your server options.

temp.staff = serveroptions.staff.tokenize(",");

The tokenize(",") is just in case someone messes up the array formatting.
__________________
Quote:

Last edited by fowlplay4; 07-07-2011 at 05:11 AM.. Reason: Added comments.
Reply With Quote