Guest User

Untitled

a guest
Jun 23rd, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.76 KB | None | 0 0
  1. local overheat = 0
  2.  
  3. function overheatCheck()
  4.   if getControlState("vehicle_secondary_fire") then
  5.     -- minigun is active, adding the heat:
  6.     overheat = overheat + 1
  7.   else
  8.     -- minigun is inactive, cooling down to 0:
  9.     overheat = math.max(overheat - 1, 0)
  10.   end  
  11.   -- check for overheating/cooldown, toggle controls accordingly:
  12.   if overheat >= 1000 and isControlEnabled("vehicle_secondary_fire") then
  13.     toggleControl("vehicle_secondary_fire", false)
  14.     outputChatBox("Minigun overheated!", 222, 0, 0)
  15.   elseif overheat == 0 and not isControlEnabled("vehicle_secondary_fire") then
  16.     toggleControl("vehicle_secondary_fire", true)
  17.     outputChatBox("Minigun is back!", 0, 222, 0)
  18.   end
  19. end
  20. addEventHandler("onClientPreRender", root, overHeatCheck)
Add Comment
Please, Sign In to add comment