Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function PressedAttack()
- {
- _now = Time();
- debugPrint("+attack called by " + player);
- if(!READY)
- return;
- if(Fire() == false)
- {
- debugPrint("On cooldown. Time left " + ( _next - _now));
- return;
- }
- //local attach = player.GetAttachmentOrigin(player.LookupAttachment("weapon_bone"));
- //gun.SetOrigin(attach);
- /*weapons <- VUtil.Player.GetCurrentWeapons(player);
- attach <- null;
- for(local i = 0; i < weapons.len(); i += 1)
- {
- try
- {
- attach <- weapons[i].GetOrigin();
- }
- catch(exception)
- {
- continue;
- }
- break;
- }*/
- //attach <- (player.EyePosition() - Vector(0,0,10));
- trace_origin <- player.EyePosition() - Vector(0,0,10);
- local trace = TraceDir(trace_origin, tracker.GetForwardVector(),46341.0, null); //Cast a ray from the player's eyes in the direction they are looking
- ent <- null;
- if((ent = Entities.FindByClassnameNearest("player", trace.Hit, 100)) != null)
- {
- if(ent == player)
- {
- local PullDir = Normalize(trace.Hit - player.GetOrigin());
- player.SetVelocity(player.GetVelocity()+(PullDir * GForce)*-1); //Add a force in the pull direction to the player's velocity
- //DebugDrawLine(attach, trace.Hit, 255, 10, 0, false, 5); //Draw a black line from the player's gun to where the grapple hit
- }
- }
- DispatchParticleEffect("weapon_muzzle_flash_taser", trace.Hit, trace.Hit);
- if(GetDeveloperLevel() > 0)
- DebugDrawLine(trace_origin, trace.Hit, 255, 255, 10, false, 5);
- _next = _now + _delay;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement