Facebook
From Alanowskyy, 4 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 238
  1. local dxfont0__font = dxCreateFont(":vc-nametagi/f/droid-sans.ttf", 14)
  2. screenW, screenH = guiGetScreenSize()
  3. sx,sy = guiGetScreenSize()
  4.  
  5. function roundedRectangle(x, y, w, h, color)
  6.   dxDrawRectangle(x, y, w, h, color, false)
  7.   dxDrawRectangle(x + 2, y - 1, w - 4, 1, color, false)
  8.   dxDrawRectangle(x + 2, y + h, w - 4, 1, color, false)
  9.   dxDrawRectangle(x - 1, y + 2, 1, h - 4, color, false)
  10.   dxDrawRectangle(x + w, y + 2, 1, h - 4, color, false)
  11. end
  12.  
  13. function eziakmysz(psx,psy,pssx,pssy,abx,aby)
  14.     if not isCursorShowing() then return end
  15.     cx,cy=getCursorPosition()
  16.     cx,cy=cx*sx,cy*sy
  17.     if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then
  18.         return true,cx,cy
  19.     else
  20.         return false
  21.     end
  22. end      
  23.  
  24. function przecho()
  25.         dxDrawImage(screenW * 0.1932, screenH * 0.2093, screenW * 0.6135, screenH * 0.5824, "przecho.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
  26.            -- Odbieranie
  27.            if eziakmysz(screenW * 0.3125, screenH * 0.6870, screenW * 0.1047, screenH * 0.0389) then
  28.         dxDrawImage(screenW * 0.3125, screenH * 0.6870, screenW * 0.1047, screenH * 0.0389, "wyjmij.png", 0, 0, 0, tocolor(255, 255, 255, 195), false)
  29.            else
  30.         dxDrawImage(screenW * 0.3125, screenH * 0.6870, screenW * 0.1047, screenH * 0.0389, "wyjmij.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
  31.            end
  32.            -- Zamykanie
  33.            if eziakmysz(screenW * 0.5693, screenH * 0.6870, screenW * 0.1047, screenH * 0.0389) then
  34.         dxDrawImage(screenW * 0.5693, screenH * 0.6870, screenW * 0.1047, screenH * 0.0389, "zamknij.png", 0, 0, 0, tocolor(255, 255, 255, 195), false)
  35.            else
  36.         dxDrawImage(screenW * 0.5693, screenH * 0.6870, screenW * 0.1047, screenH * 0.0389, "zamknij.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
  37.            end                  
  38. end
  39.  
  40. local ulance = {
  41.         {1205.63, 256.43, 19.55,"Montgomery",1205.67, 256.59, 19.55},
  42.         {2415.65, 153.21, 26.55,"Palomino Creek",2419.44, 148.26, 26.28},
  43. }
  44.  
  45. for i,v in ipairs(ulance) do
  46. local marker=createMarker(v[1],v[2],v[3]-0.99, "cylinder", 1.5, 255,255,255,50)
  47. local sphere=createColSphere(v[5],v[6],v[7],3)
  48. local t=createElement("text")
  49. setElementData(t,"scale",1.2)
  50. setElementData(t,"name","Odbiór pojazdówn"..v[4])
  51. setElementPosition(t,v[1],v[2],v[3])
  52.  
  53. local wm={}
  54. wm.window=guiCreateGridList(screenW * 0.2719, screenH * 0.3602, screenW * 0.4562, screenH * 0.2861, false)
  55. guiSetVisible(wm.window, false)
  56. guiGridListAddColumn(wm.window, "ID", 0.23)
  57. guiGridListAddColumn(wm.window, "Model", 0.30)
  58. guiGridListAddColumn(wm.window, "Przebieg", 0.30)
  59. guiGridListAddColumn(wm.window, "Paliwo", 0.10)
  60.  
  61. addEvent("onParkingGetVehicles", true)
  62. addEventHandler("onParkingGetVehicles", root, function(result)
  63.         guiGridListClear(wm.window)
  64.         if not result then return end
  65.         for i,v in pairs(result) do
  66.                 local row=guiGridListAddRow(wm.window)
  67.                 guiGridListSetItemText(wm.window, row, 1, v["id"], false, false)
  68.                 guiGridListSetItemText(wm.window, row, 2, getVehicleNameFromModel(v["model"]), false, false)
  69.                 guiGridListSetItemText(wm.window, row, 3, v["mileage"], false, false)
  70.                 guiGridListSetItemText(wm.window, row, 4, v["fuel"], false, false)
  71.                 guiGridListSetItemColor(wm.window, row, 1, 255,255,0)
  72.                 guiGridListSetItemColor(wm.window, row, 2, 255,255,0)
  73.                 guiGridListSetItemColor(wm.window, row, 3, 255,255,0)
  74.                 guiGridListSetItemColor(wm.window, row, 4, 255,255,0)
  75.         end
  76. end)
  77.  
  78. addEventHandler("onClientMarkerHit", marker, function(el,md)
  79.         if el~=localPlayer then return end
  80.         if isPedInVehicle(el) then return end
  81.         if guiGetVisible(wm.window) == false then
  82.                 if v[4] == "Los Santos" then
  83.                         setElementData(localPlayer,"przecho:pos","ls")
  84.                         elseif v[4] == "Palomino Creek" then
  85.                                 setElementData(localPlayer,"przecho:pos","pc")
  86.                 end
  87.                 showCursor(true)
  88.                 guiSetVisible(wm.window,true)
  89.                 addEventHandler("onClientRender", root, przecho)
  90.                 triggerServerEvent("onParkingGetRekords", localPlayer)
  91.         end
  92. end)
  93.  
  94. addEventHandler("onClientClick", root, function(btn, state)
  95.   if btn == "left" and state == "down" then
  96.         if eziakmysz(screenW * 0.5693, screenH * 0.6870, screenW * 0.1047, screenH * 0.0389) then
  97.                 if guiGetVisible(wm.window) == true then
  98.                         showCursor(false)
  99.                         guiSetVisible(wm.window,false)
  100.                         removeEventHandler("onClientRender", root, przecho)
  101.                         setElementData(localPlayer,"przecho:pos",false)
  102.                 end
  103.         end
  104.           if btn == "left" and state == "down" then
  105.         if eziakmysz(screenW * 0.3125, screenH * 0.6870, screenW * 0.1047, screenH * 0.0389) then
  106.                 if guiGetVisible(wm.window) == true then
  107.                 local selectedRow=guiGridListGetSelectedItem(wm.window) or -1
  108.                 if selectedRow < 0 then return end
  109.         local vehicles=getElementsWithinColShape(sphere,"vehicle")
  110.                 if #vehicles > 0 then
  111.                         exports['noti']:showBox("warning","Miejsce respienia pojazdów zajęte.")
  112.                         return
  113.                 end
  114.                 local id=guiGridListGetItemText(wm.window, selectedRow, 1)
  115.                 guiGridListRemoveRow(wm.window, selectedRow)
  116.                 removeEventHandler("onClientRender", root, przecho)
  117.                 guiSetVisible(wm.window,false)
  118.                 showCursor(false)
  119.                 if getElementData(localPlayer,"przecho:pos") == "ls" then
  120.                 triggerServerEvent("onParkingVehicleSpawn", localPlayer, tonumber(id),{1200.84, 254.72, 19.55})
  121.         elseif getElementData(localPlayer,"przecho:pos") == "pc" then
  122.                 triggerServerEvent("onParkingVehicleSpawn", localPlayer, tonumber(id),{2419.87, 148.24, 25.95, 360, 360, 270})
  123.         end
  124.                 setElementData(localPlayer,"przecho:pos",false)
  125.         end
  126. end
  127. end
  128. end
  129. end)
  130. end