Advertisement
NatedogServer

lame

May 1st, 2015
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 2.18 KB | None | 0 0
  1.         if($text=~/#fart/i) {
  2.             my $target = $client->GetTarget();
  3.            
  4.             my $head = ($client->CalculateHeadingToTarget($target->GetX(), $target->GetY()) / 256) * 360;
  5.             my $distance = $client->CalculateDistance($target->GetX(), $target->GetY(), $target->GetZ());
  6.             if($head > 360) { $head -= 360;}
  7.            
  8.             my $head_x = sin(($head * 3.141592 / 180.0));
  9.             my $head_y = cos(($head * 3.141592 / 180.0));
  10.            
  11.             my $distance_z = abs(($client->GetZ() - $target->GetZ()));
  12.            
  13.             my $knockback = (($distance- ($distance_z * 1)) / 100) * 3.75;
  14.             my $knockup = 10;
  15.                                             #Knockup 20 ... 2.75 per 100 distance
  16.                                             #knockup 15 ... 3.25 per 100 distance (super close)
  17.                                             #Knockup 10 ... 3.75 per 100 distance  - z * .75
  18.                                             #Knockup 5 ... 5.75 per 100 distance - z * 1.5
  19.  
  20.             my $new_x = $knockback * sin(($head * 3.141592 / 180.0));
  21.             my $new_y = $knockback * cos(($head * 3.141592 / 180.0));
  22.            
  23.             #distance = X * H * sin shit     distance / (x * h) = ~sin
  24.             my $cx = $client->GetX();
  25.             my $cy = $client->GetY();
  26.            
  27.             $client->MoveLocation($new_x, $new_y, $knockup);
  28.             $client->Message(315, "DISTANCE $distance  .. Z dist = $distance_z");
  29.             #$client->Message(315, "HEAD ...X = $head_x   ... Y = $head_y");
  30.             $client->Message(315, "MY LOC  X = $cx  .. Y = $cy");
  31.             $client->Message(315, "FINAL ...X = $new_x   ... Y = $new_y");
  32.         }
  33.         if($text=~/#lol/i) {
  34.             my @client_list =$entity_list->GetClientList();
  35.            
  36.             foreach $c (@client_list) {
  37.                 next if $c->Admin() > 0;
  38.                
  39.                 my $head = ($c->CalculateHeadingToTarget($client->GetX(), $client->GetY()) / 256) * 360;
  40.                 my $distance = $c->CalculateDistance($client->GetX(), $client->GetY(), $client->GetZ());
  41.                 if($head > 360) { $head -= 360;}
  42.            
  43.                 my $head_x = sin(($head * 3.141592 / 180.0));
  44.                 my $head_y = cos(($head * 3.141592 / 180.0));
  45.                
  46.                 my $distance_z = abs(($c->GetZ() - $client->GetZ()));
  47.            
  48.                 my $knockback = (($distance- ($distance_z * 1)) / 100) * 3.75;
  49.                 my $knockup = 10;
  50.                
  51.                 my $new_x = $knockback * sin(($head * 3.141592 / 180.0));
  52.                 my $new_y = $knockback * cos(($head * 3.141592 / 180.0));
  53.                
  54.                 $c->MoveLocation($new_x, $new_y, $knockup);
  55.             }
  56.            
  57.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement