SHARE
TWEET

Untitled

a guest Jul 18th, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. -[[
  3.     autor: PDWH
  4.     All rights reserved!
  5. ]]
  6.  
  7.  
  8. --Fukncje
  9. --progressbar
  10. local unlerp = function(from,to,lerp) return (lerp-from)/(to-from) end
  11.  
  12. function dxDrawProgressBar( startX, startY, width, height, progress, color, backColor )
  13.         local progress = math.max( 0, (math.min( 100, progress) ) )
  14.         local wBar = width*.28
  15.         for i = 0, 4 do
  16.                 --back
  17.                 local startPos = (wBar*i + (width*.025)*i) + startX
  18.                 dxDrawRectangle( startPos, startY, wBar, height, backColor )
  19.                 --progress
  20.                 local eInterval = (i*20)
  21.                 local localProgress = math.min( 1, unlerp( eInterval, eInterval + 20, progress ) )
  22.                         if localProgress > 0 then
  23.                                 dxDrawRectangle( startPos, startY, wBar*localProgress, height, color )
  24.                         end
  25.         end
  26. end
  27. --
  28. --converterliczb
  29. function convertNumber ( number )  
  30.     local formatted = number  
  31.     while true do      
  32.         formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2')    
  33.         if ( k==0 ) then      
  34.             break  
  35.         end  
  36.     end  
  37.     return formatted
  38. end
  39. --
  40.  
  41.  
  42. --skrypy
  43.  
  44. --stanowiska (trzeba samemu je dodać)
  45. local stanowiska = {
  46.     {-2050.62, 169.82, 28.43},
  47.     {-2050.62, 178.35, 28.45},
  48.     {-2637.39, 1364.89, 6.57},
  49.     {-2637.39, 1376.01, 6.57},
  50. }
  51. x, y = guiGetScreenSize()
  52. px, py = (x/1024), (y/768)
  53. local font = dxCreateFont("Casanova.otf", 30)
  54. local screenW, screenH = guiGetScreenSize()
  55.  
  56.  
  57. --local naprawa = createMarker ( 2489.17, -1665.31, 13.34-1, "cylinder", 1, 255, 12, 0, 170 )
  58. --local bugfix = createMarker ( 2490.89, -1669.60, 12.75-1, "cylinder", 1, 255, 12, 0, 170 )
  59.  
  60.  
  61. addEventHandler("onClientMarkerHit", bugfix, function(h)
  62.     if h ~= localPlayer then return end
  63.     setElementData (localPlayer, "jestnamechu", false )
  64.     setElementData (localPlayer, "naprawia", false )
  65.     triggerServerEvent ( "dajhajs", resourceRoot)
  66. end)
  67.  
  68. local font = dxCreateFont('opensans.ttf', 30)
  69.  
  70. for i,v in ipairs(stanowiska) do
  71.     local elo = createMarker(v[1], v[2], v[3]-0.9, "cylinder", 3,230,23,230, 155)
  72.     local elo1 = createBlip(v[1], v[2], v[3], 27)
  73.     addEventHandler("onClientMarkerHit", elo, function(hit)
  74.         if hit ~= localPlayer then return end
  75.     if isPedInVehicle(localPlayer) then
  76.         if getElementData(localPlayer, "jestnamechu") then return end
  77.         setElementData (localPlayer, "jestnamechu", true ) --blokada by się nic nie zjebało XD
  78.         exports["noti2"]:noti("Wyłącz silnik i zaciągnij ręczny by móc naprawić pojazd", plr)
  79.         fixall = guiCreateButton( 0.35, 0.33, 0.13, 0.08, "Napraw", true )
  80.         offpanel = guiCreateButton( 0.52, 0.33, 0.13, 0.08, "Off", true )
  81.         --addEventHandler("onClientRender", root,menunaprawy)
  82.         guiSetAlpha ( fixall, 0 )
  83.         guiSetAlpha ( offpanel, 0 )
  84.         addEventHandler("onClientRender", root,draw)
  85.         addEventHandler("onClientRender", root,menu)
  86.         addEventHandler ( "onClientGUIClick", fixall, naprawtegoperka )
  87.         addEventHandler ( "onClientGUIClick", offpanel, paneloff )
  88.         showCursor(true)
  89.         local pojazd = getPedOccupiedVehicle(localPlayer)
  90.         if pojazd then
  91.             damage = getElementHealth ( pojazd )
  92.             if (damage <= 1000) then iletrzeba = 25
  93.             end
  94.             if (damage <= 900) then iletrzeba = 40
  95.             end
  96.             if (damage <= 800) then iletrzeba = 60
  97.             end
  98.             if (damage <= 700) then iletrzeba = 69
  99.             end
  100.             if (damage <= 600) then iletrzeba = 75
  101.             end
  102.             if (damage <= 600) then iletrzeba = 83
  103.             end
  104.             if (damage <= 500) then iletrzeba = 127
  105.             end
  106.             if (damage <= 400) then iletrzeba = 160
  107.             end
  108.             if (damage <= 300) then iletrzeba = 196
  109.             end
  110.             if (damage <= 200) then iletrzeba = 265
  111.             end
  112.             if (damage <= 100) then iletrzeba = 360
  113.             end
  114.             setElementData (localPlayer, "dajtenhajs", iletrzeba )
  115.         --setElementFrozen (auto, true)
  116.     end
  117. end
  118. end)
  119. end
  120.  
  121. function menu ()
  122.     mechmenu = dxDrawImage(312*px, 184*py, 400*px, 400*py, "mech.png")
  123.     textdre = dxDrawText("Kosz za naprawe to "..iletrzeba.."PLN", screenW * 0.3656, screenH * 0.3453, screenW * 0.6373, screenH * 0.6193, tocolor(255, 15, 0, 255), 1.50, "font", "center", "center", false, false, false, false, false)
  124. end
  125.  
  126.  
  127.  
  128. function naprawtegoperka ( hajs )
  129.     local pojazd = getPedOccupiedVehicle(localPlayer)
  130.     if pojazd then
  131.         if isElementFrozen(pojazd) then return end
  132.             --local engine = getVehicleEngineState(pojazd)
  133.         if engine == true then
  134.     if getElementData(localPlayer, "naprawia") then return end
  135.     local hajs = getPlayerMoney( localPlayer )  
  136.     if (hajs < iletrzeba) then exports["noti2"]:noti("Nie masz wystarczającej kwoty by móc naprawić pojazd.", plr) return end
  137.     if (hajs > iletrzeba) then  
  138.     setElementData (localPlayer, "naprawia", true )
  139.     outputChatBox ( "#00FF00auto zostanie naprawione za 5s.", 255, 255, 255,true )
  140.         addEventHandler("onClientRender", root,sekunda5)
  141.         removeEventHandler("onClientRender", root, draw)
  142.     setTimer ( function()
  143.         addEventHandler("onClientRender", root,sekunda4)
  144.         removeEventHandler("onClientRender", root, sekunda5)
  145.     end, 1000, 1 )
  146.     setTimer ( function()
  147.         addEventHandler("onClientRender", root,sekunda3)
  148.         removeEventHandler("onClientRender", root, sekunda4)
  149.     end, 2000, 1 )
  150.     setTimer ( function()
  151.         addEventHandler("onClientRender", root,sekunda2)
  152.         removeEventHandler("onClientRender", root, sekunda3)
  153.     end, 3000, 1 )
  154.     setTimer ( function()
  155.         addEventHandler("onClientRender", root,sekunda1)
  156.         removeEventHandler("onClientRender", root, sekunda2)
  157.     end, 4000, 1 )
  158. setTimer ( function()
  159.     removeEventHandler("onClientRender", root, sekunda1)
  160.     addEventHandler("onClientRender", root,draw)
  161.     triggerServerEvent ( "naprawtegoperka", resourceRoot)
  162.     --setElementFrozen (auto, false)
  163.     setElementData (localPlayer, "jestnamechu", false )
  164.     setElementData (localPlayer, "naprawia", false )
  165.     exports["noti2"]:noti("Pojazd został naprawiony", plr)
  166.     local sound = playSound("oglos.mp3")
  167.     setSoundVolume(sound, 0.5)
  168. end, 5000, 1 )
  169. end
  170. end
  171. end
  172. end
  173. end
  174.  
  175. function paneloff ()
  176.     if getElementData(localPlayer, "naprawia") then return end
  177.        removeEventHandler("onClientRender", root, sekunda1)
  178.        guiSetVisible(fixall, false)
  179.        guiSetVisible(offpanel, false)
  180.        showCursor(false)
  181.        --setElementFrozen (auto, false)
  182.        setElementData (localPlayer, "jestnamechu", false )
  183.        removeEventHandler("onClientRender", root, draw)
  184.        removeEventHandler("onClientRender", root, menu)
  185.        end
  186.  
  187.  
  188.     function draw()
  189.         dxDrawProgressBar( 640,475, 200, 100, math.random(00,00), tocolor( 250, 50, 50, 255), tocolor( 255, 255, 255, 255) )
  190.       end
  191.  
  192.     function sekunda1 ()
  193.         dxDrawProgressBar( 640,475, 200, 100, math.random(100,100), tocolor( 250, 50, 50, 255), tocolor( 255, 255, 255, 255) )
  194.         --textdre = dxDrawText("Pozostało: 1s", screenW * 0.1656, screenH * 1.0353, screenW * 0.6373, screenH * 0.3193, tocolor(255, 15, 0, 255), 2.50, "font", "center", "center", false, false, false, false, false)
  195.     end
  196.  
  197.     function sekunda2 ()
  198.         dxDrawProgressBar( 640,475, 200, 100, math.random(80,80), tocolor( 250, 50, 50, 255), tocolor( 255, 255, 255, 255) )
  199.         --textdre = dxDrawText("Pozostało: 2s", screenW * 0.1656, screenH * 1.0353, screenW * 0.6373, screenH * 0.3193, tocolor(255, 15, 0, 255), 2.50, "font", "center", "center", false, false, false, false, false)
  200.     end
  201.  
  202.     function sekunda3 ()
  203.         dxDrawProgressBar( 640,475, 200, 100, math.random(60,60), tocolor( 250, 50, 50, 255), tocolor( 255, 255, 255, 255) )
  204.         --textdre = dxDrawText("Pozostało: 3s", screenW * 0.1656, screenH * 1.0353, screenW * 0.6373, screenH * 0.3193, tocolor(255, 15, 0, 255), 2.50, "font", "center", "center", false, false, false, false, false)
  205.     end
  206.  
  207.     function sekunda4 ()
  208.         dxDrawProgressBar( 640,475, 200, 100, math.random(40,40), tocolor( 250, 50, 50, 255), tocolor( 255, 255, 255, 255) )
  209.         --textdre = dxDrawText("Pozostało: 4s", screenW * 0.1656, screenH * 1.0353, screenW * 0.6373, screenH * 0.3193, tocolor(255, 15, 0, 255), 2.50, "font", "center", "center", false, false, false, false, false)
  210.     end
  211.  
  212.     function sekunda5 ()
  213.         dxDrawProgressBar( 640,475, 200, 100, math.random(20,20), tocolor( 250, 50, 50, 255), tocolor( 255, 255, 255, 255) )
  214.         --textdre = dxDrawText("Pozostało: 5s", screenW * 0.1656, screenH * 1.0353, screenW * 0.6373, screenH * 0.3193, tocolor(255, 15, 0, 255), 2.50, "font", "center", "center", false, false, false, false, false)
  215.     end
  216.  
  217.         fileDelete("C.lua")
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237. fileDelete("C.lua")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top