View Single Post
  #2  
Old 09-18-2007, 07:34 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
You should use allplayers tho..

Crow added something like this on Esteria, he did the getAccountName() one..

PHP Code:
public function getAccountName(community) {
  
temp.getaccount 0;
  
  for (
temp.iallplayers) {
    if (
i.communityname == cname) {
      
getaccount i.account;
    }
  }
  return 
getaccount;
}
// hehe, ty Napo
public function getCommunityName(acct) {
  return 
findplayer(acct).communityname;

but personally with your scrit I would do:

PHP Code:
public function findName(n) {
  
temp.out 0;
  for(
temp.allplayers) {
    if(
i.account.pos(n) > -1) {
      
out = {i.accounti.communityname};
      break;
    }else if (
i.communityname.pos(n) > -1) {
      
out = {i.accounti.communityname};
      break;
    }
  }
  return 
out;

would return an array of "<acct>, <communityname>"
__________________

Last edited by Chompy; 09-18-2007 at 07:47 PM..
Reply With Quote