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.