Facebook
From Alanowskyy, 1 Year ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 124
  1. local markery = {
  2.     {1199.00, 246.22, 19.55,"Montgomery"},
  3.     {2420.14, 137.81, 26.55,"Palomino Creek"},
  4. }
  5.  
  6. x,y,z,x2,y2,z2 = nil
  7.  
  8. for i,v in ipairs(markery) do
  9. local marker=createMarker(v[1],v[2],v[3]-0.99, "cylinder", 5,0,0,0)
  10. createBlip(v[1],v[2],v[3], 35,2,0,0,0,0,0,250)
  11. local mdestroy = createColSphere(v[1],v[2],v[3],3)
  12. local t=createElement("text")
  13. setElementData(t,"scale",1.5)
  14. setElementData(t,"name","Pozostawianie pojazdów\n"..v[4])
  15. setElementPosition(t,v[1],v[2],v[3])
  16.  
  17. addEvent("onParkingGetRekords", true)
  18. addEventHandler("onParkingGetRekords", root, function()
  19.     local sid=getElementData(source,"player:sid")
  20.     if not sid then return end
  21.         local org = getElementData(source,"player:organization")
  22.     local result=exports["pystories-db"]:dbGet("SELECT * FROM pystories_vehicles WHERE (ownedPlayer=? OR ownedGroup=?) AND parking=1",sid,org or "Brak")
  23.     if #result > 0 then
  24.         triggerClientEvent(source, "onParkingGetVehicles", source, result)
  25.     end
  26. end)
  27.  
  28. addEventHandler("onColShapeHit", mdestroy, function(el,md)
  29.     if getElementType(el) == "player" then
  30.         local veh=getPedOccupiedVehicle(el)
  31.         if not veh then return end
  32.         if getVehicleController(veh) ~= el then return end
  33.         local id=getElementData(veh,"vehicle:id")
  34.         if not id then return end
  35.         if isTimer(timeroddania) then return end
  36.         setElementFrozen(veh,true)
  37.         exports['noti']:showBox(el,"Trwa zapisywanie pojazdu...")
  38.         toggleControl(el,"enter_exit",false)
  39.         timeroddania=setTimer(function()
  40.                         setElementFrozen(veh,false)
  41.                         local id=getElementData(veh,"vehicle:id")
  42.                         if not id then return end
  43.             exports["pystories-vehicles"]:onSaveVehicle(veh)
  44.             removePedFromVehicle(el)
  45.             destroyElement(veh)
  46.             exports["pystories-db"]:dbSet("UPDATE pystories_vehicles SET parking=1 WHERE id=?", id)
  47.             toggleControl(el,"enter_exit",true)
  48.         end, 3000, 1)
  49.         elseif getElementType(el) == "vehicle" then
  50.                 local peds= getVehicleOccupants(el)
  51.                 if #peds > 0 then return end
  52.                 local id=getElementData(el,"vehicle:id")
  53.         if not id then return end
  54.         if isTimer(timeroddania) then return end
  55.         timeroddania=setTimer(function()
  56.                         setElementFrozen(el,false)
  57.                         local id=getElementData(el,"vehicle:id")
  58.                         if not id then return end
  59.             exports["pystories-vehicles"]:onSaveVehicle(el)
  60.             destroyElement(el)
  61.             exports["pystories-db"]:dbSet("UPDATE pystories_vehicles SET parking=1 WHERE id=?", id)
  62.         end, 3000, 1)
  63.                 setElementFrozen(el,true)
  64.                 setVehicleLocked(el,true)
  65.     end
  66. end)
  67.  
  68. addEvent("onParkingVehicleSpawn", true)
  69. addEventHandler("onParkingVehicleSpawn", root, function(id,pos)
  70.     if not id then return end
  71.         exports["pystories-vehicles"]:onRespawnVehicles(_,id,pos)
  72. end)
  73. end