Facebook
From tt, 2 Years ago, written in Lua.
Embed
Download Paste or View Raw
Hits: 212
  1. local marker=createMarker(362.04,173.62,1008.38-0.9, "cylinder", 1, 40,0,0,100)
  2. setElementInterior(marker, 3)
  3. createBlip( 1900.22,-2251.56,13.55, 36,2,0,0,0,0,0,275)
  4. local marker2=createMarker(-2033.38,-117.56,1035.17-0.90, "cylinder", 1, 40,0,0,100)
  5. setElementInterior(marker2, 3)
  6. local t=createElement("text")
  7. setElementInterior(t, 3)
  8. setElementPosition(t, 362.04,173.62,1008.38+1.2)
  9. setElementData(t,"name","Prawo JazdynKategorii A,B,C")
  10. local t2=createElement("text")
  11. setElementInterior(t2, 3)
  12. setElementPosition(t2, -2033.38,-117.56,1035.17+1.2)
  13. setElementData(t2,"name","Prawo JazdynKategorii L")
  14.  
  15. local screenW, screenH = guiGetScreenSize()
  16.  
  17.  
  18. local wm={}
  19. wm.gridlist=guiCreateGridList(0.297, 0.28, 0.40, 0.31, true)
  20. guiSetVisible(wm.gridlist,false)
  21. guiGridListAddColumn(wm.gridlist, "Kategoria", 0.3)
  22. guiGridListAddColumn(wm.gridlist, "Pojazdy", 0.3)
  23. guiGridListAddColumn(wm.gridlist, "Cena", 0.2)
  24. guiGridListAddColumn(wm.gridlist, "Zdane", 0.2)
  25.  
  26. panel = false
  27.  
  28. function PrawkoGUI()
  29. local r,g,b=interpolateBetween(255,255,255,20,250,0,(getTickCount()-czas)/1100,"SineCurve")
  30. local r2,g2,b2=interpolateBetween(255,255,255,255,0,0,(getTickCount()-czas)/1100,"SineCurve")
  31. dxDrawImage(screenW * 0.2773, screenH * 0.1641, screenW * 0.4434, screenH * 0.5586, ":ogrpg-offices/license/okn.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
  32. if not cursorPosition(screenW * 0.2773, screenH * 0.1641, screenW * 0.4434, screenH * 0.5586) then --rozpocznij
  33.  
  34.         dxDrawImage(screenW * 0.2822, screenH * 0.6016, screenW * 0.1494, screenH * 0.0638, ":ogrpg-offices/license/przycisk.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
  35.                         dxDrawText("Rozpocznij nkurs", screenW * 0.3145, screenH * 0.6198, screenW * 0.4053, screenH * 0.6523, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
  36.  
  37. else
  38.  
  39.         dxDrawImage(screenW * 0.2822, screenH * 0.6016, screenW * 0.1494, screenH * 0.0638, ":ogrpg-offices/license/przycisk.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
  40.         dxDrawText("Rozpocznij nkurs", screenW * 0.3145, screenH * 0.6198, screenW * 0.4053, screenH * 0.6523, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
  41.  
  42. end
  43. if not cursorPosition(screenW * 0.5508, screenH * 0.6016, screenW * 0.1494, screenH * 0.0638) then --zamknij
  44.  
  45.         dxDrawImage(screenW * 0.5508, screenH * 0.6016, screenW * 0.1494, screenH * 0.0638, ":ogrpg-offices/license/przycisk.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
  46.         dxDrawText("Zamknij", screenW * 0.5811, screenH * 0.6198, screenW * 0.6719, screenH * 0.6523, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
  47. else  
  48.  
  49.         dxDrawImage(screenW * 0.5508, screenH * 0.6016, screenW * 0.1494, screenH * 0.0638, ":ogrpg-offices/license/przycisk.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
  50.         dxDrawText("Zamknij", screenW * 0.5811, screenH * 0.6198, screenW * 0.6719, screenH * 0.6523, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
  51. end
  52.                      
  53.         dxDrawText("Egzamin na prawo jazdy", (screenW * 0.3711) - 1, (screenH * 0.2201) - 1, (screenW * 0.6348) - 1, (screenH * 0.2578) - 1, tocolor(0, 0, 0, 255), 2.00, "default-bold", "center", "center", false, false, false, false, false)
  54.         dxDrawText("Egzamin na prawo jazdy", (screenW * 0.3711) + 1, (screenH * 0.2201) - 1, (screenW * 0.6348) + 1, (screenH * 0.2578) - 1, tocolor(0, 0, 0, 255), 2.00, "default-bold", "center", "center", false, false, false, false, false)
  55.         dxDrawText("Egzamin na prawo jazdy", (screenW * 0.3711) - 1, (screenH * 0.2201) + 1, (screenW * 0.6348) - 1, (screenH * 0.2578) + 1, tocolor(0, 0, 0, 255), 2.00, "default-bold", "center", "center", false, false, false, false, false)
  56.         dxDrawText("Egzamin na prawo jazdy", (screenW * 0.3711) + 1, (screenH * 0.2201) + 1, (screenW * 0.6348) + 1, (screenH * 0.2578) + 1, tocolor(0, 0, 0, 255), 2.00, "default-bold", "center", "center", false, false, false, false, false)
  57.         dxDrawText("Egzamin na prawo jazdy", screenW * 0.3711, screenH * 0.2201, screenW * 0.6348, screenH * 0.2578, tocolor(255, 255, 255, 255), 2.00, "default-bold", "center", "center", false, false, false, false, false)
  58.            
  59. end
  60.  
  61. local function fillLicenseData()
  62.         guiGridListClear(wm.gridlist)
  63.         for i,v in ipairs(licenseCategory) do
  64.                 local row=guiGridListAddRow(wm.gridlist)
  65.                 guiGridListSetItemText(wm.gridlist, row, 1, v[1], false, false)
  66.                 guiGridListSetItemText(wm.gridlist, row, 2, v[2], false, false)
  67.                 guiGridListSetItemText(wm.gridlist, row, 3, v[3].." PLN", false, false)
  68.                 guiGridListSetItemData(wm.gridlist, row, 3, v[3])
  69.                 -- Settings
  70.                 if getElementData(localPlayer,"player:license:pj"..v[1]) == 1 then
  71.                         guiGridListSetItemText(wm.gridlist, row, 4, "TAK", false, false)
  72.                         guiGridListSetItemColor(wm.gridlist, row, 4, 0, 255, 0)
  73.                 else
  74.                         guiGridListSetItemText(wm.gridlist, row, 4, "NIE", false, false)
  75.                         guiGridListSetItemColor(wm.gridlist, row, 4, 255, 0, 0)
  76.                 end
  77.         end
  78. end
  79.  
  80. local function fillLicenseData2()
  81.         guiGridListClear(wm.gridlist)
  82.         for i,v in ipairs(licenseCategory2) do
  83.                 local row=guiGridListAddRow(wm.gridlist)
  84.                 guiGridListSetItemText(wm.gridlist, row, 1, v[1], false, false)
  85.                 guiGridListSetItemText(wm.gridlist, row, 2, v[2], false, false)
  86.                 guiGridListSetItemText(wm.gridlist, row, 3, v[3].." PLN", false, false)
  87.                 guiGridListSetItemData(wm.gridlist, row, 3, v[3])
  88.                 -- Settings
  89.                 if getElementData(localPlayer,"player:license:pj"..v[1]) == 1 then
  90.                         guiGridListSetItemText(wm.gridlist, row, 4, "TAK", false, false)
  91.                         guiGridListSetItemColor(wm.gridlist, row, 4, 0, 255, 0)
  92.                 else
  93.                         guiGridListSetItemText(wm.gridlist, row, 4, "NIE", false, false)
  94.                         guiGridListSetItemColor(wm.gridlist, row, 4, 255, 0, 0)
  95.                 end
  96.         end
  97. end
  98.  
  99. function RozpocznijKurs(button, state)
  100. if panel and button == "left" and state == "down" then
  101.            if cursorPosition(screenW * 0.2958, screenH * 0.6081, screenW * 0.1164, screenH * 0.0521) then
  102.         local selectedRow=guiGridListGetSelectedItem(wm.gridlist)
  103.         if not selectedRow or selectedRow < 0 then return end
  104.         local cat=guiGridListGetItemText(wm.gridlist, selectedRow, 1)
  105.         local cost=guiGridListGetItemData(wm.gridlist, selectedRow, 3)
  106.         local zdane=guiGridListGetItemText(wm.gridlist, selectedRow, 4)
  107.         if tonumber(cost) > getPlayerMoney(localPlayer) then
  108.                 outputChatBox("* Nie posiadasz tyle got├│wki.", 255, 0, 0)
  109.                 return
  110.         end
  111.         if zdane ~= "TAK" then
  112.                 triggerServerEvent("license:do", resourceRoot, tonumber(cost), cat)
  113.                 if not guiGetVisible(wm.gridlist) then return end
  114.                 guiSetVisible(wm.gridlist, false)
  115.                                 panel = false
  116.                                 removeEventHandler ("onClientRender", root, PrawkoGUI)
  117.                 showCursor(false)
  118.         else
  119.                 outputChatBox("* Posiadasz ju┼╝ zdane prawo jazdy.", 255, 0, 0)
  120.         end
  121.     end
  122.    end
  123. end
  124. addEventHandler("onClientClick", getRootElement(), RozpocznijKurs)
  125.  
  126. function Zamknij(button, state)
  127. if panel and button == "left" and state == "down" then
  128.            if cursorPosition(screenW * 0.5835, screenH * 0.6081, screenW * 0.1164, screenH * 0.0521) then
  129.         panel = false
  130.         removeEventHandler ("onClientRender", root, PrawkoGUI)
  131.                 showCursor(false)
  132.                 guiSetVisible(wm.gridlist, false)
  133.          end
  134.     end
  135. end
  136. addEventHandler("onClientClick", getRootElement(), Zamknij)
  137.  
  138. addEventHandler("onClientMarkerHit", marker, function(el,md)
  139.         if not md or el~=localPlayer then return end
  140.         if guiGetVisible(wm.gridlist) then return end
  141.                 if panel == false then
  142.                 addEventHandler("onClientRender",root,PrawkoGUI)
  143.                           czas = getTickCount()
  144.         panel = true
  145.         showCursor(true)
  146.         guiSetVisible(wm.gridlist,true)
  147.         fillLicenseData()
  148. end
  149. end)
  150.  
  151. addEventHandler("onClientMarkerHit", marker2, function(el,md)
  152.         if not md or el~=localPlayer then return end
  153.         if guiGetVisible(wm.gridlist) then return end
  154.                 if panel == false then
  155.                 addEventHandler("onClientRender",root,PrawkoGUI)
  156.                           czas = getTickCount()
  157.         panel = true
  158.         showCursor(true)
  159.         guiSetVisible(wm.gridlist,true)
  160.         fillLicenseData2()
  161. end
  162. end)
  163.  
  164. function cursorPosition(x, y, w, h)
  165.         if (not isCursorShowing()) then
  166.                 return false
  167.         end
  168.         local mx, my = getCursorPosition()
  169.         local fullx, fully = guiGetScreenSize()
  170.         cursorx, cursory = mx*fullx, my*fully
  171.         if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then
  172.                 return true
  173.         else
  174.                 return false
  175.         end
  176. end
  177.  
  178. function filedelet ()
  179. if fileExists("c_license.lua") then
  180.    fileDelete("c_license.lua")
  181.  end
  182. end
  183. addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), filedelet)