Advertisement
LordNoobIV

Boost Lite Air faire marche avec francais. All credit: Seris

May 8th, 2014
321
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.54 KB | None | 0 0
  1. land_vehicles = {}
  2. air_vehicles= {}
  3. function AddVehicle(id)
  4.     land_vehicles[id] = true
  5. end
  6. AddVehicle(3)
  7. AddVehicle(14)
  8. AddVehicle(30)
  9. AddVehicle(34)
  10. AddVehicle(37)
  11. AddVehicle(39)
  12. AddVehicle(51)
  13. AddVehicle(57)
  14. AddVehicle(59)
  15. AddVehicle(62)
  16. AddVehicle(64)
  17. AddVehicle(65)
  18. AddVehicle(67)
  19. AddVehicle(81)
  20. AddVehicle(85)
  21.  
  22.  
  23.  
  24. local timer = Timer()
  25. local nos_enabled = true
  26.  
  27. function InputEvent( args )
  28.     if window_open then
  29.         return false
  30.     end
  31.  
  32.     if not nos_enabled then return true end
  33.  
  34.     if LocalPlayer:InVehicle() and
  35.         LocalPlayer:GetState() == PlayerState.InVehicle and
  36.         IsValid(LocalPlayer:GetVehicle()) and
  37.         timer:GetSeconds() > 0.2 and
  38.         LocalPlayer:GetWorld() == DefaultWorld and
  39.         land_vehicles[LocalPlayer:GetVehicle():GetModelId()] then
  40.  
  41.         if Game:GetSetting( GameSetting.GamepadInUse ) == 1 then
  42.             if args.input == Action.VehicleFireLeft then
  43.                 Network:Send("Boost", true)
  44.                 timer:Restart()
  45.             end
  46.         else
  47.             if args.key == string.char("A") then
  48.                 Network:Send("Boost", true)
  49.                 timer:Restart()
  50.             end
  51.         end
  52.  
  53.     end
  54. end
  55.  
  56. function RenderEvent()
  57.     if not nos_enabled then return end
  58.     if LocalPlayer:InVehicle() and LocalPlayer:GetState() ~= PlayerState.InVehicle then return end
  59.     if not IsValid(LocalPlayer:GetVehicle()) then return end
  60.     if land_vehicles[LocalPlayer:GetVehicle():GetModelId()] == nil then return end
  61.     if LocalPlayer:GetWorld() ~= DefaultWorld then return end
  62.  
  63.     local boost_text = "Boost Air Lite - /boost to toggle"
  64.     local boost_size = Render:GetTextSize( boost_text )
  65.  
  66.     local boost_pos = Vector2(
  67.         (Render.Width - boost_size.x)/2,
  68.         Render.Height - boost_size.y )
  69.  
  70.     Render:DrawText( boost_pos, boost_text, Color( 255, 255, 255 ) )
  71. end
  72.  
  73. function LocalPlayerChat( args )
  74.     if args.text == "/boost" then
  75.         SetWindowOpen( not GetWindowOpen() )
  76.     end
  77. end
  78.  
  79. function CreateSettings()
  80.     window_open = false
  81.  
  82.     window = Window.Create()
  83.     window:SetSize( Vector2( 300, 100 ) )
  84.     window:SetPosition( (Render.Size - window:GetSize())/2 )
  85.  
  86.     window:SetTitle( "Boost Settings" )
  87.     window:SetVisible( window_open )
  88.     window:Subscribe( "WindowClosed", function() SetWindowOpen( false ) end )
  89.  
  90.     local enabled_checkbox = LabeledCheckBox.Create( window )
  91.     enabled_checkbox:SetSize( Vector2( 300, 20 ) )
  92.     enabled_checkbox:SetDock( GwenPosition.Top )
  93.     enabled_checkbox:GetLabel():SetText( "Enabled" )
  94.     enabled_checkbox:GetCheckBox():SetChecked( nos_enabled )
  95.     enabled_checkbox:GetCheckBox():Subscribe( "CheckChanged",
  96.         function() nos_enabled = enabled_checkbox:GetCheckBox():GetChecked() end )
  97. end
  98.  
  99. function GetWindowOpen()
  100.     return window_open
  101. end
  102.  
  103. function SetWindowOpen( state )
  104.     window_open = state
  105.     window:SetVisible( window_open )
  106.     Mouse:SetVisible( window_open )
  107. end
  108.  
  109. function ModulesLoad()
  110.     Events:FireRegisteredEvent( "HelpAddItem",
  111.         {
  112.             name = "Boost",
  113.             text =
  114.                 "The boost lets you increase the speed of your car/boat.\n\n" ..
  115.                 "To use it, tap A on a keyboard, or the LB button " ..
  116.                 "on controllers.\n\n" ..
  117.                 "To disable the script, type /boost into chat."
  118.         } )
  119. end
  120.  
  121. function ModuleUnload()
  122.     Events:FireRegisteredEvent( "HelpRemoveItem",
  123.         {
  124.             name = "Boost"
  125.         } )
  126. end
  127.  
  128. CreateSettings()
  129.  
  130. Events:Subscribe("LocalPlayerChat", LocalPlayerChat)
  131. Events:Subscribe("Render", RenderEvent)
  132. Events:Subscribe("KeyDown", InputEvent)
  133. Events:Subscribe("ModulesLoad", ModulesLoad)
  134. Events:Subscribe("ModuleUnload", ModuleUnload)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement