Advertisement
Shark_vil

Pony fly

Aug 13th, 2018
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.47 KB | None | 0 0
  1. return hook.Add('PlayerBindPress', 'PPM2.Ponyfly', function(self, bind, pressed)
  2.     if bind == nil then
  3.       bind = ''
  4.     end
  5.     if pressed == nil then
  6.       pressed = false
  7.     end
  8.     if not ALLOW_FLIGHT:GetBool() then
  9.       return
  10.     end
  11.     if not FLIGHT_BIND:GetBool() then
  12.       return
  13.     end
  14.     if not pressed then
  15.       return
  16.     end
  17.     if bind ~= '+jump' and bind ~= 'jump' then
  18.       return
  19.     end
  20.     if lastDouble > RealTimeL() then
  21.       if not self:IsPonyCached() then
  22.         return
  23.       end
  24.       local data = self:GetPonyData()
  25.       if not data then
  26.         return
  27.       end
  28.       if data:GetRace() ~= PPM2.RACE_PEGASUS and data:GetRace() ~= PPM2.RACE_ALICORN then
  29.         if lastMessage < RealTimeL() then
  30.           lastMessage = RealTimeL() + 1
  31.           PPM2.LChatPrint('info.ppm2.fly.pegasus')
  32.         end
  33.         return
  34.       end
  35.       if not FORCE_ALLOW_FLIGHT:GetBool() and not SUPPRESS_CLIENTSIDE_CHECK:GetBool() then
  36.         local can = hook.Run('PlayerNoClip', self, not data:GetFly()) or hook.Run('PPM2Fly', self, not data:GetFly())
  37.         if not can then
  38.           if lastMessage2 < RealTimeL() then
  39.             lastMessage2 = RealTimeL() + 1
  40.             PPM2.LChatPrint('info.ppm2.fly.cannot', data:GetFly() and 'land' or 'fly')
  41.           end
  42.           return
  43.         end
  44.       end
  45.       RunConsoleCommand('ppm2_fly')
  46.       lastDouble = 0
  47.       return
  48.     end
  49.     lastDouble = RealTimeL() + 0.2
  50.   end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement