Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. if (self.Owner:Team() == FACTION_NINJA) then
  2. function Spell:OnFire(wand)
  3. local ent = wand:HPWGetAimEntity(250)
  4.  
  5. if IsValid(ent) then
  6. if ent:IsPlayer() then
  7. if (ent:Team() == FACTION_NINJA) then
  8. local name = "hpwrewrite_walkspeeden_handler" .. ent:EntIndex()
  9. if hook.GetTable()["Think"][name] then return end
  10. local oldspeed = ent:GetRunSpeed()
  11. local newspeed = oldspeed * 4
  12. local speed = oldspeed
  13. local inverse = false
  14.  
  15. hook.Add("Think", name, function()
  16. if not IsValid(ent) then
  17. hook.Remove("Think", name)
  18.  
  19. return
  20. end
  21.  
  22. ent:ConCommand("+forward")
  23. ent:ConCommand("+speed")
  24. ent:ConCommand("-back")
  25.  
  26. if inverse then
  27. speed = math.Approach(speed, oldspeed, FrameTime() * 200)
  28.  
  29. if speed <= oldspeed then
  30. hook.Remove("Think", name)
  31. ent:ConCommand("-forward")
  32. ent:ConCommand("-speed")
  33. end
  34. else
  35. speed = math.Approach(speed, newspeed, FrameTime() * 300)
  36.  
  37. if speed >= newspeed then
  38. inverse = true
  39. end
  40. end
  41.  
  42. ent:SetRunSpeed(speed)
  43. end)
  44. --if (ent():Team() != FACTION_NINJA) then
  45. -- ent:notify("Not the right class!")
  46. -- return false
  47. --end
  48. end
  49. end
  50. end
  51. end
  52. else
  53. return
  54. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement