Quote:
Originally Posted by cbk1994
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.level, temp.pl.x, temp.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();