- local dxfont0__font = dxCreateFont(":vc-nametagi/f/droid-sans.ttf", 14)
- screenW, screenH = guiGetScreenSize()
- sx,sy = guiGetScreenSize()
- function roundedRectangle(x, y, w, h, color)
- dxDrawRectangle(x, y, w, h, color, false)
- dxDrawRectangle(x + 2, y - 1, w - 4, 1, color, false)
- dxDrawRectangle(x + 2, y + h, w - 4, 1, color, false)
- dxDrawRectangle(x - 1, y + 2, 1, h - 4, color, false)
- dxDrawRectangle(x + w, y + 2, 1, h - 4, color, false)
- end
- function eziakmysz(psx,psy,pssx,pssy,abx,aby)
- if not isCursorShowing() then return end
- cx,cy=getCursorPosition()
- cx,cy=cx*sx,cy*sy
- if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then
- return true,cx,cy
- else
- return false
- end
- end
- function przecho()
- dxDrawImage(screenW * 0.1932, screenH * 0.2093, screenW * 0.6135, screenH * 0.5824, "przecho.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
- -- Odbieranie
- if eziakmysz(screenW * 0.3125, screenH * 0.6870, screenW * 0.1047, screenH * 0.0389) then
- dxDrawImage(screenW * 0.3125, screenH * 0.6870, screenW * 0.1047, screenH * 0.0389, "wyjmij.png", 0, 0, 0, tocolor(255, 255, 255, 195), false)
- else
- dxDrawImage(screenW * 0.3125, screenH * 0.6870, screenW * 0.1047, screenH * 0.0389, "wyjmij.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
- end
- -- Zamykanie
- if eziakmysz(screenW * 0.5693, screenH * 0.6870, screenW * 0.1047, screenH * 0.0389) then
- dxDrawImage(screenW * 0.5693, screenH * 0.6870, screenW * 0.1047, screenH * 0.0389, "zamknij.png", 0, 0, 0, tocolor(255, 255, 255, 195), false)
- else
- dxDrawImage(screenW * 0.5693, screenH * 0.6870, screenW * 0.1047, screenH * 0.0389, "zamknij.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
- end
- end
- local ulance = {
- {1205.63, 256.43, 19.55,"Montgomery",1205.67, 256.59, 19.55},
- {2415.65, 153.21, 26.55,"Palomino Creek",2419.44, 148.26, 26.28},
- }
- for i,v in ipairs(ulance) do
- local marker=createMarker(v[1],v[2],v[3]-0.99, "cylinder", 1.5, 255,255,255,50)
- local sphere=createColSphere(v[5],v[6],v[7],3)
- local t=createElement("text")
- setElementData(t,"scale",1.2)
- setElementData(t,"name","Odbiór pojazdówn"..v[4])
- setElementPosition(t,v[1],v[2],v[3])
- local wm={}
- wm.window=guiCreateGridList(screenW * 0.2719, screenH * 0.3602, screenW * 0.4562, screenH * 0.2861, false)
- guiSetVisible(wm.window, false)
- guiGridListAddColumn(wm.window, "ID", 0.23)
- guiGridListAddColumn(wm.window, "Model", 0.30)
- guiGridListAddColumn(wm.window, "Przebieg", 0.30)
- guiGridListAddColumn(wm.window, "Paliwo", 0.10)
- addEvent("onParkingGetVehicles", true)
- addEventHandler("onParkingGetVehicles", root, function(result)
- guiGridListClear(wm.window)
- if not result then return end
- for i,v in pairs(result) do
- local row=guiGridListAddRow(wm.window)
- guiGridListSetItemText(wm.window, row, 1, v["id"], false, false)
- guiGridListSetItemText(wm.window, row, 2, getVehicleNameFromModel(v["model"]), false, false)
- guiGridListSetItemText(wm.window, row, 3, v["mileage"], false, false)
- guiGridListSetItemText(wm.window, row, 4, v["fuel"], false, false)
- guiGridListSetItemColor(wm.window, row, 1, 255,255,0)
- guiGridListSetItemColor(wm.window, row, 2, 255,255,0)
- guiGridListSetItemColor(wm.window, row, 3, 255,255,0)
- guiGridListSetItemColor(wm.window, row, 4, 255,255,0)
- end
- end)
- addEventHandler("onClientMarkerHit", marker, function(el,md)
- if el~=localPlayer then return end
- if isPedInVehicle(el) then return end
- if guiGetVisible(wm.window) == false then
- if v[4] == "Los Santos" then
- setElementData(localPlayer,"przecho:pos","ls")
- elseif v[4] == "Palomino Creek" then
- setElementData(localPlayer,"przecho:pos","pc")
- end
- showCursor(true)
- guiSetVisible(wm.window,true)
- addEventHandler("onClientRender", root, przecho)
- triggerServerEvent("onParkingGetRekords", localPlayer)
- end
- end)
- addEventHandler("onClientClick", root, function(btn, state)
- if btn == "left" and state == "down" then
- if eziakmysz(screenW * 0.5693, screenH * 0.6870, screenW * 0.1047, screenH * 0.0389) then
- if guiGetVisible(wm.window) == true then
- showCursor(false)
- guiSetVisible(wm.window,false)
- removeEventHandler("onClientRender", root, przecho)
- setElementData(localPlayer,"przecho:pos",false)
- end
- end
- if btn == "left" and state == "down" then
- if eziakmysz(screenW * 0.3125, screenH * 0.6870, screenW * 0.1047, screenH * 0.0389) then
- if guiGetVisible(wm.window) == true then
- local selectedRow=guiGridListGetSelectedItem(wm.window) or -1
- if selectedRow < 0 then return end
- local vehicles=getElementsWithinColShape(sphere,"vehicle")
- if #vehicles > 0 then
- exports['noti']:showBox("warning","Miejsce respienia pojazdów zajęte.")
- return
- end
- local id=guiGridListGetItemText(wm.window, selectedRow, 1)
- guiGridListRemoveRow(wm.window, selectedRow)
- removeEventHandler("onClientRender", root, przecho)
- guiSetVisible(wm.window,false)
- showCursor(false)
- if getElementData(localPlayer,"przecho:pos") == "ls" then
- triggerServerEvent("onParkingVehicleSpawn", localPlayer, tonumber(id),{1200.84, 254.72, 19.55})
- elseif getElementData(localPlayer,"przecho:pos") == "pc" then
- triggerServerEvent("onParkingVehicleSpawn", localPlayer, tonumber(id),{2419.87, 148.24, 25.95, 360, 360, 270})
- end
- setElementData(localPlayer,"przecho:pos",false)
- end
- end
- end
- end
- end)
- end