Guest User

Untitled

a guest
Aug 1st, 2020
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.14 KB | None | 0 0
  1. setTimer(function()
  2. local p = localPlayer
  3. local pojazd = getPedOccupiedVehicle(p)
  4. if not pojazd then return end
  5. if getElementData(p, "zdaje") then
  6. local sx,sy,sz = getElementVelocity(pojazd)
  7. local km = math.ceil(((sx^2+sy^2+sz^2)^(0.5))*155)
  8. if km > 25 then
  9. setElementData(p, "zdaje", getElementData(p, "zdaje")-1)
  10. end
  11. end
  12. if getElementData(p, "zdaje") and getElementData(p, "zdaje") == 0 then
  13. setElementData(p, "zdaje", false)
  14. triggerServerEvent("zdalEgzamin", resourceRoot, p)
  15. end
  16. end, 1000, 0)
  17.  
  18. local screenW, screenH = guiGetScreenSize()
  19. local sx, sy = guiGetScreenSize()
  20.  
  21. function mysz(psx,psy,pssx,pssy,abx,aby)
  22. if not isCursorShowing() then return end
  23. cx,cy=getCursorPosition()
  24. cx,cy=cx*sx,cy*sy
  25. if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then
  26. return true,cx,cy
  27. else
  28. return false
  29. end
  30. end
  31.  
  32. local czcionka = dxCreateFont(":nm-geodeta/czcionka.ttf", 10)
  33. if not czcionka then czcionka = "default-bold" end
  34. local czcionka2 = dxCreateFont(":nm-geodeta/czcionka.ttf", 8)
  35. if not czcionka2 then czcionka2 = "default-bold" end
  36.  
  37. function gui()
  38. exports["w_blur"]:dxDrawBluredRectangle(screenW * 0.3792, screenH * 0.2370, screenW * 0.2313, screenH * 0.3346, tocolor(150, 150, 150, 255))
  39. dxDrawRectangle(screenW * 0.3792, screenH * 0.2370, screenW * 0.2313, screenH * 0.0573, tocolor(25, 75, 125, 155), false)
  40. dxDrawText("Kurs prawa jazdy", (screenW * 0.3792) + 1, (screenH * 0.2357) + 1, (screenW * 0.6105) + 1, (screenH * 0.2943) + 1, tocolor(0, 0, 0, 255), 1.00, czcionka, "center", "center", false, false, false, false, false)
  41. dxDrawText("Kurs prawa jazdy", screenW * 0.3792, screenH * 0.2357, screenW * 0.6105, screenH * 0.2943, tocolor(255, 255, 255, 255), 1.00, czcionka, "center", "center", false, false, false, false, false)
  42. if mysz(screenW * 0.3909, screenH * 0.4948, screenW * 0.0996, screenH * 0.0599) then
  43. dxDrawRectangle(screenW * 0.3909, screenH * 0.4948, screenW * 0.0996, screenH * 0.0599, tocolor(25, 75, 125, 180), false)
  44. else
  45. dxDrawRectangle(screenW * 0.3909, screenH * 0.4948, screenW * 0.0996, screenH * 0.0599, tocolor(25, 75, 125, 125), false)
  46. end
  47. if mysz(screenW * 0.5007, screenH * 0.4948, screenW * 0.0996, screenH * 0.0599) then
  48. dxDrawRectangle(screenW * 0.5007, screenH * 0.4948, screenW * 0.0996, screenH * 0.0599, tocolor(25, 75, 125, 180), false)
  49. else
  50. dxDrawRectangle(screenW * 0.5007, screenH * 0.4948, screenW * 0.0996, screenH * 0.0599, tocolor(25, 75, 125, 125), false)
  51. end
  52. dxDrawText("Akceptuj", (screenW * 0.3909) + 1, (screenH * 0.4948) + 1, (screenW * 0.4905) + 1, (screenH * 0.5547) + 1, tocolor(0, 0, 0, 255), 1.00, czcionka, "center", "center", false, false, false, false, false)
  53. dxDrawText("Akceptuj", screenW * 0.3909, screenH * 0.4948, screenW * 0.4905, screenH * 0.5547, tocolor(255, 255, 255, 255), 1.00, czcionka, "center", "center", false, false, false, false, false)
  54. dxDrawText("Anuluj", (screenW * 0.5000) + 1, (screenH * 0.4948) + 1, (screenW * 0.5996) + 1, (screenH * 0.5547) + 1, tocolor(0, 0, 0, 255), 1.00, czcionka, "center", "center", false, false, false, false, false)
  55. dxDrawText("Anuluj", screenW * 0.5000, screenH * 0.4948, screenW * 0.5996, screenH * 0.5547, tocolor(255, 255, 255, 255), 1.00, czcionka, "center", "center", false, false, false, false, false)
  56. end
  57.  
  58. local napisy = guiCreateComboBox(0.39, 0.30, 0.21, 0.16, "Wybierz kategorie", true)
  59. guiSetVisible(napisy, false)
  60.  
  61. addEvent("oknoEgz", true)
  62. addEventHandler("oknoEgz", root, function()
  63. if guiGetVisible(napisy) == true then
  64. guiSetVisible(napisy, false)
  65. showCursor(false)
  66. removeEventHandler("onClientPreRender", root, gui)
  67. else
  68. addEventHandler("onClientPreRender", root, gui)
  69. guiSetVisible(napisy, true)
  70. showCursor(true, false)
  71. guiComboBoxClear(napisy)
  72. local info1 = "Kategoria A"
  73. local info2 = "Kategoria B"
  74. local info3 = "Kategoria C"
  75. guiComboBoxAddItem(napisy, info1)
  76. guiComboBoxAddItem(napisy, info2)
  77. guiComboBoxAddItem(napisy, info3)
  78. end
  79. end)
  80.  
  81. addEvent("oknoEgzC", true)
  82. addEventHandler("oknoEgzC", root, function()
  83. if guiGetVisible(napisy) == true then
  84. guiSetVisible(napisy, false)
  85. showCursor(false)
  86. removeEventHandler("onClientPreRender", root, gui)
  87. end
  88. end)
  89.  
  90. addEventHandler("onClientClick", root, function(b, s)
  91. if b ~= "state" and s ~= "down" then return end
  92. if mysz(screenW * 0.5007, screenH * 0.4948, screenW * 0.0996, screenH * 0.0599) and guiGetVisible(napisy) == true then
  93. guiSetVisible(napisy, false)
  94. showCursor(false)
  95. removeEventHandler("onClientPreRender", root, gui)
  96. elseif mysz(screenW * 0.3909, screenH * 0.4948, screenW * 0.0996, screenH * 0.0599) and guiGetVisible(napisy) == true then
  97. local i = guiComboBoxGetSelected(napisy)
  98. if not i then return end
  99. removeEventHandler("onClientPreRender", root, gui)
  100. local id = guiComboBoxGetItemText(napisy, i)
  101. triggerServerEvent("rozpocznijKurs", resourceRoot, localPlayer, id)
  102. guiSetVisible(napisy, false)
  103. showCursor(false)
  104. end
  105. end)
  106.  
  107. addEventHandler("onClientRender", root, function()
  108. if getElementData(localPlayer, "zdaje") then
  109. if not isPedInVehicle(localPlayer) then return end
  110. exports["w_blur"]:dxDrawBluredRectangle(screenW * 0.4056, screenH * 0.0130, screenW * 0.1903, screenH * 0.0560, tocolor(150, 150, 150, 255), false)
  111. dxDrawText("Do zdania egzaminu pozostało: "..getElementData(localPlayer, "zdaje").." sekund\nJeździj ostrożnie!", (screenW * 0.4048) + 1, (screenH * 0.0104) + 1, (screenW * 0.5959) + 1, (screenH * 0.0690) + 1, tocolor(0, 0, 0, 255), 1.00, czcionka2, "center", "center", false, false, false, false, false)
  112. dxDrawText("Do zdania egzaminu pozostało: "..getElementData(localPlayer, "zdaje").." sekund\nJeździj ostrożnie!", screenW * 0.4048, screenH * 0.0104, screenW * 0.5959, screenH * 0.0690, tocolor(255, 255, 255, 255), 1.00, czcionka2, "center", "center", false, false, false, false, false)
  113. end
  114. end)
Advertisement
Add Comment
Please, Sign In to add comment