local mdestroy=createMarker(-2051.15,340.29,35.17, "cylinder", 5, 255,255,255,50)
local t=createElement("text")
setElementData(t,"scale",1.5)
setElementData(t,"name","Pozostawianie pojazdĂłw")
setElementPosition(t,-1764.32,957.57,24.88)
addEvent("onParkingGetRekords", true)
addEventHandler("onParkingGetRekords", root, function()
local uid=getElementData(source,"player:uid")
if not uid then return end
local org = getElementData(source,"player:organization")
local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_vehicles WHERE (ownedPlayer=? OR ownedGroup=?) AND parking=1",uid,org or "Brak")
if #result > 0 then
triggerClientEvent(source, "onParkingGetVehicles", source, result)
end
end)
addEventHandler("onMarkerHit", mdestroy, function(el,md)
if getElementType(el) == "player" then
local veh=getPedOccupiedVehicle(el)
if not veh then return end
if getVehicleController(veh) ~= el then return end
local id=getElementData(veh,"vehicle:id")
if not id then return end
if isTimer(timeroddania) then return end
setElementFrozen(veh,false)
--outputChatBox("Trwa oddawanie pojazdu.", el,255,255,255,true)
toggleControl(el,"enter_exit",false)
timeroddania=setTimer(function()
exports["ogrpg-vehicles"]:onSaveVehicle(veh)
destroyElement(veh)
exports["ogrpg-db"]:dbSet("UPDATE ogrpg_vehicles SET parking=1 WHERE id=?", id)
toggleControl(el,"enter_exit",true)
--outputChatBox("* Pomy?›lnie zapisano pojazd.", el, 255, 255 ,255 ,true)
end, 1000, 1)
end
end)
addEvent("onParkingVehicleSpawn", true)
addEventHandler("onParkingVehicleSpawn", root, function(id)
if not id then return end
local spawn=exports["ogrpg-vehicles"]:onRespawnVehicles(_,id,{-1743.54,955.78,24.48,0,0,180})
if spawn then
addEventHandler("onClientRender",root,render1)
end
end)
function render1()
dxDrawText("Zrespiono pojazd", screenW * 0.3656, screenH * 0.1553, screenW * 0.6273, screenH * 0.3193, tocolor(255, 255, 255, 255), 2.50, "pricedown", "center", "center", false, false, false, false, false)
end
function renderstop1()
removeEventHandler("onClientRender",root,render1)
end