View Single Post
  #2  
Old 03-29-2011, 04:25 PM
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
It's not really a big deal but you can do the "search" processing on the client-side.

Then in the case of multiple results, you can just display a dialog and have the player select who they wanted to summon.

I would suggest using.. string.starts("text") or string.pos("text") for checking for partials. I.e:

PHP Code:
function onCreated() {
  
temp.str "loltextlmao";
  echo(
temp.str.pos("text")); // echos 3 (found == position >= 0)
  
echo(temp.str.pos("rofl")); // echos -1 (not found)
  
echo(temp.str.starts("lol")); // echos 1 (found)
  
echo(temp.str.starts("lmao")); // echos 0 (not found)

Also in your check... you should have community name support as well. Another thing when searching you should probably check them all in lowercase or uppercase. I.e:

PHP Code:
function onCreated() {
  
temp.exact "Phil";
  
temp.cond temp.exact.lower();
  
temp.matches = {};
  for (
aallplayers) {
    
// Skip RCs
    
if (a.level == NULL) continue;
    
// Check for Exact Match
    
if (a.account == temp.exact || a.communityname == temp.exact) {
      
temp.found a.account;
      break;
    }
    
// Check for Partials
    
if (a.account.lower().pos(temp.cond) >= || a.communityname.lower().pos(temp.cond) >= || a.nick.lower().pos(temp.cond) >= 0) {
      
temp.matches.add(a.account);
    } 
  }
  if (
temp.found != "") {
    echo(
"Found... " temp.found);
  } else {
    echo(
"Other matches... " temp.matches);
  }

__________________
Quote:
Reply With Quote