Thread: cool summon
View Single Post
  #2  
Old 04-03-2008, 04:57 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
You might consider using something like this that was posted by me. There is a whole thread about this in the code gallery, called 'Function findName()'.

PHP Code:
public function findName( i ) 
{ 
  
this.look = { "account", "communityname", "nick", "id" }; 
   
  for ( 
temp.a : allplayers ) 
  { 
    for ( 
temp.n : this.look ) 
    { 
      if ( 
makevar( "temp.a." @ temp.n ) == i ) 
      { 
        return 
temp.a.account; 
      } 
    } 
  } 
   
  for ( 
temp.a : allplayers ) 
  { 
    for ( 
temp.n : this.look ) 
    { 
      if ( 
makevar( "temp.a." @ temp.n ).starts( i ) ) 
      { 
        return 
temp.a.account; 
      } 
    } 
  } 
   
  return 
false; 
} 
Which is basically a cleaner, reusable way of what you did.

And then please, use braces for each function so you do this:

PHP Code:
if ( true )
{
  
banana();
} 
instead of this:
PHP Code:
if ( true ) banana(); 
Makes it easier to read.
__________________
Reply With Quote