local screenW, screenH = guiGetScreenSize()
local marker=createMarker(-1782.12,1205.73,25.12-1, "cylinder", 2, 50, 90, 200, 75)
local sphere=createColSphere(-1782.12,1205.73,25.12-1,5)
local t=createElement("text")
setElementData(t,"scale",1.5)
setElementData(t,"name","Odbi?r pojazd?w")
setElementPosition(t,-1782.12,1205.73,25.12)
function gui()
dxDrawRectangle(screenW * 0.2628, screenH * 0.2135, screenW * 0.4744, screenH * 0.5742, tocolor(0, 0, 0, 200), false)
dxDrawRectangle(screenW * 0.2628, screenH * 0.2135, screenW * 0.4744, screenH * 0.0742, tocolor(0, 93, 147, 200), false)
dxDrawText("Przechowalnia pojazd?w!", (screenW * 0.3829) + 1, (screenH * 0.2266) + 1, (screenW * 0.7657) + 1, (screenH * 0.2799) + 1, tocolor(0, 0, 0, 255), 2.00, "clear", "left", "top", false, false, false, false, false)
dxDrawText("Przechowalnia pojazd?w!", screenW * 0.3829, screenH * 0.2266, screenW * 0.7657, screenH * 0.2799, tocolor(255, 255, 255, 255), 2.00, "clear", "left", "top", false, false, false, false, false)
dxDrawRectangle(screenW * 0.2701, screenH * 0.7096, screenW * 0.1999, screenH * 0.0651, tocolor(0, 93, 147, 200), false)
dxDrawRectangle(screenW * 0.5300, screenH * 0.7096, screenW * 0.1999, screenH * 0.0651, tocolor(0, 93, 147, 200), false)
dxDrawText("Wyci?gnij pojazd!", (screenW * 0.2855) + 1, (screenH * 0.7161) + 1, (screenW * 0.4568) + 1, (screenH * 0.7799) + 1, tocolor(0, 0, 0, 255), 2.00, "clear", "left", "top", false, false, false, false, false)
dxDrawText("Wyci?gnij pojazd!", screenW * 0.2855, screenH * 0.7161, screenW * 0.4568, screenH * 0.7799, tocolor(255, 255, 255, 255), 2.00, "clear", "left", "top", false, false, false, false, false)
dxDrawText("Zamknij panel!", (screenW * 0.5622) + 1, (screenH * 0.7161) + 1, (screenW * 0.7335) + 1, (screenH * 0.7799) + 1, tocolor(0, 0, 0, 255), 2.00, "clear", "left", "top", false, false, false, false, false)
dxDrawText("Zamknij panel!", screenW * 0.5622, screenH * 0.7161, screenW * 0.7335, screenH * 0.7799, tocolor(255, 255, 255, 255), 2.00, "clear", "left", "top", false, false, false, false, false)
end
local pozostaw=createMarker(-1786.64,1203.86,25.12-1, "cylinder", 5, 255,255,255,0)
function info()
dxDrawText(" Aby odda? pojazd do przechowalni wysi?d? z niego!", (screenW * 0.1808) + 1, (screenH * 0.0143) + 1, (screenW * 0.8067) + 1, (screenH * 0.0794) + 1, tocolor(0, 0, 0, 255), 1.5, "clear", "left", "top", false, false, false, false, false)
dxDrawText(" Aby odda? pojazd do przechowalni wysi?d? z niego!", screenW * 0.1808, screenH * 0.0143, screenW * 0.8067, screenH * 0.0794, tocolor(255, 255, 255, 255), 1.5, "clear", "left", "top", false, false, false, false, false)
end
addEventHandler("onClientMarkerHit",pozostaw,function(el)
if el~=localPlayer then return end
if getElementType(el) == "player" then
local veh = getPedOccupiedVehicle(el)
if not veh then return end
addEventHandler("onClientRender", root, info)
setTimer(function()
removeEventHandler("onClientRender", root, info)
end, 3500, 1)
end
end)
local wm={}
wm.window=guiCreateGridList(screenW * 0.2738, screenH * 0.3008, screenW * 0.4524, screenH * 0.3958, false)
guiGridListAddColumn(wm.window, "ID", 0.1)
guiGridListAddColumn(wm.window, "Model", 0.2)
guiGridListAddColumn(wm.window, "Przebieg", 0.2)
guiGridListAddColumn(wm.window, "Paliwo", 0.5)
wm.close=guiCreateButton(screenW * 0.5300, screenH * 0.7096, screenW * 0.1999, screenH * 0.0651, "", false)
guiSetAlpha(wm.close,0.00)
wm.submit=guiCreateButton(screenW * 0.2701, screenH * 0.7096, screenW * 0.1999, screenH * 0.0651, "", false)
guiSetAlpha(wm.submit,0.00)
guiSetVisible(wm.window,false)
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)
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
showCursor(true)
guiSetVisible(wm.window,true)
addEventHandler("onClientRender", root, gui)
triggerServerEvent("onParkingGetRekords", localPlayer)
end
end)
addEventHandler("onClientGUIClick", resourceRoot, function()
if source == wm.close then
if guiGetVisible(wm.window) == true then
showCursor(false)
guiSetVisible(wm.window,false)
removeEventHandler("onClientRender", root, gui)
end
end
if source == wm.submit then
local selectedRow=guiGridListGetSelectedItem(wm.window) or -1
if selectedRow < 0 then return end
local vehicles=getElementsWithinColShape(sphere,"vehicle")
if #vehicles > 0 then
addEventHandler("onClientRender",root,render1)
setTimer(renderstop1,4500,1)
return
end
local id=guiGridListGetItemText(wm.window, selectedRow, 1)
guiGridListRemoveRow(wm.window, selectedRow)
removeEventHandler("onClientRender", root, gui)
guiSetVisible(wm.window,false)
showCursor(false)
setElementPosition(localPlayer,-1776.46, 1203.26, 25.12)
triggerServerEvent("onParkingVehicleSpawn", localPlayer, tonumber(id))
end
end)
function render1()
dxDrawText(" Nie ma miejsca aby wyci?gn?? pojazd", screenW * 0.3656, screenH * 0.1553, screenW * 0.6273, screenH * 0.3193, tocolor(255, 0, 0, 255), 1.50, "pricedown", "center", "center", false, false, false, false, false)
end
function renderstop1()
removeEventHandler("onClientRender",root,render1)
end
addCommandHandler("kordy",function()
outputChatBox("Interior: " .. getElementInterior(localPlayer) .. " Dimension: " .. getElementDimension(localPlayer))
local x,y,z = getElementPosition(localPlayer)
p = string.format("%.2f, %.2f, %.2f", x,y,z)
outputChatBox("Pozycja gracza: ".. p)
setClipboard(p)
local pojazd = getPedOccupiedVehicle(localPlayer)
if pojazd then
local x,y,z = getElementPosition(pojazd)
local rx,ry,rz = getElementRotation(pojazd)
local model = getVehicleModelFromName(pojazd)
p = string.format("%.2f, %.2f, %.2f, %.1f, %.1f, %.1f", x, y, z, rx, ry, rz)
outputChatBox("Pozycja pojazdu: ".. p)
setClipboard(p)
end
end)