Thread: Commands.pl
View Single Post
  #5  
Old 03-17-2005, 04:13 PM
Cisyouc
Demi-God
 
Join Date: Jun 2004
Location: Heaven.
Posts: 1,260
Default

Quote:
Originally Posted by Minlail
ok so in short if i wanted to create a #stuck command i could do it there in perl insted of doing it in the source code?
You could do this..
Code:
sub commands_init {
  command_add("stuck", "- Unsticks your character", 0);
}
sub rewind {
  @choices=(-5,-4,-3,-2,-1,1,2,3,4,5);
  $pick = $choices[int(rand(scalar @choices))];
  return $pick;
}
sub stuck {
  $client->MovePC($zoneid, $client->GetX()+rewind(), $client->GetY()+rewind(), $client->GetZ()+rewind());
  $client->Message(15, "Character moved.");
}
I take no responsibility for the functionality of this code (havent tested it), nor any exploits that may come out of it :P
__________________
namespace retval { template <class T> class ReturnValueGen { private: T x; public: ReturnValueGen() { x = 0; }; T& Generator() { return x; }; }; } int main() { retval::ReturnValueGen<int> retvalue; return retvalue.Generator(); }
C++ is wonderful.
Reply With Quote