View Single Post
  #12  
Old 06-14-2013, 01:59 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
Quote:
Originally Posted by cbk1994 View Post
Also, there's no reason to store the player object in a temporary variable—it's just confusing to anybody reading the script (as are the variable names you (khortez) used). The current player will remain in scope.

PHP Code:
    temp.pl findplayer2(params[1]);
    if (
temp.pl != NULL) {
      
player.setlevel2(temp.pl.leveltemp.pl.xtemp.pl.y);
    } else {
      
player.chat "Can't find" SPC params[1];
    }
  } 
The only reason I would do wat OP did (temp.pl = player;) is if you're messing with offline TServerPlayer objects, as they cause the player object to go NULL.

I.e.

PHP Code:
temp.pl player;
temp.acct player.account;
temp.op = new TServerPlayer(@temp.acct);
echo(
temp.op.account == player.account); // should echo "0"
temp.op.destroy(); 
__________________
Quote:
Reply With Quote