Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- vehicles=0
- root=getRootElement()
- resourceRoot=getResourceRootElement(getThisResource())
- local nlOffsets={
- [411]={-1,0,-0.6}, -- infernus
- [470]={-1,0,-0.4}, -- patriot
- [541]={-0.9,0,-0.4}, -- bulelt
- [549]={-0.9,0,-0.4}, -- tampa
- [587]={-1,0,-0.5}, -- euros
- }
- local nlIDX={
- 3962,2113,1784,2054,2428,2352
- }
- function getVehicleHandlingProperty ( element, property )
- if isElement ( element ) and getElementType ( element ) == "vehicle" and type ( property ) == "string" then
- local handlingTable = getVehicleHandling ( element )
- local value = handlingTable[property]
- if value then
- return value
- end
- end
- return false
- end
- function getAdmin2(plr,level)
- if level then
- local result=exports["pystories-db"]:dbGet("SELECT * from pystories_admins WHERE serial=? AND level=?", getPlayerSerial(plr), level)
- if result and #result > 0 then
- return true
- else
- return false
- end
- else
- local result=exports["pystories-db"]:dbGet("SELECT * from pystories_admins WHERE serial=?", getPlayerSerial(plr))
- if result and #result > 0 then
- return true
- else
- return false
- end
- end
- end
- --///////////////////////////////////// WCZYTYWANIE POJAZDÓW /////////////////////////////////
- function onRespawnVehicles(_,id,poss)
- -- Settings (QUERY)
- if id then
- result=exports["pystories-db"]:dbGet("SELECT * FROM pystories_vehicles WHERE parking=1 AND id=?", id)
- query=exports["pystories-db"]:dbSet("UPDATE pystories_vehicles SET parking=0 WHERE id=?", id)
- else
- result=exports["pystories-db"]:dbGet("SELECT * FROM pystories_vehicles WHERE parking=0")
- end
- -- Pairs
- for ile,vehicle in pairs(result) do
- vehicles=ile
- if id then pos={poss[1], poss[2], poss[3], poss[4], poss[5], poss[6]}
- else pos=split(vehicle["pos"], ",") end
- local color=split(vehicle["color"], ",")
- local lights=split(vehicle["headlights"], ",")
- local veh=createVehicle(vehicle["model"], pos[1], pos[2], pos[3], pos[4], pos[5], pos[6])
- setVehicleColor(veh, color[1], color[2], color[3], color[4],color[5], color[6], color[7], color[8],color[9], color[10], color[11], color[12])
- setVehicleHeadLightColor(veh, lights[1], lights[2], lights[3])
- if vehicle["plateText"] ~= "" then
- setVehiclePlateText(veh, vehicle["plateText"])
- else
- setVehiclePlateText(veh, tostring("SA "..vehicle["id"]))
- end
- if vehicle["paintjob"] ~= 3 then
- setVehiclePaintjob(veh, vehicle["paintjob"])
- end
- setElementHealth(veh, vehicle["health"])
- setElementData(veh,"vehicle:spawn",true)
- setElementData(veh,"vehicle:id", vehicle["id"])
- setElementData(veh,"vehicle:fuel", vehicle["fuel"])
- setElementData(veh,"vehicle:bak", vehicle["bak"])
- setElementData(veh, "vehicle:mk1", vehicle["mk1"])
- setElementData(veh, "vehicle:mk2", vehicle["mk2"])
- setElementData(veh, "vehicle:mk3", vehicle["mk3"])
- setElementData(veh, "vehicle:mk4", vehicle["mk4"])
- setElementData(veh,"vehicle:desc", vehicle["text"] or false)
- setElementData(veh,"vehicle:mileage", vehicle["mileage"])
- setElementData(veh,"vehicle:driver", vehicle["driver"])
- setElementData(veh,"vehicle:ownedGroup", vehicle["ownedGroup"])
- setElementData(veh,"vehicle:ownedPlayer", vehicle["ownedPlayer"])
- setElementData(veh,"vehicle:pojemnosc", vehicle["pojemnosc"])
- setElementData(veh,"vehicle:taxo", vehicle["taxi"])
- setElementData(veh,"vehicle:naped", vehicle["naped"])
- setElementData(veh,"vehicle:rodzaj", vehicle["rodzaj"])
- setVehicleVariant(veh, vehicle["v1"], vehicle["v2"])
- if getElementData(veh, "vehicle:naped") == "Fabryczny" then
- elseif getElementData(veh, "vehicle:naped") == "AWD" then
- setVehicleHandling(veh, "driveType", "awd")
- setElementData(veh, "naped:awd", true)
- elseif getElementData(veh, "vehicle:naped") == "RWD" then
- setVehicleHandling(veh, "driveType", "rwd")
- setElementData(veh, "naped:rwd", true)
- elseif getElementData(veh, "vehicle:naped") == "FWD" then
- setVehicleHandling(veh, "driveType", "fwd")
- setElementData(veh, "naped:fwd", true)
- end
- if vehicle["analogowy"] == 1 then
- setElementData (veh, "vehicle:licznik:analogowy", true)
- end
- setElementData(veh,"vehicle:licznik", vehicle["licznik"])
- if not vehicle["licznik"] then
- setElementData(veh,"vehicle:licznik", "zolty")
- end
- if getElementData(veh, "vehicle:rodzaj") == "LPG" then
- local acceleration = getVehicleHandling(veh).engineAcceleration
- local velocity = getVehicleHandling(veh).maxVelocity
- setElementData(veh, "vehicle:fuel", false)
- setElementData(veh, "vehicle:gas",vehicle["gas"])
- setVehicleHandling(veh, "maxVelocity", velocity+1)
- setVehicleHandling(veh, "engineAcceleration", acceleration+0.1)
- setVehicleHandling(veh, "engineType", "electric")
- elseif getElementData(veh, "vehicle:rodzaj") == "ON" then
- local acceleration = getVehicleHandling(veh).engineAcceleration
- local velocity = getVehicleHandling(veh).maxVelocity
- setVehicleHandling(veh, "maxVelocity", velocity+1)
- setVehicleHandling(veh, "engineAcceleration", acceleration+0.1)
- setVehicleHandling(veh, "engineType", "diesel")
- elseif getElementData(veh, "vehicle:rodzaj") == "PB" then
- local acceleration = getVehicleHandling(veh).engineAcceleration
- local velocity = getVehicleHandling(veh).maxVelocity
- setVehicleHandling(veh, "maxVelocity", velocity+1.1)
- setVehicleHandling(veh, "engineAcceleration", acceleration+0.3)
- setVehicleHandling(veh, "engineType", "petrol")
- elseif getElementData(veh, "vehicle:rodzaj") == "ELECTRIC" then
- local acceleration = getVehicleHandling(veh).engineAcceleration
- local velocity = getVehicleHandling(veh).maxVelocity
- setVehicleHandling(veh, "maxVelocity", velocity+0.3)
- setVehicleHandling(veh, "engineAcceleration", acceleration+0.5)
- setVehicleHandling(veh, "engineType", "electric")
- end
- if getElementData(veh, "vehicle:pojemnosc") == 1 then
- setElementData(veh, "vehicle:poj", "1.2")
- elseif getElementData(veh, "vehicle:pojemnosc") == 2 then
- local acceleration = getVehicleHandling(veh).engineAcceleration
- local velocity = getVehicleHandling(veh).maxVelocity
- local kg = getVehicleHandling(veh).mass
- setElementData(veh, "vehicle:poj", "1.4")
- setVehicleHandling(veh, "mass", kg+1)
- setVehicleHandling(veh, "maxVelocity", velocity+0.2)
- setVehicleHandling(veh, "engineAcceleration", acceleration+0.3)
- elseif getElementData(veh, "vehicle:pojemnosc") == 3 then
- local acceleration = getVehicleHandling(veh).engineAcceleration
- local velocity = getVehicleHandling(veh).maxVelocity
- local kg = getVehicleHandling(veh).mass
- setElementData(veh, "vehicle:poj", "1.6")
- setVehicleHandling(veh, "mass", kg+3)
- setVehicleHandling(veh, "maxVelocity", velocity+0.5)
- setVehicleHandling(veh, "engineAcceleration", acceleration+0.6)
- elseif getElementData(veh, "vehicle:pojemnosc") == 4 then
- local acceleration = getVehicleHandling(veh).engineAcceleration
- local velocity = getVehicleHandling(veh).maxVelocity
- local kg = getVehicleHandling(veh).mass
- setElementData(veh, "vehicle:poj", "1.8")
- setVehicleHandling(veh, "mass", kg+6)
- setVehicleHandling(veh, "maxVelocity", velocity+1)
- setVehicleHandling(veh, "engineAcceleration", acceleration+2)
- elseif getElementData(veh, "vehicle:pojemnosc") == 5 then
- local acceleration = getVehicleHandling(veh).engineAcceleration
- local velocity = getVehicleHandling(veh).maxVelocity
- local kg = getVehicleHandling(veh).mass
- setElementData(veh, "vehicle:poj", "1.9")
- setVehicleHandling(veh, "mass", kg+9)
- setVehicleHandling(veh, "maxVelocity", velocity+1.2)
- setVehicleHandling(veh, "engineAcceleration", acceleration+2.1)
- elseif getElementData(veh, "vehicle:pojemnosc") == 6 then
- local acceleration = getVehicleHandling(veh).engineAcceleration
- local velocity = getVehicleHandling(veh).maxVelocity
- local kg = getVehicleHandling(veh).mass
- setElementData(veh, "vehicle:poj", "2.0")
- setVehicleHandling(veh, "mass", kg+11)
- setVehicleHandling(veh, "maxVelocity", velocity+1.5)
- setVehicleHandling(veh, "engineAcceleration", acceleration+2.5)
- elseif getElementData(veh, "vehicle:pojemnosc") == 7 then
- local acceleration = getVehicleHandling(veh).engineAcceleration
- local velocity = getVehicleHandling(veh).maxVelocity
- local kg = getVehicleHandling(veh).mass
- setElementData(veh, "vehicle:poj", "2.2")
- setVehicleHandling(veh, "mass", kg+14)
- setVehicleHandling(veh, "maxVelocity", velocity+1.9)
- setVehicleHandling(veh, "engineAcceleration", acceleration+2.8)
- elseif getElementData(veh, "vehicle:pojemnosc") == 8 then
- local acceleration = getVehicleHandling(veh).engineAcceleration
- local velocity = getVehicleHandling(veh).maxVelocity
- local kg = getVehicleHandling(veh).mass
- setElementData(veh, "vehicle:poj", "2.4")
- setVehicleHandling(veh, "mass", kg+17)
- setVehicleHandling(veh, "maxVelocity", velocity+2)
- setVehicleHandling(veh, "engineAcceleration", acceleration+2.9)
- elseif getElementData(veh, "vehicle:pojemnosc") == 9 then
- local acceleration = getVehicleHandling(veh).engineAcceleration
- local velocity = getVehicleHandling(veh).maxVelocity
- local kg = getVehicleHandling(veh).mass
- setElementData(veh, "vehicle:poj", "2.6")
- setVehicleHandling(veh, "mass", kg+20)
- setVehicleHandling(veh, "maxVelocity", velocity+2.2)
- setVehicleHandling(veh, "engineAcceleration", acceleration+3)
- elseif getElementData(veh, "vehicle:pojemnosc") == 10 then
- local acceleration = getVehicleHandling(veh).engineAcceleration
- local velocity = getVehicleHandling(veh).maxVelocity
- local kg = getVehicleHandling(veh).mass
- setElementData(veh, "vehicle:poj", "2.8")
- setVehicleHandling(veh, "mass", kg+22)
- setVehicleHandling(veh, "maxVelocity", velocity+2.5)
- setVehicleHandling(veh, "engineAcceleration", acceleration+3.5)
- elseif getElementData(veh, "vehicle:pojemnosc") == 11 then
- local acceleration = getVehicleHandling(veh).engineAcceleration
- local velocity = getVehicleHandling(veh).maxVelocity
- local kg = getVehicleHandling(veh).mass
- setElementData(veh, "vehicle:poj", "2.9")
- setVehicleHandling(veh, "mass", kg+25)
- setVehicleHandling(veh, "maxVelocity", velocity+2.6)
- setVehicleHandling(veh, "engineAcceleration", acceleration+3.6)
- elseif getElementData(veh, "vehicle:pojemnosc") == 12 then
- local acceleration = getVehicleHandling(veh).engineAcceleration
- local velocity = getVehicleHandling(veh).maxVelocity
- local kg = getVehicleHandling(veh).mass
- setElementData(veh, "vehicle:poj", "3.0")
- setVehicleHandling(veh, "mass", kg+27)
- setVehicleHandling(veh, "maxVelocity", velocity+2.8)
- setVehicleHandling(veh, "engineAcceleration", acceleration+3.8)
- elseif getElementData(veh, "vehicle:pojemnosc") == 13 then
- local acceleration = getVehicleHandling(veh).engineAcceleration
- local velocity = getVehicleHandling(veh).maxVelocity
- local kg = getVehicleHandling(veh).mass
- setElementData(veh, "vehicle:poj", "3.2")
- setVehicleHandling(veh, "mass", kg+30)
- setVehicleHandling(veh, "maxVelocity", velocity+2.9)
- setVehicleHandling(veh, "engineAcceleration", acceleration+4)
- elseif getElementData(veh, "vehicle:pojemnosc") == 14 then
- local acceleration = getVehicleHandling(veh).engineAcceleration
- local velocity = getVehicleHandling(veh).maxVelocity
- local kg = getVehicleHandling(veh).mass
- setElementData(veh, "vehicle:poj", "3.4")
- setVehicleHandling(veh, "mass", kg+33)
- setVehicleHandling(veh, "maxVelocity", velocity+3)
- setVehicleHandling(veh, "engineAcceleration", acceleration+4.1)
- elseif getElementData(veh, "vehicle:pojemnosc") == 15 then
- local acceleration = getVehicleHandling(veh).engineAcceleration
- local velocity = getVehicleHandling(veh).maxVelocity
- local kg = getVehicleHandling(veh).mass
- setElementData(veh, "vehicle:poj", "3.5")
- setVehicleHandling(veh, "mass", kg+34)
- setVehicleHandling(veh, "maxVelocity", velocity+3.1)
- setVehicleHandling(veh, "engineAcceleration", acceleration+4.2)
- elseif getElementData(veh, "vehicle:pojemnosc") == 16 then
- local acceleration = getVehicleHandling(veh).engineAcceleration
- local velocity = getVehicleHandling(veh).maxVelocity
- local kg = getVehicleHandling(veh).mass
- setElementData(veh, "vehicle:poj", "3.7")
- setVehicleHandling(veh, "mass", kg+36)
- setVehicleHandling(veh, "maxVelocity", velocity+3.2)
- setVehicleHandling(veh, "engineAcceleration", acceleration+4.3)
- elseif getElementData(veh, "vehicle:pojemnosc") == 17 then
- local acceleration = getVehicleHandling(veh).engineAcceleration
- local velocity = getVehicleHandling(veh).maxVelocity
- local kg = getVehicleHandling(veh).mass
- setElementData(veh, "vehicle:poj", "3.9")
- setVehicleHandling(veh, "mass", kg+40)
- setVehicleHandling(veh, "maxVelocity", velocity+3.5)
- setVehicleHandling(veh, "engineAcceleration", acceleration+4.5)
- elseif getElementData(veh, "vehicle:pojemnosc") == 18 then
- local acceleration = getVehicleHandling(veh).engineAcceleration
- local velocity = getVehicleHandling(veh).maxVelocity
- local kg = getVehicleHandling(veh).mass
- setElementData(veh, "vehicle:poj", "4.0")
- setVehicleHandling(veh, "mass", kg+43)
- setVehicleHandling(veh, "maxVelocity", velocity+4)
- setVehicleHandling(veh, "engineAcceleration", acceleration+4.9)
- elseif getElementData(veh, "vehicle:pojemnosc") == 19 then
- local acceleration = getVehicleHandling(veh).engineAcceleration
- local velocity = getVehicleHandling(veh).maxVelocity
- local kg = getVehicleHandling(veh).mass
- setElementData(veh, "vehicle:poj", "4.2")
- setVehicleHandling(veh, "mass", kg+44)
- setVehicleHandling(veh, "maxVelocity", velocity+4.1)
- setVehicleHandling(veh, "engineAcceleration", acceleration+5)
- elseif getElementData(veh, "vehicle:pojemnosc") == 20 then
- local acceleration = getVehicleHandling(veh).engineAcceleration
- local velocity = getVehicleHandling(veh).maxVelocity
- local kg = getVehicleHandling(veh).mass
- setElementData(veh, "vehicle:poj", "4.5")
- setVehicleHandling(veh, "mass", kg+45)
- setVehicleHandling(veh, "maxVelocity", velocity+4.5)
- setVehicleHandling(veh, "engineAcceleration", acceleration+5.5)
- elseif getElementData(veh, "vehicle:pojemnosc") == 21 then
- local acceleration = getVehicleHandling(veh).engineAcceleration
- local velocity = getVehicleHandling(veh).maxVelocity
- local kg = getVehicleHandling(veh).mass
- setElementData(veh, "vehicle:poj", "4.8")
- setVehicleHandling(veh, "mass", kg+46)
- setVehicleHandling(veh, "maxVelocity", velocity+4.8)
- setVehicleHandling(veh, "engineAcceleration", acceleration+5.8)
- elseif getElementData(veh, "vehicle:pojemnosc") == 22 then
- local acceleration = getVehicleHandling(veh).engineAcceleration
- local velocity = getVehicleHandling(veh).maxVelocity
- local kg = getVehicleHandling(veh).mass
- setElementData(veh, "vehicle:poj", "5.0")
- setVehicleHandling(veh, "mass", kg+50)
- setVehicleHandling(veh, "maxVelocity", velocity+5)
- setVehicleHandling(veh, "engineAcceleration", acceleration+6)
- elseif getElementData(veh, "vehicle:pojemnosc") == 23 then
- local acceleration = getVehicleHandling(veh).engineAcceleration
- local velocity = getVehicleHandling(veh).maxVelocity
- local kg = getVehicleHandling(veh).mass
- setElementData(veh, "vehicle:poj", "5.2")
- setVehicleHandling(veh, "mass", kg+52)
- setVehicleHandling(veh, "maxVelocity", velocity+6)
- setVehicleHandling(veh, "engineAcceleration", acceleration+7)
- elseif getElementData(veh, "vehicle:pojemnosc") == 24 then
- local acceleration = getVehicleHandling(veh).engineAcceleration
- local velocity = getVehicleHandling(veh).maxVelocity
- local kg = getVehicleHandling(veh).mass
- setElementData(veh, "vehicle:poj", "5.5")
- setVehicleHandling(veh, "mass", kg+55)
- setVehicleHandling(veh, "maxVelocity", velocity+7)
- setVehicleHandling(veh, "engineAcceleration", acceleration+8)
- elseif getElementData(veh, "vehicle:pojemnosc") == 25 then
- local acceleration = getVehicleHandling(veh).engineAcceleration
- local velocity = getVehicleHandling(veh).maxVelocity
- local kg = getVehicleHandling(veh).mass
- setElementData(veh, "vehicle:poj", "5.9")
- setVehicleHandling(veh, "mass", kg+59)
- setVehicleHandling(veh, "maxVelocity", velocity+8)
- setVehicleHandling(veh, "engineAcceleration", acceleration+9)
- elseif getElementData(veh, "vehicle:pojemnosc") == 26 then
- local acceleration = getVehicleHandling(veh).engineAcceleration
- local velocity = getVehicleHandling(veh).maxVelocity
- local kg = getVehicleHandling(veh).mass
- setElementData(veh, "vehicle:poj", "6.0")
- setVehicleHandling(veh, "mass", kg+60)
- setVehicleHandling(veh, "maxVelocity", velocity+10)
- setVehicleHandling(veh, "engineAcceleration", acceleration+11)
- elseif getElementData(veh, "vehicle:pojemnosc") == 27 then
- local acceleration = getVehicleHandling(veh).engineAcceleration
- local velocity = getVehicleHandling(veh).maxVelocity
- local kg = getVehicleHandling(veh).mass
- setElementData(veh, "vehicle:poj", "6.1")
- setVehicleHandling(veh, "mass", kg+61)
- setVehicleHandling(veh, "maxVelocity", velocity+10.8)
- setVehicleHandling(veh, "engineAcceleration", acceleration+11.9)
- elseif getElementData(veh, "vehicle:pojemnosc") == 28 then
- local acceleration = getVehicleHandling(veh).engineAcceleration
- local velocity = getVehicleHandling(veh).maxVelocity
- local kg = getVehicleHandling(veh).mass
- setElementData(veh, "vehicle:poj", "6.3")
- setVehicleHandling(veh, "mass", kg+63)
- setVehicleHandling(veh, "maxVelocity", velocity+11)
- setVehicleHandling(veh, "engineAcceleration", acceleration+13)
- elseif getElementData(veh, "vehicle:pojemnosc") == 29 then
- local acceleration = getVehicleHandling(veh).engineAcceleration
- local velocity = getVehicleHandling(veh).maxVelocity
- local kg = getVehicleHandling(veh).mass
- setElementData(veh, "vehicle:poj", "7.2")
- setVehicleHandling(veh, "mass", kg+72)
- setVehicleHandling(veh, "maxVelocity", velocity+15)
- setVehicleHandling(veh, "engineAcceleration", acceleration+17)
- elseif getElementData(veh, "vehicle:pojemnosc") == 30 then
- local acceleration = getVehicleHandling(veh).engineAcceleration
- local velocity = getVehicleHandling(veh).maxVelocity
- local kg = getVehicleHandling(veh).mass
- setElementData(veh, "vehicle:poj", "7.6")
- setVehicleHandling(veh, "mass", kg+76)
- setVehicleHandling(veh, "maxVelocity", velocity+17)
- setVehicleHandling(veh, "engineAcceleration", acceleration+18)
- elseif getElementData(veh, "vehicle:pojemnosc") == 31 then
- local acceleration = getVehicleHandling(veh).engineAcceleration
- local velocity = getVehicleHandling(veh).maxVelocity
- local kg = getVehicleHandling(veh).mass
- setElementData(veh, "vehicle:poj", "8.2")
- setVehicleHandling(veh, "mass", kg+82)
- setVehicleHandling(veh, "maxVelocity", velocity+19)
- setVehicleHandling(veh, "engineAcceleration", acceleration+19)
- elseif getElementData(veh, "vehicle:pojemnosc") == 32 then
- local acceleration = getVehicleHandling(veh).engineAcceleration
- local velocity = getVehicleHandling(veh).maxVelocity
- local kg = getVehicleHandling(veh).mass
- setElementData(veh, "vehicle:poj", "8.9")
- setVehicleHandling(veh, "mass", kg+89)
- setVehicleHandling(veh, "maxVelocity", velocity+20)
- setVehicleHandling(veh, "engineAcceleration", acceleration+18)
- elseif getElementData(veh, "vehicle:pojemnosc") == 33 then
- local acceleration = getVehicleHandling(veh).engineAcceleration
- local velocity = getVehicleHandling(veh).maxVelocity
- local kg = getVehicleHandling(veh).mass
- setElementData(veh, "vehicle:poj", "9.3")
- setVehicleHandling(veh, "mass", kg+93)
- setVehicleHandling(veh, "maxVelocity", velocity+22)
- setVehicleHandling(veh, "engineAcceleration", acceleration+22)
- elseif getElementData(veh, "vehicle:pojemnosc") == 34 then
- local acceleration = getVehicleHandling(veh).engineAcceleration
- local velocity = getVehicleHandling(veh).maxVelocity
- local kg = getVehicleHandling(veh).mass
- setElementData(veh, "vehicle:poj", "40kWh")
- setVehicleHandling(veh, "mass", kg+4)
- setVehicleHandling(veh, "maxVelocity", velocity+4)
- setVehicleHandling(veh, "engineAcceleration", acceleration+8)
- elseif getElementData(veh, "vehicle:pojemnosc") == 35 then
- local acceleration = getVehicleHandling(veh).engineAcceleration
- local velocity = getVehicleHandling(veh).maxVelocity
- local kg = getVehicleHandling(veh).mass
- setElementData(veh, "vehicle:poj", "60kWh")
- setVehicleHandling(veh, "mass", kg+8)
- setVehicleHandling(veh, "maxVelocity", velocity+7)
- setVehicleHandling(veh, "engineAcceleration", acceleration+13)
- elseif getElementData(veh, "vehicle:pojemnosc") == 36 then
- local acceleration = getVehicleHandling(veh).engineAcceleration
- local velocity = getVehicleHandling(veh).maxVelocity
- local kg = getVehicleHandling(veh).mass
- setElementData(veh, "vehicle:poj", "85kWh")
- setVehicleHandling(veh, "mass", kg+10)
- setVehicleHandling(veh, "maxVelocity", velocity+10)
- setVehicleHandling(veh, "engineAcceleration", acceleration+15)
- elseif getElementData(veh, "vehicle:pojemnosc") == 37 then
- local acceleration = getVehicleHandling(veh).engineAcceleration
- local velocity = getVehicleHandling(veh).maxVelocity
- local kg = getVehicleHandling(veh).mass
- setElementData(veh, "vehicle:poj", "P90d")
- setVehicleHandling(veh, "mass", kg+15)
- setVehicleHandling(veh, "maxVelocity", velocity+15)
- setVehicleHandling(veh, "engineAcceleration", acceleration+22)
- end
- if getElementHealth(veh) < 1000 then
- local zyciepojazdu = getVehicleHandlingProperty(veh,"maxVelocity")
- setVehicleHandling(veh, "maxVelocity", zyciepojazdu-5.5);
- elseif getElementHealth(veh) < 900 then
- local zyciepojazdu = getVehicleHandlingProperty(veh,"maxVelocity")
- setVehicleHandling(veh, "maxVelocity", zyciepojazdu-10.5);
- elseif getElementHealth(veh) < 800 then
- local zyciepojazdu = getVehicleHandlingProperty(veh,"maxVelocity")
- setVehicleHandling(veh, "maxVelocity", zyciepojazdu-30);
- elseif getElementHealth(veh) < 700 then
- local zyciepojazdu = getVehicleHandlingProperty(veh,"maxVelocity")
- setVehicleHandling(veh, "maxVelocity", zyciepojazdu-40.5);
- elseif getElementHealth(veh) < 600 then
- local zyciepojazdu = getVehicleHandlingProperty(veh,"maxVelocity")
- setVehicleHandling(veh, "maxVelocity", zyciepojazdu-50);
- elseif getElementHealth(veh) < 500 then
- local zyciepojazdu = getVehicleHandlingProperty(veh,"maxVelocity")
- setVehicleHandling(veh, "maxVelocity", zyciepojazdu-60.5);
- elseif getElementHealth(veh) < 400 then
- local zyciepojazdu = getVehicleHandlingProperty(veh,"maxVelocity")
- setVehicleHandling(veh, "maxVelocity", zyciepojazdu-70);
- elseif getElementHealth(veh) < 300 then
- local zyciepojazdu = getVehicleHandlingProperty(veh,"maxVelocity")
- setVehicleHandling(veh, "maxVelocity", zyciepojazdu-80.5);
- end
- --local mk1 = vehicle['mk1']
- --local mk2 = vehicle['mk2']
- --local mk3 = vehicle['mk3']
- --local gleba = vehicle['gleba']
- local rh = vehicle['rh']
- if (type(vehicle['rent']) == "string") then
- local tabelka = {}
- local rente = split(vehicle['rent'], ',')
- for k,v in ipairs(rente) do
- table.insert(tabelka,v)
- end
- setElementData(veh,"vehicle:rent", tabelka or false)
- else
- setElementData(veh,"vehicle:rent",0)
- end
- local mk1 = vehicle['mk1']
- if tonumber(mk1) ~= 0 then
- local masa = getVehicleHandlingProperty(veh,"mass")
- local masa2 = getVehicleHandlingProperty(veh,"turnMass")
- local xd = getVehicleHandlingProperty(veh,"tractionMultiplier")
- local coef = getVehicleHandlingProperty(veh,"dragCoeff")
- local skret = getVehicleHandlingProperty(veh,"steeringLock")
- setVehicleHandling(veh,"mass",masa+25)
- setVehicleHandling(veh,"steeringLock", skret+15.7)
- setVehicleHandling(veh,"tractionMultiplier",xd+0.1)
- setVehicleHandling(veh,"dragCoeff",coef+0.07)
- end
- local mk2 = vehicle['mk2']
- if tonumber(mk1) ~= 0 then
- local fast = getVehicleHandlingProperty(veh,"engineAcceleration")
- local maxfast = getVehicleHandlingProperty(veh,"maxVelocity")
- local masa = getVehicleHandlingProperty(veh,"mass")
- local masa2 = getVehicleHandlingProperty(veh,"turnMass")
- local xd = getVehicleHandlingProperty(veh,"tractionMultiplier")
- local coef = getVehicleHandlingProperty(veh,"dragCoeff")
- setVehicleHandling(veh,"engineAcceleration",fast+1)
- setVehicleHandling(veh,"maxVelocity",maxfast+10)
- setVehicleHandling(veh,"tractionMultiplier",xd+0.1)
- setVehicleHandling(veh,"mass",masa+10)
- setVehicleHandling(veh,"dragCoeff",coef+0.07)
- end
- local mk3 = vehicle['mk3']
- if tonumber(mk3) ~= 0 then
- local fast = getVehicleHandlingProperty(veh,"engineAcceleration")
- local maxfast = getVehicleHandlingProperty(veh,"maxVelocity")
- local masa = getVehicleHandlingProperty(veh,"mass")
- local masa2 = getVehicleHandlingProperty(veh,"turnMass")
- local xd = getVehicleHandlingProperty(veh,"tractionMultiplier")
- local coef = getVehicleHandlingProperty(veh,"dragCoeff")
- setVehicleHandling(veh,"engineAcceleration",fast+2)
- setVehicleHandling(veh,"driveType", "awd")
- setVehicleHandling(veh,"maxVelocity",maxfast+2)
- setVehicleHandling(veh,"tractionMultiplier",xd+0.1)
- setVehicleHandling(veh,"mass",masa+15)
- setVehicleHandling(veh,"dragCoeff",coef+0.01)
- end
- local mk4 = vehicle['mk4']
- if tonumber(mk4) ~= 0 then
- local fast = getVehicleHandlingProperty(veh,"engineAcceleration")
- local maxfast = getVehicleHandlingProperty(veh,"maxVelocity")
- local masa = getVehicleHandlingProperty(veh,"mass")
- local masa2 = getVehicleHandlingProperty(veh,"turnMass")
- local xd = getVehicleHandlingProperty(veh,"tractionMultiplier")
- local coef = getVehicleHandlingProperty(veh,"dragCoeff")
- local skret = getVehicleHandlingProperty(veh,"steeringLock")
- local hamuj = getVehicleHandlingProperty(veh,"brakeDeceleration")
- setVehicleHandling(veh,"engineAcceleration",fast+1)
- setVehicleHandling(veh,"maxVelocity",maxfast+0.1)
- setVehicleHandling(veh,"mass",masa+50)
- setVehicleHandling(veh,"steeringLock", skret+5.7)
- setVehicleHandling(veh,"tractionMultiplier",xd+0.1)
- setVehicleHandling(veh,"dragCoeff",coef+0.07)
- setVehicleHandling(veh,"brakeDeceleration",hamuj+15)
- end
- local hood = vehicle['removehood']
- if tonumber(hood) == 1 then
- setElementData(veh,"vehicle:bonnet",true)
- end
- local mask = vehicle['masked']
- if tonumber(mask) ~= 0 then
- setElementData(veh,"vehicle:masked",vehicle['masked'])
- end
- setElementData(veh,"neony", vehicle["neon"])
- if vehicle["blokada"] == "true" then
- setElementData(veh,"vehicle:block", true)
- setVehicleWheelStates(veh, 2, 2, 2, 2)
- else
- setElementData(veh,"vehicle:block", false)
- end
- local rodzajneonu=tonumber(getElementData(veh,"neony"))
- if getElementData(veh,"neony") ~= 0 then
- local m = getElementModel(veh)
- local of
- if not nlOffsets[m] then
- of={-1,0,-0.5}
- else
- of=nlOffsets[m]
- end
- neon1=createObject(nlIDX[rodzajneonu],0,0,0)
- neon2=createObject(nlIDX[rodzajneonu],0,0,0)
- setElementData(veh,"zneony", {neon1, neon2})
- attachElements(neon1,veh,of[1],of[2],of[3])
- attachElements(neon2,veh,-of[1],of[2],of[3])
- end
- for i,v in ipairs(split(vehicle["tuning"], ",")) do addVehicleUpgrade(veh, v) end
- for i,v in ipairs(split(vehicle["panelstates"], ",")) do setVehiclePanelState(veh, i, tonumber(v)) end
- setVehicleDamageProof(veh, true)
- end
- outputDebugString("[MStories] Zaladowano "..vehicles.." pojazdow.")
- end
- --///////////////////////////////////// ZAPISYWANIE POJAZDÓW /////////////////////////////////
- function onSaveVehicle(vehicle)
- if getElementData(vehicle,"vehicle:spawn") then
- -- Setting
- local panelstates={}
- local model=getElementModel(vehicle)
- local health=getElementHealth(vehicle)
- local x,y,z=getElementPosition(vehicle)
- local rx,ry,rz=getElementRotation(vehicle)
- local desc=getElementData(vehicle,"vehicle:desc") or ""
- local id=getElementData(vehicle,"vehicle:id")
- local fuel=getElementData(vehicle,"vehicle:fuel")
- local mileage=getElementData(vehicle,"vehicle:mileage")
- local c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12=getVehicleColor(vehicle, true)
- local driver=getElementData(vehicle,"vehicle:driver") or ""
- local rent=getElementData(vehicle,"vehicle:rent")
- local player=getElementData(vehicle,"vehicle:ownedPlayer")
- local blokada=getElementData(vehicle,"vehicle:block")
- local naped=getElementData(vehicle,"vehicle:naped")
- local neon=getElementData(vehicle,"neony")
- local h1,h2,h3=getVehicleHeadLightColor(vehicle)
- local paintjob=getVehiclePaintjob(vehicle)
- local rear="Brak"
- local mask=getElementData(vehicle,"vehicle:masked") or 0
- local frozen= isElementFrozen(vehicle) and 1 or 0
- local v1,v2 = getVehicleVariant(vehicle)
- for i=0,6 do table.insert(panelstates, getVehiclePanelState(vehicle,i)) end
- panelstates=table.concat(panelstates,",")
- upgrades=getVehicleUpgrades(vehicle)
- if not upgrades then upgrades={} end
- upgrades=table.concat(upgrades, ",")
- -- Query
- local query = exports["pystories-db"]:dbSet(string.format("UPDATE pystories_vehicles SET model='%d', pos='%.2f,%.2f,%.2f,%.2f,%.2f,%.2f', rent='%d',text='%s', masked='%d', health='%d', fuel='%d', mileage='%d', frozen='%d', driver='%s', color='%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d', panelstates='%s', paintjob='%d', tuning='%s', headlights='%d,%d,%d', ownedPlayer='%d', naped='%s', neon='%d', v1='%d', v2='%d', blokada='%s' WHERE id=%d",
- model, x,y,z, rx,ry,rz, "0",desc, mask, health, fuel, mileage, frozen, driver, c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12, panelstates, paintjob, upgrades, h1,h2,h3, player, naped, neon, v1,v2, tostring(blokada), id))
- if (type(rent) == "table") then
- local rr = string.format("%s", table.concat(rent, ',') )
- -- outputDebugString(rr)
- local query2= exports['pystories-db']:dbSet("UPDATE pystories_vehicles SET rent=? WHERE id=?",rr,id)
- end
- end
- end
- function onParkVehicle(vehicle)
- local query=exports["pystories-db"]:dbSet("UPDATE pystories_vehicles SET parking=1 WHERE id=?", getElementData(vehicle,"vehicle:id"))
- if query then
- local zneony=getElementData(vehicle,"zneony")
- if (zneony and type(zneony)=="table") then
- destroyElement(zneony[1])
- destroyElement(zneony[2])
- removeElementData(vehicle,"zneony")
- end
- destroyElement(vehicle)
- end
- end
- --///////////////////////////////////// SPRAWDZANIE USTAWIEŃ /////////////////////////////////
- function getSettings(plr,code,value)
- local sid=getElementData(plr,"player:sid")
- local uid=getElementData(plr,"player:sid")
- if not sid then return end
- if value == "faction" then
- local result=exports["pystories-db"]:dbGet("SELECT * FROM pystories_factions WHERE code=? AND sid=?", code, sid)
- if result and #result > 0 then
- return result[1].code
- else
- return false
- end
- end
- if value == "organization" then
- local result=exports["pystories-db"]:dbGet("SELECT * FROM ogrpg_organizations WHERE uid=?", uid)
- if result and #result > 0 then
- return result[1].code
- else
- return false
- end
- end
- if value == "owner" then
- local result=exports["pystories-db"]:dbGet("SELECT * FROM pystories_users WHERE id=?", sid)
- if result and #result > 0 then
- return result[1].id
- else
- return false
- end
- end
- end
- --///////////////////////////////////// INNE USTAWIENIA /////////////////////////////////
- addEventHandler("onVehicleExit", root, function(plr,seat)
- if seat ~= 0 then return end
- onSaveVehicle(plr)
- setVehicleEngineState(plr, false)
- setVehicleDamageProof(plr, true)
- unbindKey(plr, 'n', 'down', bindHoron4)
- end)
- addEventHandler("onPlayerQuit", root, function()
- local veh=getPedOccupiedVehicle(source)
- if veh then
- setVehicleDamageProof(source, true)
- onSaveVehicle(veh)
- end
- end)
- addEventHandler("onResourceStop", resourceRoot, function()
- for i,v in ipairs(getElementsByType("vehicle")) do
- onSaveVehicle(v)
- local zneony=getElementData(v,"zneony")
- if (zneony and type(zneony)=="table") then
- destroyElement(zneony[1])
- destroyElement(zneony[2])
- removeElementData(v,"zneony")
- end
- end
- outputDebugString("[MStories] Zapisano wszystkie pojazdy!")
- end)
- addEventHandler("onVehicleEnter", root, function(plr,seat)
- if seat ~= 0 then return end
- setVehicleEngineState(source, false)
- setElementData(source,"vehicle:driver",getPlayerName(plr))
- if getElementData(source,"vehicle:taxo") == 1 then
- outputChatBox("* Posiadasz taxometr.",plr,255,255,255,true)
- end
- end)
- addEventHandler("onVehicleEnter", root, function(plr,seat)
- if seat ~= 0 then return end
- setVehicleEngineState(source, false)
- setElementData(source,"vehicle:driver",getPlayerName(plr))
- if getElementData(source,"neony") and getElementData(source,"neony") ~= 0 then
- outputChatBox("* Posiadasz neony w pojezdzie, możesz wlączyć i wylaczyc je za pomocą przycisku N.",plr)
- bindKey(plr, 'n', 'down', bindHoron4, plr)
- end
- end)
- --///////////////////////////////////// SPRAWDZENIE WŁAŚCICIELA /////////////////////////////////
- addEventHandler("onVehicleStartEnter", resourceRoot, function(plr,seat,jacked)
- if seat == 0 then
- local rent=getElementData(source, "vehicle:rent")
- local group=getElementData(source, "vehicle:ownedGroup")
- if group == "0" then group = "Brak" end
- local player=getElementData(source, "vehicle:ownedPlayer")
- if getAdmin2(plr, 4) then
- return
- end
- if rent and (type(rent) == "table") then
- for i,s in pairs(rent) do
- if tonumber(s) == getElementData(plr,"player:sid") then
- return end
- end
- end
- local plrgroup = getElementData(plr,"player:organization")
- if plrgroup then
- if getSettings(plr,false,"organization") == group then return end
- end
- if player and player ~= getSettings(plr,false,"owner") then
- outputChatBox("* Nie posiadasz kluczyków do tego pojazdu.", plr)
- cancelEvent()
- end
- end
- end)
- addEventHandler("onVehicleStartEnter", root, function(plr,seat,jacked)
- if jacked then
- if getElementData(source,"vehicle:ownedPlayer") == getElementData(plr,"player:sid") then return end
- cancelEvent()
- end
- end)
- addEventHandler("onVehicleStartEnter", root, function(plr,seat,jacked)
- if seat == 0 then
- if getElementData(source,"spawnowany")== true then
- if getElementData(plr,"player:admin")== false then
- cancelEvent()
- end
- end
- end
- end)
- function bindHoron4(plr)
- veh=getPedOccupiedVehicle(plr)
- if not veh then return end
- local rodzajneonu=tonumber(getElementData(veh,"neony"))
- if not rodzajneonu then return end
- if rodzajneonu==0 then
- outputChatBox('* Brak Neonow.', plr, 255, 0 ,0)
- return end
- local zneony=getElementData(veh,"zneony")
- if (zneony and type(zneony)=="table") then
- destroyElement(zneony[1])
- destroyElement(zneony[2])
- removeElementData(veh,"zneony")
- --triggerClientEvent(plr,"addNotification",root,'* Wyłączyłeś Neony.',"warning")
- outputChatBox("* Odłączyłeś(aś) neony od pojazdu.",plr)
- else
- local m = getElementModel(veh)
- local of
- if not nlOffsets[m] then
- of={-1,0,-0.5}
- else
- of=nlOffsets[m]
- end
- neon1=createObject(nlIDX[rodzajneonu],0,0,0)
- neon2=createObject(nlIDX[rodzajneonu],0,0,0)
- setElementData(veh,"zneony", {neon1, neon2})
- attachElements(neon1,veh,of[1],of[2],of[3])
- attachElements(neon2,veh,-of[1],of[2],of[3])
- --triggerClientEvent(plr,"addNotification",root,'* Włączyłeś Neony. Pojawią się one jak poruszysz pojazdem!',"info")
- outputChatBox("* Załączyłeś(aś) neony w pojeździe.",plr)
- end
- end
- addEventHandler("onElementDestroy", getRootElement(), function ()
- if getElementType(source) == "vehicle" then
- local zneony=getElementData(source,"zneony")
- if (zneony and type(zneony)=="table") then
- destroyElement(zneony[1])
- destroyElement(zneony[2])
- removeElementData(source,"zneony")
- end
- end
- end)
- addEventHandler("onResourceStart", resourceRoot, function() onRespawnVehicles(_,false) end)
- local categoryA={[463] = true,[462] = true,[461] = true,[581] = true,[448] = true,[468] = true,[471] = true,[521] = true,[522] = true,[523] = true}
- local categoryB={[602] = true,[545] = true,[496] = true,[517] = true,[401] = true,[410] = true,[518] = true,[600] = true,[527] = true,[436] = true,[589] = true,[580] = true,[419] = true,[439] = true,[533] = true,[549] = true,[526] = true,[491] = true,[474] = true,[445] = true,[467] = true,[604] = true,[426] = true,[507] = true,[547] = true,[585] = true,[405] = true,[587] = true,[409] = true,[466] = true,[550] = true,[492] = true,[566] = true,[546] = true,[540] = true,[551] = true,[421] = true,[516] = true,[529] = true,[488] = true,[460] = true,
- [469] = true,[487] = true,[510] = true,[509] = true,[481] = true,[586] = true,[472] = true,[473] = true,[493] = true,[595] = true,[484] = true,[430] = true,[453] = true,[452] = true,[446] = true,[454] = true,[485] = true,[552] = true,
- [438] = true,[574] = true,[420] = true,[525] = true,[408] = true,[596] = true,[597] = true,[427] = true,[599] = true,[490] = true,[432] = true,[528] = true,[601] = true,[407] = true,[544] = true,[470] = true,[598] = true,[588] = true,
- [532] = true,[443] = true,[486] = true,[531] = true,[543] = true,[422] = true,[583] = true,[478] = true,[605] = true,[554] = true,[530] = true,[418] = true,[572] = true,[582] = true,[536] = true,[575] = true,[534] = true,
- [567] = true,[535] = true,[576] = true,[412] = true,[402] = true,[542] = true,[603] = true,[475] = true,[449] = true,[537] = true,[570] = true,[441] = true,[464] = true,[501] = true,[465] = true,[564] = true,[568] = true,[557] = true,[424] = true,[504] = true,[495] = true,[457] = true,[539] = true,[483] = true,[571] = true,[500] = true,
- [444] = true,[556] = true,[429] = true,[411] = true,[541] = true,[559] = true,[415] = true,[561] = true,[480] = true,[560] = true,[562] = true,[506] = true,[565] = true,[451] = true,[434] = true,[558] = true,[494] = true,[555] = true,[502] = true,[477] = true,[503] = true,[579] = true,[400] = true,[404] = true,[489] = true,[505] = true,[479] = true,[442] = true,[458] = true,
- [606] = true,[607] = true,[610] = true,[590] = true,[569] = true,[611] = true,[584] = true,[608] = true,[435] = true,[450] = true,[591] = true,[594] = true}
- local categoryC={[403] = true,[406] = true,[413] = true,[414] = true,[416] = true,[423] = true,[428] = true,[431] = true,[433] = true,[437] = true,[440] = true,[455] = true,[456] = true,[459] = true,[482] = true,[498] = true,[499] = true,[508] = true,[514] = true,[515] = true,[524] = true,[538] = true,[573] = true}
- addEventHandler("onVehicleStartEnter", resourceRoot, function(plr,seat,jacked)
- if seat == 0 then
- if categoryA[getElementModel(source)] then
- if exports["pystories-ustawienia-prac"]:getVehicleLicense(plr,"A") then
- cancelEvent()
- end
- elseif categoryB[getElementModel(source)] then
- if exports["pystories-ustawienia-prac"]:getVehicleLicense(plr,"B") then
- cancelEvent()
- end
- elseif categoryC[getElementModel(source)] then
- if exports["pystories-ustawienia-prac"]:getVehicleLicense(plr,"C") then
- cancelEvent()
- end
- end
- end
- end)
- addEventHandler("onVehicleEnter", getRootElement(), function(plr,seat,jacked)
- if seat ~= 0 then return end
- if getElementData(source, "vehicle:id") and getElementData(source, "vehicle:spawn") then
- --local gleba = exports['pystories-db']:dbGet("SELECT * FROM pystories_vehicles WHERE id=? AND gleba=?",getElementData(source, "vehicle:id"), "1")
- --local mk2 = exports['pystories-db']:dbGet("SELECT * FROM pystories_vehicles WHERE id=? AND mk2=?",getElementData(source, "vehicle:id"), "1")
- --local mk1 = exports['pystories-db']:dbGet("SELECT * FROM pystories_vehicles WHERE id=? AND mk1=?",getElementData(source, "vehicle:id"), "1")
- local rh = exports['pystories-db']:dbGet("SELECT * FROM pystories_vehicles WHERE id=? AND rh=?",getElementData(source, "vehicle:id"), "1")
- --local mk3 = exports['pystories-db']:dbGet("SELECT * FROM pystories_vehicles WHERE id=? AND mk3=?",getElementData(source, "vehicle:id"), "1")
- end
- end)
- local strefa = { }
- local strefy = {
- {1336.23840, 656.78876, 9.85624, 60.50634765625, 146.80010986328, 16.164074325562 },
- {924.07690, 1661.90576, 9.25354, 194.91711425781, 138.31750488281, 23.899999046326},
- {2197.99780, 2405.43872, -31.81085, 178.1982421875, 112.3896484375, 57.499998474121},
- }
- local ogranicznik = createElement ("ogranicznik");
- for i,v in ipairs ( strefy ) do
- strefa[i] = createColCuboid ( v [ 1 ], v [ 2 ], v [ 3 ], v [ 4 ], v [ 5 ], v [ 6 ], v [7] )
- setElementParent (strefa [i], ogranicznik);
- end
- addEventHandler("onColShapeHit", ogranicznik, function(el,md)
- if getElementType(el)=="vehicle" then
- setElementData(el,"vehicle:tempspeed", 50)
- end
- end)
- addEventHandler("onColShapeLeave", ogranicznik, function(el,md)
- if getElementType(el)=="vehicle" then
- removeElementData(el,"vehicle:tempspeed")
- end
- end)
- addEventHandler("onVehicleEnter", root, function(plr,seat,jacked)
- if source then
- if source and getElementData(source,"vehicle:masked") then
- setElementData(plr,"player:old:nick",getPlayerName(plr))
- local x = string.format("#040707%s",getPlayerName(plr):gsub("#%x%x%x%x%x%x",""))
- setPlayerName(plr,x)
- end
- end
- end)
- addEventHandler("onVehicleExit", root, function(plr,seat,jacked)
- if source then
- if source and getElementData(source,"vehicle:masked") then
- local name = getElementData(plr,"player:old:nick")
- setPlayerName(plr,name)
- end
- end
- end)
- addEventHandler("onElementDestroy", root, function()
- if getElementType(source) ~= "vehicle" then return end
- if getElementData(source,"vehicle:masked") then
- for i,p in pairs(getVehicleOccupants(source)) do
- local name = getElementData(p,"player:old:nick")
- setPlayerName(p,name)
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment