Advertisement
errur

Untitled

Mar 19th, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.48 KB | None | 0 0
  1. function PressedAttack()
  2. {      
  3.     _now = Time();
  4.     debugPrint("+attack called by " + player); 
  5.  
  6.     if(!READY)
  7.         return;
  8.    
  9.     if(Fire() == false)
  10.     {
  11.         debugPrint("On cooldown. Time left " + ( _next - _now));
  12.         return;
  13.     }  
  14.    
  15.     //local attach = player.GetAttachmentOrigin(player.LookupAttachment("weapon_bone"));   
  16.     //gun.SetOrigin(attach);
  17.    
  18.     /*weapons <- VUtil.Player.GetCurrentWeapons(player);   
  19.     attach <- null;
  20.    
  21.     for(local i = 0; i < weapons.len(); i += 1)
  22.     {
  23.         try
  24.         {
  25.             attach <- weapons[i].GetOrigin();      
  26.         }
  27.         catch(exception)
  28.         {
  29.             continue;
  30.         }
  31.         break;
  32.     }*/
  33.     //attach <- (player.EyePosition() - Vector(0,0,10));
  34.     trace_origin <- player.EyePosition() -  Vector(0,0,10);
  35.     local trace = TraceDir(trace_origin, tracker.GetForwardVector(),46341.0, null); //Cast a ray from the player's eyes in the direction they are looking      
  36.    
  37.     ent <- null;
  38.     if((ent = Entities.FindByClassnameNearest("player", trace.Hit, 100)) != null)
  39.     {
  40.         if(ent == player)
  41.         {
  42.             local PullDir = Normalize(trace.Hit - player.GetOrigin());
  43.             player.SetVelocity(player.GetVelocity()+(PullDir * GForce)*-1); //Add a force in the pull direction to the player's velocity
  44.             //DebugDrawLine(attach, trace.Hit, 255, 10, 0, false, 5); //Draw a black line from the player's gun to where the grapple hit
  45.         }
  46.     }
  47.     DispatchParticleEffect("weapon_muzzle_flash_taser", trace.Hit, trace.Hit);
  48.     if(GetDeveloperLevel() > 0)
  49.         DebugDrawLine(trace_origin, trace.Hit, 255, 255, 10, false, 5);
  50.    
  51.     _next = _now + _delay;
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement