Noneatme

watercolor.lua

Mar 13th, 2012
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.55 KB | None | 0 0
  1. -- Watercolor By MuLTi --
  2.  
  3. local wr, wg, wb = 1, 1, 1
  4. local curframerate = 1 -- Speed (Default 1, max 2)
  5. local wrd, wgd, wbd = false, false, false
  6. local changeVehColors = true -- Change vehicle Colors? set to false, if not. (Default true)
  7. local enabled = true -- nothing here
  8. local canEnable = true -- Change, if you can disable watercolor ingame (Default true)
  9.  
  10.  
  11. addEventHandler("onClientRender", getRootElement(), function()
  12.     if(enabled == false) then return end
  13.     if(wr > 0) and (wrd == false)then
  14.         wr = wr+curframerate
  15.         if(wb ~= 1) then
  16.             wb = wb-curframerate
  17.         end
  18.         if(wr > 254) then
  19.             wr = 255
  20.             wrd = true
  21.         end
  22.    
  23.     elseif(wg > 0) and (wgd == false)then
  24.         wg = wg+curframerate
  25.         wr = wr-curframerate
  26.         if(wg > 254) then
  27.             wg = 255
  28.             wgd = true
  29.         end
  30.  
  31.     elseif(wb > 0) and (wbd == false)then
  32.         wb = wb+curframerate
  33.         wg = wg-curframerate
  34.         if(wb > 254) then
  35.             wbd = false
  36.             wrd = false
  37.             wgd = false
  38.             wb = 255
  39.             wr = 1
  40.             wg = 1
  41.         end
  42.     end
  43.     setWaterColor(wr, wg, wb, 200)
  44.     if(changeVehColors == true) then
  45.         for index, car in pairs(getElementsByType("vehicle")) do
  46.             setVehicleColor(car, wr, wg, wb, 0, 0, 0, 0, 0, 0)
  47.         end
  48.     end
  49. end)
  50.  
  51. addCommandHandler("waterc", function()
  52.     if(canEnable == false) then return end
  53.     enabled = not enabled
  54.     local prefix = "enabled"
  55.     if(enabled == false) then prefix = "disabled" end
  56.     outputChatBox("Water Color-Rainbow has been "..prefix..".", 0, 255, 0)
  57. end)
  58.  
  59. addCommandHandler("resync",function()
  60.     wr, wg, wb = 1, 1, 1
  61.     outputChatBox("Colors has been resynced.", 0, 200, 0)
  62. end)
Advertisement
Add Comment
Please, Sign In to add comment