Thread: NC Tab
View Single Post
  #32  
Old 11-22-2009, 03:47 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
Something like this could work reasonably..

PHP Code:
function isNCChat(str) {
  
// Check Predefined Text
  
temp.predefined = {
    
"Available commands for GServer:",
    
"/stats: displays server info",
    
"/playerinfo accountname: displays info about an online player",
    
"/open accountname: opens the player attributes window",
    
"/openrights accountname: opens the rights",
    
"/opencomments accountname: opens the comments",
    
"/openaccess accountname: opens the (new) ban info",
    
"/openacc accountname: opens the account",
    
"/openprofile accountname: opens the profile",
    
"/reset accountname: resets the account",
    
"/localbans: lists all local bans (requires RC2)",
    
"/staffactivity accountname: lists staff actions (requires RC2)",
    
"/find filepattern: searches for a game files in levels/",
    
"/finddef filepattern: searches for default (classic) game files",
    
"/global text: global command (only for high admins)",
    
"/updatelevel level[,level]: reloads levels form hard disk",
    
"/refreshfilelist: scans the folders again (only use when /find is not working correctly)",
    
"/clientstats accountname: shows client stats (requires Graal v6)",
    
"/npcstart: starts the npcserver",
    
"/npckill: stops the npcserver (use this if /npcshutdown and /npcstart are not working)",
    
"Available commands for the NPC-Server:",
    
"/stats: displays server info",
    
"/reloadscriptlibs: reloads the script libraries",
    
"/loadlang: reloads the translations into memory",
    
"/loadlevellist: reloads the level list",
    
"/savenpcs: saves all database npcs",
    
"/clearnpcs levelname: deletes local db npcs from a level (including gralats)",
    
"/npc<command param>: commands to the control-npc",
    
"/style weapon/npc/class name: formats the script",
    
"/listscriptlogfunctions: lists all loggable script functions",
    
"/functionprofilestart: start/restart the function profiler",
    
"/functionprofilestop: stop the function profiler",
    
"/functionprofileshow weapon/npc/class name: stats about functions",
    
"/scripthelp text: print help for a server side function",
    
"/scriptscan weapons/npcs/classes/levels/all text: scan scripts",
    
"/npcshutdown: closes the server",
    
"/memstats [full] [level/npc name]: shows memory taken by objects, beta",
    
"GServer statistics:",
    
"Top 10 of npcs taken most CPU time:",
    
"NPC-Server statistics:"
  
};
  if (
str in temp.predefined) return false;
  
// Check for Classes:
  
for (temp.1temp.11temp.i++) {
    
temp.str2 temp.". ";
    if (
str.starts(temp.str2) && str.ends(" times")) {
      if (
str.pos(": ") > 0) return false;
    }
  }
  
// Check Actions
  
temp.actions = {
    
" loaded the comments of ",
    
" loaded attributes of player ",
    
" loaded player attributes of ",
    
" has modified the local ban of ",
    
" has set comments of (offline) player ",
    
" has set comments of player ",
    
" (Server): ",
  };
  for (
temp.acttemp.actions) {
    if (
str.pos(temp.act) > 0) return false;
  }
  
// Check Starts
  
temp.starts = {
    
"Ban type: ",
    
"Reason: ",
    
"Server uptime: ",
    
"Sleeptime (secs/min): ",
    
"Connection tries (last min): ",
    
"Players-in (byte/l.m.): ",
    
"Players-out (byte/l.m.): ",
    
"RCs-in (byte/last min): ",
    
"RCs-out (byte/last min): ",
    
"NPCServer-in (byte/l.m.): ",
    
"NPCServer-out (byte/l.m.): ",
    
"ServerList-in (byte/l.m.): ",
    
"ServerList-out (byte/l.m.): ",
    
"Player-avrg-in (bit/sec): ",
    
"Player-avrg-out (bit/sec): ",
    
"Levels: ",
    
"Players: ",
    
"RCs: ",
    
"NPCServers: ",
    
"ServerListers: ",
    
"Memory (bytes): ",
    
"Server uptime: ",
    
"Sleeptime (secs/min): ",
    
"Scriptime (last min): ",
    
"Connectiontries (last min): ",
    
"NCs-in (byte/last min): ",
    
"NCs-out (byte/last min): ",
    
"GServer-in (byte/l.m.): ",
    
"GServer-out (byte/l.m.): ",
    
"Levels: ",
    
"Active Levels: ",
    
"NPCs: ",
    
"Active Objects: ",
    
"DB-NPCs: ",
    
"NPC-Placeholder: ",
    
"Projectiles: ",
    
"Players: ",
    
"NC count: ",
    
"GServers: ",
    
"Memory (bytes): "
  
};
  
// Add RC Chat Nicknames
  
for (temp.aallplayers) {
    if (
temp.a.level == NULL) {
      
temp.starts.add(temp.a.nick ": ");
    }
  }
  
// Compare String to Starts Array
  
for (temp.acttemp.starts) {
    if (
str.starts(temp.act)) return false;
  }
  return 
true;

But yes you are right, it'd be a lot easier and more reliable if the onRCChat event had a boolean passed with it to indicated NC.
__________________
Quote:
Reply With Quote