Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2019-02-15, 22:31


Pyrek24







Wiek: 25
Na forum: 3438 dni
Posty: 546
Nick w MP: Pyrek

Piwa: 10

Respekt: 50

Witam ot?? mam kod tabela w mysql zrobiona wszystko git tylko z element data veh:cb niezbyt, nie nadaje poje?dzie element daty veh:cb pomo?e kto? ?
kod
s

addEvent("cb"true)
addEventHandler("cb"root, function()
pojazd getPedOccupiedVehicle(source)
if not pojazd then return end
if (getPlayerMoney(source) > tonumber(cb)) then
  local id getElementData(pojazd"vehicle:id")
  local cb getElementData(pojazd"veh:cb")
  exports["ogrpg-db"]:dbSet("UPDATE ogrpg_vehicles SET cb=1 WHERE id=?"id)
     setElementData (pojazd"veh:cb")
     outputChatBox("* Pomy?lnie zamontowano CB-RADIO."source,true)
     outputChatBox("* Oddaj auto do przecho aby zobaczy? efekty!"source,true)
     takePlayerMoneysourcecb )
  else
     outputChatBox("* Nie sta? Ci? na to."source,true)
end
end
)


Podpis
amta
Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-02-15, 22:56


Mikołajj







Wiek: 22
Na forum: 2885 dni
Posty: 303
Nick w MP: Mikołaj

Piwa: 132

Respekt: 91

Dlaczego w setElementData nie ma wartosci dla daty veh:cb?
Spr?buj tak:

addEvent("cb"true)
addEventHandler("cb"root, function()
    local pojazd getPedOccupiedVehicle(source)
    local cb getElementData(pojazd"veh:cb")
    local id getElementData(pojazd"vehicle:id")

    if pojazd then
        if getPlayerMoney(source) > tonumber(cbthen
            exports["ogrpg-db"]:dbSet("UPDATE ogrpg_vehicles SET cb=1 WHERE id=?"id)
            setElementData(pojazd"veh:cb""1")
            outputChatBox("* Pomy?lnie zamontowano CB-RADIO."sourcetrue)
            outputChatBox("* Oddaj auto do przecho aby zobaczy? efekty!"sourcetrue)
            takePlayerMoney(sourcecb)
        else
            outputChatBox("* Nie sta? Ci? na to."sourcetrue)
        end
    end
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-02-15, 23:27


Pyrek24







Wiek: 25
Na forum: 3438 dni
Posty: 546
Nick w MP: Pyrek

Piwa: 10

Respekt: 50

kod cb radia
--[[
AutorMalentas (pomagavalue)
DlaOur New Hope
Nie masz prawa do urzywaniaudostepniania kodu bez mojej zgody!!
]]

addCommandHandler("cb", function (playercommand, ...)
    local veh getPedOccupiedVehicle(player)
    if not veh then
        outputChatBox("Musisz by? w poje?dzie"player25500)
        return
    end
    if getElementData(veh,"veh:cb") ~= 1 then
      outputChatBox("Nie posiadasz radia CB"player255,0,0)
      return
    end
    if not ... then
        local chat getElementData(player"user:cboff")
        if chat == true then -- CB jest wy??czone
            outputChatBox("W??czasz radio CB"player25500)
            setElementData(player"user:cboff"false)
        else -- CB jest w??czony
            outputChatBox("Wy??czasz radio CB"player25500)
            setElementData(player"user:cboff"true)
        end  
        return
    end
    local text table.concat({...}, " ")
    for i,v in ipairs(getElementsByType("player")) do
        if isPedInVehicle(v) and not getElementData(v"user:cboff"then
            outputChatBox("#000000[CB-radio]#ffffff "..getPlayerName(player).." ["..getElementData(player"id").."]: "..textv255255255,true)
        end
    end
end)


dalej nie dzia?a ten monta?, dlatego kod da?em

Podpis
amta
Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-02-15, 23:51


Mikołajj







Wiek: 22
Na forum: 2885 dni
Posty: 303
Nick w MP: Mikołaj

Piwa: 132

Respekt: 91

B??dy w ds3?

addEvent("cb"true)
addEventHandler("cb"root, function()
    local pojazd getPedOccupiedVehicle(source)
    local cb getElementData(pojazd"veh:cb")
    local id getElementData(pojazd"vehicle:id")

    if pojazd then
        if getPlayerMoney(source) > tonumber(cbthen
            exports["ogrpg-db"]:dbSet("UPDATE ogrpg_vehicles SET cb=1 WHERE id=?"id)
            setElementData(pojazd"veh:cb"1)
            outputChatBox("* Pomy?lnie zamontowano CB-RADIO."sourcetrue)
            outputChatBox("* Oddaj auto do przecho aby zobaczy? efekty!"sourcetrue)
            takePlayerMoney(sourcecb)
        else
            outputChatBox("* Nie sta? Ci? na to."sourcetrue)
        end
    end
end)


Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
Pyrek24
Wysłany: 2019-02-16, 10:56


Pyrek24







Wiek: 25
Na forum: 3438 dni
Posty: 546
Nick w MP: Pyrek

Piwa: 10

Respekt: 50

Nie ma.

Podpis
amta
Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-02-16, 12:04


Wilq







Wiek: 24
Na forum: 4429 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Zacznijmy od podstawowego pytania, czy event "cb" si? wykonuje?

Drugie pytanie: otrzymujesz jakie? komunikaty przy wykonywaniu tego eventu (zak?adaj?c, ?e si? on wykonuje)?
Na przyk?ad: "* Nie sta? Ci? na to." ; "* Pomy?lnie zamontowano CB-RADIO.", kt?re? z tych.

Pod zmienn? 'cb' trzymasz status zamontowania CB-Radio, lepiej ustali? z g?ry cen? i j? p??niej pobiera?.

Spr?buj takie kodu:
addEvent("cb"true)
addEventHandler("cb"getRootElement(), function()
    local pojazd getPedOccupiedVehicle(source)
    if pojazd then
        local id getElementData(pojazd"vehicle:id")    
        if getPlayerMoney(source) > 100 then
            exports["ogrpg-db"]:dbSet("UPDATE ogrpg_vehicles SET cb=1 WHERE id=?"id)
            setElementData(pojazd"veh:cb"true)
            outputChatBox("* Pomy?lnie zamontowano CB-RADIO."sourcetrue)
            outputChatBox("* Oddaj auto do przecho aby zobaczy? efekty!"sourcetrue)
            takePlayerMoney(source100)
        else
            outputChatBox("* Nie sta? Ci? na to."sourcetrue)
        end
    end
end)


--[[
AutorMalentas (pomagavalue)
DlaOur New Hope
Nie masz prawa do urzywaniaudostepniania kodu bez mojej zgody!!
]]

addCommandHandler("cb", function (playercommand, ...)
    local veh getPedOccupiedVehicle(player)
    if not veh then
        outputChatBox("Musisz by? w poje?dzie"player25500)
        return
    end
    if not getElementData(veh"veh:cb"then
      outputChatBox("Nie posiadasz radia CB"player255,0,0)
      return
    end
    if not ... then
        local chat getElementData(player"user:cboff")
        if chat == true then -- CB jest wy??czone
            outputChatBox("W??czasz radio CB"player25500)
            setElementData(player"user:cboff"false)
        else -- CB jest w??czony
            outputChatBox("Wy??czasz radio CB"player25500)
            setElementData(player"user:cboff"true)
        end  
        return
    end
    local text table.concat({...}, " ")
    for i,v in ipairs(getElementsByType("player")) do
        if isPedInVehicle(v) and not getElementData(v"user:cboff"then
            outputChatBox("#000000[CB-radio]#ffffff "..getPlayerName(player).." ["..getElementData(player"id").."]: "..textv255255255,true)
        end
    end
end)


Je?li nie wykonujesz tego eventu, dodaj komend? do funkcji montuj?cej CB-Radio i sprawd? czy wszystko dzia?a jak nale?y.

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
Pyrek24
Wysłany: 2019-02-16, 13:31


Pyrek24







Wiek: 25
Na forum: 3438 dni
Posty: 546
Nick w MP: Pyrek

Piwa: 10

Respekt: 50

Okey, dzia?a z zapisem przecho? Help kto??
kod
vehicle
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 elementproperty )
    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["ogrpg-db"]:dbGet("SELECT * from ogrpg_admins WHERE serial=? AND level=?"getPlayerSerial(plr), level)
        if result and #result > 0 then
            return true
        else
            return false
        end
    else
        local result=exports["ogrpg-db"]:dbGet("SELECT * from ogrpg_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["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_vehicles WHERE parking=1 AND id=?"id)
        query=exports["ogrpg-db"]:dbSet("UPDATE ogrpg_vehicles SET parking=0 WHERE id=?"id)
    else
        result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_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(vehcolor[1], color[2], color[3], color[4],color[5], color[6], color[7], color[8],color[9], color[10], color[11], color[12])
        setVehicleHeadLightColor(vehlights[1], lights[2], lights[3])
        if vehicle["plateText"] ~= "" then
        setVehiclePlateText(vehvehicle["plateText"])
        else
         setVehiclePlateText(vehtostring("M "..vehicle["id"]))
        end
        setElementFrozen(veh, (vehicle["frozen"]) > 0)
        if vehicle["paintjob"] ~= 3 then
        setVehiclePaintjob(vehvehicle["paintjob"])
        end
        setElementHealth(vehvehicle["health"])
        setElementData(veh,"vehicle:spawn",true)
        setElementData(veh,"vehicle:id"vehicle["id"])
        setElementData(veh,"vehicle:fuel"vehicle["fuel"])
        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"])
        
        local mk1 vehicle['mk1']
        local mk2 vehicle['mk2']
        local mk3 vehicle['mk3']
        local mk4 vehicle['mk4']
        --[[local s18 vehicle['poj']
        local s20 vehicle['poj']
        local s22 vehicle['poj']
        local s24 vehicle['poj']
        local s26 vehicle['poj']--]]
        local h1 vehicle['ham']
        local h2 vehicle['ham']
        local h3 vehicle['ham']
        
        local g1 vehicle['kola']

        
        
        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
        
        
        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.5)
        setVehicleHandling(veh,"maxVelocity",maxfast+16)
        setVehicleHandling(veh,"mass",masa+100)
        setVehicleHandling(veh,"tractionMultiplier",xd+0.1)
        setVehicleHandling(veh,"steeringLock",40)
        setVehicleHandling(veh,"dragCoeff",coef-0.15)
        end
        
        if tonumber(mk2) ~= 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.7)
        setVehicleHandling(veh,"maxVelocity",maxfast+20)
        setVehicleHandling(veh,"tractionMultiplier",xd+0.2)
        setVehicleHandling(veh,"mass",masa+150)
        setVehicleHandling(veh,"steeringLock",42)
        setVehicleHandling(veh,"dragCoeff",coef-0.21)
        end
        
        if tonumber(mk3) ~= 0 then
        local fast getVehicleHandlingProperty(veh,"engineAcceleration")
        local maxfast getVehicleHandlingProperty(veh,"maxVelocity")
        setVehicleHandling(veh,"engineAcceleration",fast+1.7)
        setVehicleHandling(veh,"maxVelocity",maxfast+25)
        end
        
        if tonumber(mk4) ~= 0 then
        local fast getVehicleHandlingProperty(veh,"engineAcceleration")
        local maxfast getVehicleHandlingProperty(veh,"maxVelocity")
        setVehicleHandling(veh,"engineAcceleration",fast+1.8)
        setVehicleHandling(veh,"maxVelocity",maxfast+30)
        end
        
        if tonumber(h1) ~= 0 then
        local brake getVehicleHandlingProperty(veh,"brakeDeceleration")
        setVehicleHandling(veh,"brakeDeceleration",brake+6000)
        end
        
        if tonumber(h2) ~= 0 then
        local brake getVehicleHandlingProperty(veh,"brakeDeceleration")
        setVehicleHandling(veh,"brakeDeceleration",brake+8000)
        end
        
        if tonumber(h3) ~= 0 then
        local brake getVehicleHandlingProperty(veh,"brakeDeceleration")
        setVehicleHandling(veh,"brakeDeceleration",brake+10000)
        end
        

        
         if getElementData(veh"vehicle:capacity") == "1.2" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+0)
        elseif getElementData(veh"vehicle:capacity") == "1.4" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+0.1)
        elseif getElementData(veh"vehicle:capacity") == "1.6" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+0.2)
        elseif getElementData(veh"vehicle:capacity") == "1.8" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+0.3)
        elseif getElementData(veh"vehicle:capacity") == "2.0" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+0.4)
        elseif getElementData(veh"vehicle:capacity") == "2.2" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+0.5)
        elseif getElementData(veh"vehicle:capacity") == "2.4" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+0.6)
        elseif getElementData(veh"vehicle:capacity") == "2.6" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+0.7)
        elseif getElementData(veh"vehicle:capacity") == "2.8" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+0.8)
        elseif getElementData(veh"vehicle:capacity") == "3.0" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+0.9)
        elseif getElementData(veh"vehicle:capacity") == "3.2" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+1.1)
        elseif getElementData(veh"vehicle:capacity") == "3.4" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+1.2)
        elseif getElementData(veh"vehicle:capacity") == "3.6" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+1.3)
        elseif getElementData(veh"vehicle:capacity") == "3.8" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+1.4)
        end
        
        --TU potem silniczki zrobiePozdrawiam Pyrek
        
        --[[if tonumber(s18) ~= 0 then
        local coef getVehicleHandlingProperty(veh,"dragCoeff")
        local fast getVehicleHandlingProperty(veh,"engineAcceleration")
        local maxfast getVehicleHandlingProperty(veh,"maxVelocity")
        setVehicleHandling(veh,"engineAcceleration",fast+1)
        setVehicleHandling(veh,"maxVelocity",maxfast+200)
        setVehicleHandling(veh,"dragCoeff",coef-0.05)
        end
    
        if tonumber(s20) ~= 0 then
        local coef getVehicleHandlingProperty(veh,"dragCoeff")
        local fast getVehicleHandlingProperty(veh,"engineAcceleration")
        local maxfast getVehicleHandlingProperty(veh,"maxVelocity")
        setVehicleHandling(veh,"engineAcceleration",fast+1)
        setVehicleHandling(veh,"maxVelocity",maxfast+250)
        setVehicleHandling(veh,"dragCoeff",coef-0.10)
        end
        
        if tonumber(s22) ~= 0 then
        local coef getVehicleHandlingProperty(veh,"dragCoeff")
        local fast getVehicleHandlingProperty(veh,"engineAcceleration")
        local maxfast getVehicleHandlingProperty(veh,"maxVelocity")
        setVehicleHandling(veh,"engineAcceleration",fast+2)
        setVehicleHandling(veh,"maxVelocity",maxfast+300)
        setVehicleHandling(veh,"dragCoeff",coef-0.15)
        end
        
        if tonumber(s24) ~= 0 then
        local coef getVehicleHandlingProperty(veh,"dragCoeff")
        local fast getVehicleHandlingProperty(veh,"engineAcceleration")
        local maxfast getVehicleHandlingProperty(veh,"maxVelocity")
        setVehicleHandling(veh,"engineAcceleration",fast+3)
        setVehicleHandling(veh,"maxVelocity",maxfast+350)
        setVehicleHandling(veh,"dragCoeff",coef-0.20)
        end
        
        if tonumber(s26) ~= 0 then
        local coef getVehicleHandlingProperty(veh,"dragCoeff")
        local fast getVehicleHandlingProperty(veh,"engineAcceleration")
        local maxfast getVehicleHandlingProperty(veh,"maxVelocity")
        setVehicleHandling(veh,"engineAcceleration",fast+4)
        setVehicleHandling(veh,"maxVelocity",maxfast+400)
        setVehicleHandling(veh,"dragCoeff",coef-0.30)
        end--]]
        
    --[[    if vehicle["rearlights"] ~= "" then
        setElementData(veh,"vehicle:light"vehicle["rearlights"])
        else
        setElementData(veh,"vehicle:light""High Quality")
        end]]--
        setElementData(veh,"neony"vehicle["neon"])
        if vehicle["blokada"] == "true" then
            setElementData(veh,"vehicle:block"true)
            setVehicleWheelStates(veh2222)
        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[mthen
        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", {neon1neon2})
        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(vehvend
        for i,v in ipairs(split(vehicle["panelstates"], ",")) do setVehiclePanelState(vehitonumber(v)) end
        setVehicleDamageProof(vehtrue)
    end
    outputDebugString("[MoveRPG-Car] Pojazdy za?adowane w ilo?ci. "..vehicles.." pojazd?w.Pozdraiwam Pyrek :D.")
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(vehicletrue)
        local driver=getElementData(vehicle,"vehicle:driver") or ""
        local rent=getElementData(vehicle,"vehicle:rent")
        local player=getElementData(vehicle,"vehicle:ownedPlayer")
     --   local group=getElementData(vehicle,"vehicle:ownedGroup")
        local blokada=getElementData(vehicle,"vehicle:block")
        local neon=getElementData(vehicle,"neony")
        local h1,h2,h3=getVehicleHeadLightColor(vehicle)
        local paintjob=getVehiclePaintjob(vehicle)
        local rear="Brak"
        local frozenisElementFrozen(vehicle) and or 0
        for i=0,do table.insert(panelstatesgetVehiclePanelState(vehicle,i)) end
        panelstates=table.concat(panelstates,",")
        upgrades=getVehicleUpgrades(vehicle)
        if not upgrades then upgrades={} end
        upgrades=table.concat(upgrades",")
        -- Query
        local query exports["ogrpg-db"]:dbSet(string.format("UPDATE ogrpg_vehicles SET model='%d', pos='%.2f,%.2f,%.2f,%.2f,%.2f,%.2f', rent='%d',text='%s', 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', neon='%d', blokada='%s' WHERE id=%d",
        modelx,y,zrx,ry,rz"0",deschealthfuelmileagefrozendriverc1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12panelstatespaintjobupgradesh1,h2,h3playerneontostring(blokada), id))
        if (type(rent) == "table"then
        local rr string.format("%s"table.concat(rent',') )
    --    outputDebugString(rr)
        local query2exports['ogrpg-db']:dbSet("UPDATE ogrpg_vehicles SET rent=? WHERE id=?",rr,id)
        end
    end
end

function onParkVehicle(vehicle) 
    local query=exports["ogrpg-db"]:dbSet("UPDATE ogrpg_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:uid")
    if not sid then return end
    if value == "faction" then
        local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_factions WHERE code=? AND sid=?"codesid)
        if result and #result > 0 then
            return result[1].code
        else
            return false
        end
    end
    if value == "organization" then
        local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_organizations WHERE sid=?"sid)
        if result and #result > 0 then
            return result[1].code
        else
            return false
        end
    end
    if value == "owner" then
        local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_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(source)
       setVehicleEngineState(sourcefalse)
    setVehicleDamageProof(sourcetrue)
    unbindKey(plr'n''down'bindHoron4)
end)


addEventHandler("onPlayerQuit"root, function()
    local veh=getPedOccupiedVehicle(source)
    if veh then
        setVehicleDamageProof(sourcetrue)
        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("[MoveRPG-Car] Saved all vehicles!")
end)

addEventHandler("onVehicleEnter"root, function(plr,seat)
    if seat ~= 0 then return end
    setVehicleEngineState(sourcefalse)
    setElementData(source,"vehicle:driver",getPlayerName(plr))
    if getElementData(source,"neony") and getElementData(source,"neony") ~= 0 then
        --triggerClientEvent(plr,"addNotification",root,"* Posiadasz neony w pojezdzie, mo?esz wl?czy? i wylaczyc je za pomoc? przycisku H.","info")
        outputChatBox("* Posiadasz neony w pojezdzie, mo?esz wl?czy? i wylaczyc je za pomoc? przycisku N.",plr)
        bindKey(plr'n''down'bindHoron4plr)
    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(plr4then
            return
        end
        if rent and (type(rent) == "table"then
            for i,s in pairs(rent) do
                if tonumber(s) == getElementData(plr,"player:uid"then
                return end
            end
        end
        
        local plrgroup getElementData(plr,"player:organization")
        if plrgroup then
        --    outputDebugString(group)
            if getSettings(plr,false,"organization") == group then return end
        end
        if player and player ~= getSettings(plr,false,"owner"then
            --triggerClientEvent(plr,"addNotification",root,"* Nie masz kluczyk?w do tego pojazdu.","error")
            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:uid"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.'plr255,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[mthen
        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", {neon1neon2})
        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(_,falseend)


--[[
vehicles retrieval mechanizm wylawiajacy pojazdy z wody
@author Lukasz Biegaj <wielebny@bestplay.pl>
@author Karer <karer.programmer@gmail.com>
@author WUBE <wube@lss-rp.pl>
@copyright 2011-2013 Lukasz Biegaj <wielebny@bestplay.pl>
]]--



--[[function shuffle(t)
  local n #t
 
  while >= do
    -- n is now the last pertinent index
    local k math.random(n) -- <= <= n
    -- Quick swap
    t[n], t[k] = t[k], t[n]
    1
  end
  return t
end

local function vr()

    local pojazdy=getElementsByType("vehicle")

    if (#pojazdy<1) then return end

    local pojazdwoda={}
    for _,pojazd in ipairs(pojazdy) do
        if isElementInWater(pojazd) and not getVehicleController(pojazdthen
            local x,y,z=getElementPosition(pojazd)
            if (z<-1then
                table.insert(pojazdwoda,pojazd)
            end
        end
    end
    if (#pojazdwoda<1) then return end

    outputDebugString("system_wylawiania_aut> Pojazdow w wodzie/pod mapa: " .. #pojazdwoda)

    shuffle(pojazdwoda)
    
    local pojazd=pojazdwoda[1]
    if getElementData(pojazd"vehicle:spawn"then
        onParkVehicle(pojazd)
    else
        respawnVehicle(pojazd)
    end
end
setTimer(vr350000)--]]

--//////////////////////////////////////////////////////// Licencje

local categoryA={[463] = true,[462] = true,[461] = true,[581] = true,[448] = true,[468] = true,[471] = true,[521] = true,[522] = true,[523] = truelocal 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,[433] = 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}
local categoryD={[437] = true,[431] = true}
local categoryL={[592] = true,[577] = true,[511] = true,[512] = true,[593] = true,[520] = true,[553] = true,[476] = true,[519] = true,[460] = true,[513] = true,[548] = true,[425] = true,[417] = true,[487] = true,[488] = true,[497] = true,[563] = true,[447] = true,[469] = true}
addEventHandler("onVehicleStartEnter"resourceRoot, function(plr,seat,jacked)
    if seat == 0 then
        if categoryA[getElementModel(source)] then
           if exports["ogrpg-prace-settings"]:getVehicleLicense(plr,"A"then
            cancelEvent()
            end
        elseif categoryB[getElementModel(source)] then
            if exports["ogrpg-prace-settings"]:getVehicleLicense(plr,"B"then
            cancelEvent()
            end
        elseif categoryC[getElementModel(source)] then
            if exports["ogrpg-prace-settings"]:getVehicleLicense(plr,"C"then
            cancelEvent()
            end
            elseif categoryD[getElementModel(source)] then
            if exports["ogrpg-prace-settings"]:getVehicleLicense(plr,"D"then
            cancelEvent()
            end
                elseif categoryC[getElementModel(source)] then
            if exports["ogrpg-prace-settings"]:getVehicleLicense(plr,"L"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 mk2 exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND mk2=?",getElementData(source"vehicle:id"), "1")
local mk1 exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND mk1=?",getElementData(source"vehicle:id"), "1")
local mk3 exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND mk3=?",getElementData(source"vehicle:id"), "1")
local mk4 exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND mk4=?",getElementData(source"vehicle:id"), "1")
local gz exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND rh=?",getElementData(source"vehicle:id"), "1")
local np exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND naped=?",getElementData(source"vehicle:id"), "1")
local s18 exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND poj=?",getElementData(source"vehicle:id"), "s18")
local s20 exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND poj=?",getElementData(source"vehicle:id"), "s20")
local h1 exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND ham=?",getElementData(source"vehicle:id"), "1")
local h2 exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND ham=?",getElementData(source"vehicle:id"), "2")
local h3 exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND ham=?",getElementData(source"vehicle:id"), "3")
local g1 exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND kola=?",getElementData(source"vehicle:id"), "1")
if #mk1 > 0 then outputChatBox(" Pomy?lnie zaprogramowano MV1",plr,255,255,255) end
if #mk2 > 0 then outputChatBox(" Pomy?lnie zaprogramowano MV2",plr,255,255,255) end
if #mk3 > 0 then outputChatBox(" Pomy?lnie zaprogramowano MV3",plr,255,255,255) end
if #mk4 > 0 then outputChatBox(" Pomy?lnie zaprogramowano MV4",plr,255,255,255) end
if #gz > 0 then outputChatBox(" Pomy?lnie zaprogramowano GZ",plr,255,255,255) end
if #s18 > 0 then outputChatBox(" Pojazd posiada pojemno?c 1.8 dm3",plr,255,255,255) end
if #s20 > 0 then outputChatBox(" Pojazd posiada pojemno?c 2.0 dm3",plr,255,255,255) end
if #h1 > 0 then outputChatBox(" Pojazd posiada hamulce Monolityczne !",plr,255,255,255) end
if #h2 > 0 then outputChatBox(" Pojazd posiada hamulce Wentylowane !",plr,255,255,255) end
if #h3 > 0 then outputChatBox(" Pojazd posiada hamulce Ceramiczne !",plr,255,255,255) end
if #g1 > 0 then outputChatBox(" Pojazd posiada ogumienie o grubo?ci I",plr,255,255,255) end
end
end)

local strefa = { }
local strefy = {
    {1336.23840656.788769.8562460.50634765625146.8001098632816.164074325562 },
    {924.076901661.905769.25354194.91711425781138.3175048828123.899999046326},
    {2197.997802405.43872, -31.81085178.1982421875112.389648437557.499998474121},
}
 
local ogranicznik createElement ("ogranicznik");
for i,v in ipairs strefy  ) do
     strefa[i] = createColCuboid ], ], ], ], ], ], [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)


Pom?g?by kto? t? element dat? z przecho zapisa? ?[lua][/lua]

Podpis
amta
Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-02-16, 16:31


Gravgor







Wiek: 22
Na forum: 3620 dni
Posty: 380
Nick w MP: 1944

Piwa: 702

Respekt: 57,8

"Pyrek24" napisał/a:

Okey, dzia?a z zapisem przecho? Help kto??
kod
vehicle
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 elementproperty )
    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["ogrpg-db"]:dbGet("SELECT * from ogrpg_admins WHERE serial=? AND level=?"getPlayerSerial(plr), level)
        if result and #result > 0 then
            return true
        else
            return false
        end
    else
        local result=exports["ogrpg-db"]:dbGet("SELECT * from ogrpg_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["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_vehicles WHERE parking=1 AND id=?"id)
        query=exports["ogrpg-db"]:dbSet("UPDATE ogrpg_vehicles SET parking=0 WHERE id=?"id)
    else
        result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_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(vehcolor[1], color[2], color[3], color[4],color[5], color[6], color[7], color[8],color[9], color[10], color[11], color[12])
        setVehicleHeadLightColor(vehlights[1], lights[2], lights[3])
        if vehicle["plateText"] ~= "" then
        setVehiclePlateText(vehvehicle["plateText"])
        else
         setVehiclePlateText(vehtostring("M "..vehicle["id"]))
        end
        setElementFrozen(veh, (vehicle["frozen"]) > 0)
        if vehicle["paintjob"] ~= 3 then
        setVehiclePaintjob(vehvehicle["paintjob"])
        end
        setElementHealth(vehvehicle["health"])
        setElementData(veh,"vehicle:spawn",true)
        setElementData(veh,"vehicle:id"vehicle["id"])
        setElementData(veh,"vehicle:fuel"vehicle["fuel"])
        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"])
        
        local mk1 vehicle['mk1']
        local mk2 vehicle['mk2']
        local mk3 vehicle['mk3']
        local mk4 vehicle['mk4']
        --[[local s18 vehicle['poj']
        local s20 vehicle['poj']
        local s22 vehicle['poj']
        local s24 vehicle['poj']
        local s26 vehicle['poj']--]]
        local h1 vehicle['ham']
        local h2 vehicle['ham']
        local h3 vehicle['ham']
        
        local g1 vehicle['kola']

        
        
        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
        
        
        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.5)
        setVehicleHandling(veh,"maxVelocity",maxfast+16)
        setVehicleHandling(veh,"mass",masa+100)
        setVehicleHandling(veh,"tractionMultiplier",xd+0.1)
        setVehicleHandling(veh,"steeringLock",40)
        setVehicleHandling(veh,"dragCoeff",coef-0.15)
        end
        
        if tonumber(mk2) ~= 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.7)
        setVehicleHandling(veh,"maxVelocity",maxfast+20)
        setVehicleHandling(veh,"tractionMultiplier",xd+0.2)
        setVehicleHandling(veh,"mass",masa+150)
        setVehicleHandling(veh,"steeringLock",42)
        setVehicleHandling(veh,"dragCoeff",coef-0.21)
        end
        
        if tonumber(mk3) ~= 0 then
        local fast getVehicleHandlingProperty(veh,"engineAcceleration")
        local maxfast getVehicleHandlingProperty(veh,"maxVelocity")
        setVehicleHandling(veh,"engineAcceleration",fast+1.7)
        setVehicleHandling(veh,"maxVelocity",maxfast+25)
        end
        
        if tonumber(mk4) ~= 0 then
        local fast getVehicleHandlingProperty(veh,"engineAcceleration")
        local maxfast getVehicleHandlingProperty(veh,"maxVelocity")
        setVehicleHandling(veh,"engineAcceleration",fast+1.8)
        setVehicleHandling(veh,"maxVelocity",maxfast+30)
        end
        
        if tonumber(h1) ~= 0 then
        local brake getVehicleHandlingProperty(veh,"brakeDeceleration")
        setVehicleHandling(veh,"brakeDeceleration",brake+6000)
        end
        
        if tonumber(h2) ~= 0 then
        local brake getVehicleHandlingProperty(veh,"brakeDeceleration")
        setVehicleHandling(veh,"brakeDeceleration",brake+8000)
        end
        
        if tonumber(h3) ~= 0 then
        local brake getVehicleHandlingProperty(veh,"brakeDeceleration")
        setVehicleHandling(veh,"brakeDeceleration",brake+10000)
        end
        

        
         if getElementData(veh"vehicle:capacity") == "1.2" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+0)
        elseif getElementData(veh"vehicle:capacity") == "1.4" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+0.1)
        elseif getElementData(veh"vehicle:capacity") == "1.6" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+0.2)
        elseif getElementData(veh"vehicle:capacity") == "1.8" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+0.3)
        elseif getElementData(veh"vehicle:capacity") == "2.0" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+0.4)
        elseif getElementData(veh"vehicle:capacity") == "2.2" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+0.5)
        elseif getElementData(veh"vehicle:capacity") == "2.4" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+0.6)
        elseif getElementData(veh"vehicle:capacity") == "2.6" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+0.7)
        elseif getElementData(veh"vehicle:capacity") == "2.8" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+0.8)
        elseif getElementData(veh"vehicle:capacity") == "3.0" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+0.9)
        elseif getElementData(veh"vehicle:capacity") == "3.2" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+1.1)
        elseif getElementData(veh"vehicle:capacity") == "3.4" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+1.2)
        elseif getElementData(veh"vehicle:capacity") == "3.6" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+1.3)
        elseif getElementData(veh"vehicle:capacity") == "3.8" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+1.4)
        end
        
        --TU potem silniczki zrobiePozdrawiam Pyrek
        
        --[[if tonumber(s18) ~= 0 then
        local coef getVehicleHandlingProperty(veh,"dragCoeff")
        local fast getVehicleHandlingProperty(veh,"engineAcceleration")
        local maxfast getVehicleHandlingProperty(veh,"maxVelocity")
        setVehicleHandling(veh,"engineAcceleration",fast+1)
        setVehicleHandling(veh,"maxVelocity",maxfast+200)
        setVehicleHandling(veh,"dragCoeff",coef-0.05)
        end
    
        if tonumber(s20) ~= 0 then
        local coef getVehicleHandlingProperty(veh,"dragCoeff")
        local fast getVehicleHandlingProperty(veh,"engineAcceleration")
        local maxfast getVehicleHandlingProperty(veh,"maxVelocity")
        setVehicleHandling(veh,"engineAcceleration",fast+1)
        setVehicleHandling(veh,"maxVelocity",maxfast+250)
        setVehicleHandling(veh,"dragCoeff",coef-0.10)
        end
        
        if tonumber(s22) ~= 0 then
        local coef getVehicleHandlingProperty(veh,"dragCoeff")
        local fast getVehicleHandlingProperty(veh,"engineAcceleration")
        local maxfast getVehicleHandlingProperty(veh,"maxVelocity")
        setVehicleHandling(veh,"engineAcceleration",fast+2)
        setVehicleHandling(veh,"maxVelocity",maxfast+300)
        setVehicleHandling(veh,"dragCoeff",coef-0.15)
        end
        
        if tonumber(s24) ~= 0 then
        local coef getVehicleHandlingProperty(veh,"dragCoeff")
        local fast getVehicleHandlingProperty(veh,"engineAcceleration")
        local maxfast getVehicleHandlingProperty(veh,"maxVelocity")
        setVehicleHandling(veh,"engineAcceleration",fast+3)
        setVehicleHandling(veh,"maxVelocity",maxfast+350)
        setVehicleHandling(veh,"dragCoeff",coef-0.20)
        end
        
        if tonumber(s26) ~= 0 then
        local coef getVehicleHandlingProperty(veh,"dragCoeff")
        local fast getVehicleHandlingProperty(veh,"engineAcceleration")
        local maxfast getVehicleHandlingProperty(veh,"maxVelocity")
        setVehicleHandling(veh,"engineAcceleration",fast+4)
        setVehicleHandling(veh,"maxVelocity",maxfast+400)
        setVehicleHandling(veh,"dragCoeff",coef-0.30)
        end--]]
        
    --[[    if vehicle["rearlights"] ~= "" then
        setElementData(veh,"vehicle:light"vehicle["rearlights"])
        else
        setElementData(veh,"vehicle:light""High Quality")
        end]]--
        setElementData(veh,"neony"vehicle["neon"])
        if vehicle["blokada"] == "true" then
            setElementData(veh,"vehicle:block"true)
            setVehicleWheelStates(veh2222)
        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[mthen
        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", {neon1neon2})
        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(vehvend
        for i,v in ipairs(split(vehicle["panelstates"], ",")) do setVehiclePanelState(vehitonumber(v)) end
        setVehicleDamageProof(vehtrue)
    end
    outputDebugString("[MoveRPG-Car] Pojazdy za?adowane w ilo?ci. "..vehicles.." pojazd?w.Pozdraiwam Pyrek :D.")
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(vehicletrue)
        local driver=getElementData(vehicle,"vehicle:driver") or ""
        local rent=getElementData(vehicle,"vehicle:rent")
        local player=getElementData(vehicle,"vehicle:ownedPlayer")
     --   local group=getElementData(vehicle,"vehicle:ownedGroup")
        local blokada=getElementData(vehicle,"vehicle:block")
        local neon=getElementData(vehicle,"neony")
        local h1,h2,h3=getVehicleHeadLightColor(vehicle)
        local paintjob=getVehiclePaintjob(vehicle)
        local rear="Brak"
        local frozenisElementFrozen(vehicle) and or 0
        for i=0,do table.insert(panelstatesgetVehiclePanelState(vehicle,i)) end
        panelstates=table.concat(panelstates,",")
        upgrades=getVehicleUpgrades(vehicle)
        if not upgrades then upgrades={} end
        upgrades=table.concat(upgrades",")
        -- Query
        local query exports["ogrpg-db"]:dbSet(string.format("UPDATE ogrpg_vehicles SET model='%d', pos='%.2f,%.2f,%.2f,%.2f,%.2f,%.2f', rent='%d',text='%s', 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', neon='%d', blokada='%s' WHERE id=%d",
        modelx,y,zrx,ry,rz"0",deschealthfuelmileagefrozendriverc1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12panelstatespaintjobupgradesh1,h2,h3playerneontostring(blokada), id))
        if (type(rent) == "table"then
        local rr string.format("%s"table.concat(rent',') )
    --    outputDebugString(rr)
        local query2exports['ogrpg-db']:dbSet("UPDATE ogrpg_vehicles SET rent=? WHERE id=?",rr,id)
        end
    end
end

function onParkVehicle(vehicle) 
    local query=exports["ogrpg-db"]:dbSet("UPDATE ogrpg_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:uid")
    if not sid then return end
    if value == "faction" then
        local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_factions WHERE code=? AND sid=?"codesid)
        if result and #result > 0 then
            return result[1].code
        else
            return false
        end
    end
    if value == "organization" then
        local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_organizations WHERE sid=?"sid)
        if result and #result > 0 then
            return result[1].code
        else
            return false
        end
    end
    if value == "owner" then
        local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_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(source)
       setVehicleEngineState(sourcefalse)
    setVehicleDamageProof(sourcetrue)
    unbindKey(plr'n''down'bindHoron4)
end)


addEventHandler("onPlayerQuit"root, function()
    local veh=getPedOccupiedVehicle(source)
    if veh then
        setVehicleDamageProof(sourcetrue)
        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("[MoveRPG-Car] Saved all vehicles!")
end)

addEventHandler("onVehicleEnter"root, function(plr,seat)
    if seat ~= 0 then return end
    setVehicleEngineState(sourcefalse)
    setElementData(source,"vehicle:driver",getPlayerName(plr))
    if getElementData(source,"neony") and getElementData(source,"neony") ~= 0 then
        --triggerClientEvent(plr,"addNotification",root,"* Posiadasz neony w pojezdzie, mo?esz wl?czy? i wylaczyc je za pomoc? przycisku H.","info")
        outputChatBox("* Posiadasz neony w pojezdzie, mo?esz wl?czy? i wylaczyc je za pomoc? przycisku N.",plr)
        bindKey(plr'n''down'bindHoron4plr)
    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(plr4then
            return
        end
        if rent and (type(rent) == "table"then
            for i,s in pairs(rent) do
                if tonumber(s) == getElementData(plr,"player:uid"then
                return end
            end
        end
        
        local plrgroup getElementData(plr,"player:organization")
        if plrgroup then
        --    outputDebugString(group)
            if getSettings(plr,false,"organization") == group then return end
        end
        if player and player ~= getSettings(plr,false,"owner"then
            --triggerClientEvent(plr,"addNotification",root,"* Nie masz kluczyk?w do tego pojazdu.","error")
            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:uid"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.'plr255,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[mthen
        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", {neon1neon2})
        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(_,falseend)


--[[
vehicles retrieval mechanizm wylawiajacy pojazdy z wody
@author Lukasz Biegaj <wielebny@bestplay.pl>
@author Karer <karer.programmer@gmail.com>
@author WUBE <wube@lss-rp.pl>
@copyright 2011-2013 Lukasz Biegaj <wielebny@bestplay.pl>
]]--



--[[function shuffle(t)
  local n #t
 
  while >= do
    -- n is now the last pertinent index
    local k math.random(n) -- <= <= n
    -- Quick swap
    t[n], t[k] = t[k], t[n]
    1
  end
  return t
end

local function vr()

    local pojazdy=getElementsByType("vehicle")

    if (#pojazdy<1) then return end

    local pojazdwoda={}
    for _,pojazd in ipairs(pojazdy) do
        if isElementInWater(pojazd) and not getVehicleController(pojazdthen
            local x,y,z=getElementPosition(pojazd)
            if (z<-1then
                table.insert(pojazdwoda,pojazd)
            end
        end
    end
    if (#pojazdwoda<1) then return end

    outputDebugString("system_wylawiania_aut> Pojazdow w wodzie/pod mapa: " .. #pojazdwoda)

    shuffle(pojazdwoda)
    
    local pojazd=pojazdwoda[1]
    if getElementData(pojazd"vehicle:spawn"then
        onParkVehicle(pojazd)
    else
        respawnVehicle(pojazd)
    end
end
setTimer(vr350000)--]]

--//////////////////////////////////////////////////////// Licencje

local categoryA={[463] = true,[462] = true,[461] = true,[581] = true,[448] = true,[468] = true,[471] = true,[521] = true,[522] = true,[523] = truelocal 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,[433] = 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}
local categoryD={[437] = true,[431] = true}
local categoryL={[592] = true,[577] = true,[511] = true,[512] = true,[593] = true,[520] = true,[553] = true,[476] = true,[519] = true,[460] = true,[513] = true,[548] = true,[425] = true,[417] = true,[487] = true,[488] = true,[497] = true,[563] = true,[447] = true,[469] = true}
addEventHandler("onVehicleStartEnter"resourceRoot, function(plr,seat,jacked)
    if seat == 0 then
        if categoryA[getElementModel(source)] then
           if exports["ogrpg-prace-settings"]:getVehicleLicense(plr,"A"then
            cancelEvent()
            end
        elseif categoryB[getElementModel(source)] then
            if exports["ogrpg-prace-settings"]:getVehicleLicense(plr,"B"then
            cancelEvent()
            end
        elseif categoryC[getElementModel(source)] then
            if exports["ogrpg-prace-settings"]:getVehicleLicense(plr,"C"then
            cancelEvent()
            end
            elseif categoryD[getElementModel(source)] then
            if exports["ogrpg-prace-settings"]:getVehicleLicense(plr,"D"then
            cancelEvent()
            end
                elseif categoryC[getElementModel(source)] then
            if exports["ogrpg-prace-settings"]:getVehicleLicense(plr,"L"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 mk2 exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND mk2=?",getElementData(source"vehicle:id"), "1")
local mk1 exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND mk1=?",getElementData(source"vehicle:id"), "1")
local mk3 exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND mk3=?",getElementData(source"vehicle:id"), "1")
local mk4 exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND mk4=?",getElementData(source"vehicle:id"), "1")
local gz exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND rh=?",getElementData(source"vehicle:id"), "1")
local np exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND naped=?",getElementData(source"vehicle:id"), "1")
local s18 exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND poj=?",getElementData(source"vehicle:id"), "s18")
local s20 exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND poj=?",getElementData(source"vehicle:id"), "s20")
local h1 exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND ham=?",getElementData(source"vehicle:id"), "1")
local h2 exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND ham=?",getElementData(source"vehicle:id"), "2")
local h3 exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND ham=?",getElementData(source"vehicle:id"), "3")
local g1 exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND kola=?",getElementData(source"vehicle:id"), "1")
if #mk1 > 0 then outputChatBox(" Pomy?lnie zaprogramowano MV1",plr,255,255,255) end
if #mk2 > 0 then outputChatBox(" Pomy?lnie zaprogramowano MV2",plr,255,255,255) end
if #mk3 > 0 then outputChatBox(" Pomy?lnie zaprogramowano MV3",plr,255,255,255) end
if #mk4 > 0 then outputChatBox(" Pomy?lnie zaprogramowano MV4",plr,255,255,255) end
if #gz > 0 then outputChatBox(" Pomy?lnie zaprogramowano GZ",plr,255,255,255) end
if #s18 > 0 then outputChatBox(" Pojazd posiada pojemno?c 1.8 dm3",plr,255,255,255) end
if #s20 > 0 then outputChatBox(" Pojazd posiada pojemno?c 2.0 dm3",plr,255,255,255) end
if #h1 > 0 then outputChatBox(" Pojazd posiada hamulce Monolityczne !",plr,255,255,255) end
if #h2 > 0 then outputChatBox(" Pojazd posiada hamulce Wentylowane !",plr,255,255,255) end
if #h3 > 0 then outputChatBox(" Pojazd posiada hamulce Ceramiczne !",plr,255,255,255) end
if #g1 > 0 then outputChatBox(" Pojazd posiada ogumienie o grubo?ci I",plr,255,255,255) end
end
end)

local strefa = { }
local strefy = {
    {1336.23840656.788769.8562460.50634765625146.8001098632816.164074325562 },
    {924.076901661.905769.25354194.91711425781138.3175048828123.899999046326},
    {2197.997802405.43872, -31.81085178.1982421875112.389648437557.499998474121},
}
 
local ogranicznik createElement ("ogranicznik");
for i,v in ipairs strefy  ) do
     strefa[i] = createColCuboid ], ], ], ], ], ], [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)


Pom?g?by kto? t? element dat? z przecho zapisa? ?[lua][/lua]


Chodzi o to, ?eby po wrzuceniu pojazdu do przecho zapisywa?o edate?

Podpis
Portfolio marceliborowczak.me
Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-02-16, 16:52


Pyrek24







Wiek: 25
Na forum: 3438 dni
Posty: 546
Nick w MP: Pyrek

Piwa: 10

Respekt: 50

tak

Podpis
amta
Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-02-16, 17:10


Gravgor







Wiek: 22
Na forum: 3620 dni
Posty: 380
Nick w MP: 1944

Piwa: 702

Respekt: 57,8

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 elementproperty )
    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["ogrpg-db"]:dbGet("SELECT * from ogrpg_admins WHERE serial=? AND level=?"getPlayerSerial(plr), level)
        if result and #result > 0 then
            return true
        else
            return false
        end
    else
        local result=exports["ogrpg-db"]:dbGet("SELECT * from ogrpg_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["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_vehicles WHERE parking=1 AND id=?"id)
        query=exports["ogrpg-db"]:dbSet("UPDATE ogrpg_vehicles SET parking=0 WHERE id=?"id)
    else
        result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_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(vehcolor[1], color[2], color[3], color[4],color[5], color[6], color[7], color[8],color[9], color[10], color[11], color[12])
        setVehicleHeadLightColor(vehlights[1], lights[2], lights[3])
        if vehicle["plateText"] ~= "" then
        setVehiclePlateText(vehvehicle["plateText"])
        else
         setVehiclePlateText(vehtostring("M "..vehicle["id"]))
        end
        setElementFrozen(veh, (vehicle["frozen"]) > 0)
        if vehicle["paintjob"] ~= 3 then
        setVehiclePaintjob(vehvehicle["paintjob"])
        end
        setElementHealth(vehvehicle["health"])
        setElementData(veh,"vehicle:spawn",true)
        setElementData(veh,"vehicle:id"vehicle["id"])
        setElementData(veh,"vehicle:fuel"vehicle["fuel"])
        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"])
        
        local mk1 vehicle['mk1']
        local mk2 vehicle['mk2']
        local mk3 vehicle['mk3']
        local mk4 vehicle['mk4']
        --[[local s18 vehicle['poj']
        local s20 vehicle['poj']
        local s22 vehicle['poj']
        local s24 vehicle['poj']
        local s26 vehicle['poj']--]]
        local h1 vehicle['ham']
        local h2 vehicle['ham']
        local h3 vehicle['ham']
        
        local g1 vehicle['kola']

        
        
        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
        
        
        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.5)
        setVehicleHandling(veh,"maxVelocity",maxfast+16)
        setVehicleHandling(veh,"mass",masa+100)
        setVehicleHandling(veh,"tractionMultiplier",xd+0.1)
        setVehicleHandling(veh,"steeringLock",40)
        setVehicleHandling(veh,"dragCoeff",coef-0.15)
        end
        
        if tonumber(mk2) ~= 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.7)
        setVehicleHandling(veh,"maxVelocity",maxfast+20)
        setVehicleHandling(veh,"tractionMultiplier",xd+0.2)
        setVehicleHandling(veh,"mass",masa+150)
        setVehicleHandling(veh,"steeringLock",42)
        setVehicleHandling(veh,"dragCoeff",coef-0.21)
        end
        
        if tonumber(mk3) ~= 0 then
        local fast getVehicleHandlingProperty(veh,"engineAcceleration")
        local maxfast getVehicleHandlingProperty(veh,"maxVelocity")
        setVehicleHandling(veh,"engineAcceleration",fast+1.7)
        setVehicleHandling(veh,"maxVelocity",maxfast+25)
        end
        
        if tonumber(mk4) ~= 0 then
        local fast getVehicleHandlingProperty(veh,"engineAcceleration")
        local maxfast getVehicleHandlingProperty(veh,"maxVelocity")
        setVehicleHandling(veh,"engineAcceleration",fast+1.8)
        setVehicleHandling(veh,"maxVelocity",maxfast+30)
        end
        
        if tonumber(h1) ~= 0 then
        local brake getVehicleHandlingProperty(veh,"brakeDeceleration")
        setVehicleHandling(veh,"brakeDeceleration",brake+6000)
        end
        
        if tonumber(h2) ~= 0 then
        local brake getVehicleHandlingProperty(veh,"brakeDeceleration")
        setVehicleHandling(veh,"brakeDeceleration",brake+8000)
        end
        
        if tonumber(h3) ~= 0 then
        local brake getVehicleHandlingProperty(veh,"brakeDeceleration")
        setVehicleHandling(veh,"brakeDeceleration",brake+10000)
        end
        

        
         if getElementData(veh"vehicle:capacity") == "1.2" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+0)
        elseif getElementData(veh"vehicle:capacity") == "1.4" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+0.1)
        elseif getElementData(veh"vehicle:capacity") == "1.6" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+0.2)
        elseif getElementData(veh"vehicle:capacity") == "1.8" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+0.3)
        elseif getElementData(veh"vehicle:capacity") == "2.0" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+0.4)
        elseif getElementData(veh"vehicle:capacity") == "2.2" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+0.5)
        elseif getElementData(veh"vehicle:capacity") == "2.4" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+0.6)
        elseif getElementData(veh"vehicle:capacity") == "2.6" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+0.7)
        elseif getElementData(veh"vehicle:capacity") == "2.8" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+0.8)
        elseif getElementData(veh"vehicle:capacity") == "3.0" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+0.9)
        elseif getElementData(veh"vehicle:capacity") == "3.2" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+1.1)
        elseif getElementData(veh"vehicle:capacity") == "3.4" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+1.2)
        elseif getElementData(veh"vehicle:capacity") == "3.6" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+1.3)
        elseif getElementData(veh"vehicle:capacity") == "3.8" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+1.4)
        end
        
        --TU potem silniczki zrobiePozdrawiam Pyrek
        
        --[[if tonumber(s18) ~= 0 then
        local coef getVehicleHandlingProperty(veh,"dragCoeff")
        local fast getVehicleHandlingProperty(veh,"engineAcceleration")
        local maxfast getVehicleHandlingProperty(veh,"maxVelocity")
        setVehicleHandling(veh,"engineAcceleration",fast+1)
        setVehicleHandling(veh,"maxVelocity",maxfast+200)
        setVehicleHandling(veh,"dragCoeff",coef-0.05)
        end
    
        if tonumber(s20) ~= 0 then
        local coef getVehicleHandlingProperty(veh,"dragCoeff")
        local fast getVehicleHandlingProperty(veh,"engineAcceleration")
        local maxfast getVehicleHandlingProperty(veh,"maxVelocity")
        setVehicleHandling(veh,"engineAcceleration",fast+1)
        setVehicleHandling(veh,"maxVelocity",maxfast+250)
        setVehicleHandling(veh,"dragCoeff",coef-0.10)
        end
        
        if tonumber(s22) ~= 0 then
        local coef getVehicleHandlingProperty(veh,"dragCoeff")
        local fast getVehicleHandlingProperty(veh,"engineAcceleration")
        local maxfast getVehicleHandlingProperty(veh,"maxVelocity")
        setVehicleHandling(veh,"engineAcceleration",fast+2)
        setVehicleHandling(veh,"maxVelocity",maxfast+300)
        setVehicleHandling(veh,"dragCoeff",coef-0.15)
        end
        
        if tonumber(s24) ~= 0 then
        local coef getVehicleHandlingProperty(veh,"dragCoeff")
        local fast getVehicleHandlingProperty(veh,"engineAcceleration")
        local maxfast getVehicleHandlingProperty(veh,"maxVelocity")
        setVehicleHandling(veh,"engineAcceleration",fast+3)
        setVehicleHandling(veh,"maxVelocity",maxfast+350)
        setVehicleHandling(veh,"dragCoeff",coef-0.20)
        end
        
        if tonumber(s26) ~= 0 then
        local coef getVehicleHandlingProperty(veh,"dragCoeff")
        local fast getVehicleHandlingProperty(veh,"engineAcceleration")
        local maxfast getVehicleHandlingProperty(veh,"maxVelocity")
        setVehicleHandling(veh,"engineAcceleration",fast+4)
        setVehicleHandling(veh,"maxVelocity",maxfast+400)
        setVehicleHandling(veh,"dragCoeff",coef-0.30)
        end--]]
        
    --[[    if vehicle["rearlights"] ~= "" then
        setElementData(veh,"vehicle:light"vehicle["rearlights"])
        else
        setElementData(veh,"vehicle:light""High Quality")
        end]]--
        setElementData(veh,"neony"vehicle["neon"])
        if vehicle["blokada"] == "true" then
            setElementData(veh,"vehicle:block"true)
            setVehicleWheelStates(veh2222)
        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[mthen
        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", {neon1neon2})
        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(vehvend
        for i,v in ipairs(split(vehicle["panelstates"], ",")) do setVehiclePanelState(vehitonumber(v)) end
        setVehicleDamageProof(vehtrue)
    end
    outputDebugString("[MoveRPG-Car] Pojazdy za?adowane w ilo?ci. "..vehicles.." pojazd?w.Pozdraiwam Pyrek :D.")
end

--///////////////////////////////////// ZAPISYWANIE POJAZD?W /////////////////////////////////
function onSaveVehicle(vehicle)
    if getElementData(vehicle,"vehicle:spawn"then
        -- Setting
        local panelstates={}
        local cb=getElementData(vehicle"veh:cb") or ""
        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(vehicletrue)
        local driver=getElementData(vehicle,"vehicle:driver") or ""
        local rent=getElementData(vehicle,"vehicle:rent")
        local player=getElementData(vehicle,"vehicle:ownedPlayer")
     --   local group=getElementData(vehicle,"vehicle:ownedGroup")
        local blokada=getElementData(vehicle,"vehicle:block")
        local neon=getElementData(vehicle,"neony")
        local h1,h2,h3=getVehicleHeadLightColor(vehicle)
        local paintjob=getVehiclePaintjob(vehicle)
        local rear="Brak"
        local frozenisElementFrozen(vehicle) and or 0
        for i=0,do table.insert(panelstatesgetVehiclePanelState(vehicle,i)) end
        panelstates=table.concat(panelstates,",")
        upgrades=getVehicleUpgrades(vehicle)
        if not upgrades then upgrades={} end
        upgrades=table.concat(upgrades",")
        -- Query
        local query exports["ogrpg-db"]:dbSet(string.format("UPDATE ogrpg_vehicles SET model='%d', pos='%.2f,%.2f,%.2f,%.2f,%.2f,%.2f', rent='%d',text='%s', 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', neon='%d', blokada='%s', cb='%d' WHERE id=%d",
        modelx,y,zrx,ry,rz"0",deschealthfuelmileagefrozendriverc1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12panelstatespaintjobupgradesh1,h2,h3playerneontostring(blokada),cb,  id))
        if (type(rent) == "table"then
        local rr string.format("%s"table.concat(rent',') )
    --    outputDebugString(rr)
        local query2exports['ogrpg-db']:dbSet("UPDATE ogrpg_vehicles SET rent=? WHERE id=?",rr,id)
        end
    end
end

function onParkVehicle(vehicle) 
    local query=exports["ogrpg-db"]:dbSet("UPDATE ogrpg_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:uid")
    if not sid then return end
    if value == "faction" then
        local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_factions WHERE code=? AND sid=?"codesid)
        if result and #result > 0 then
            return result[1].code
        else
            return false
        end
    end
    if value == "organization" then
        local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_organizations WHERE sid=?"sid)
        if result and #result > 0 then
            return result[1].code
        else
            return false
        end
    end
    if value == "owner" then
        local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_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(source)
       setVehicleEngineState(sourcefalse)
    setVehicleDamageProof(sourcetrue)
    unbindKey(plr'n''down'bindHoron4)
end)


addEventHandler("onPlayerQuit"root, function()
    local veh=getPedOccupiedVehicle(source)
    if veh then
        setVehicleDamageProof(sourcetrue)
        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("[MoveRPG-Car] Saved all vehicles!")
end)

addEventHandler("onVehicleEnter"root, function(plr,seat)
    if seat ~= 0 then return end
    setVehicleEngineState(sourcefalse)
    setElementData(source,"vehicle:driver",getPlayerName(plr))
    if getElementData(source,"neony") and getElementData(source,"neony") ~= 0 then
        --triggerClientEvent(plr,"addNotification",root,"* Posiadasz neony w pojezdzie, mo?esz wl?czy? i wylaczyc je za pomoc? przycisku H.","info")
        outputChatBox("* Posiadasz neony w pojezdzie, mo?esz wl?czy? i wylaczyc je za pomoc? przycisku N.",plr)
        bindKey(plr'n''down'bindHoron4plr)
    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(plr4then
            return
        end
        if rent and (type(rent) == "table"then
            for i,s in pairs(rent) do
                if tonumber(s) == getElementData(plr,"player:uid"then
                return end
            end
        end
        
        local plrgroup getElementData(plr,"player:organization")
        if plrgroup then
        --    outputDebugString(group)
            if getSettings(plr,false,"organization") == group then return end
        end
        if player and player ~= getSettings(plr,false,"owner"then
            --triggerClientEvent(plr,"addNotification",root,"* Nie masz kluczyk?w do tego pojazdu.","error")
            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:uid"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.'plr255,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[mthen
        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", {neon1neon2})
        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(_,falseend)


--[[
vehicles retrieval mechanizm wylawiajacy pojazdy z wody
@author Lukasz Biegaj <wielebny@bestplay.pl>
@author Karer <karer.programmer@gmail.com>
@author WUBE <wube@lss-rp.pl>
@copyright 2011-2013 Lukasz Biegaj <wielebny@bestplay.pl>
]]--



--[[function shuffle(t)
  local n #t
 
  while >= do
    -- n is now the last pertinent index
    local k math.random(n) -- <= <= n
    -- Quick swap
    t[n], t[k] = t[k], t[n]
    1
  end
  return t
end

local function vr()

    local pojazdy=getElementsByType("vehicle")

    if (#pojazdy<1) then return end

    local pojazdwoda={}
    for _,pojazd in ipairs(pojazdy) do
        if isElementInWater(pojazd) and not getVehicleController(pojazdthen
            local x,y,z=getElementPosition(pojazd)
            if (z<-1then
                table.insert(pojazdwoda,pojazd)
            end
        end
    end
    if (#pojazdwoda<1) then return end

    outputDebugString("system_wylawiania_aut> Pojazdow w wodzie/pod mapa: " .. #pojazdwoda)

    shuffle(pojazdwoda)
    
    local pojazd=pojazdwoda[1]
    if getElementData(pojazd"vehicle:spawn"then
        onParkVehicle(pojazd)
    else
        respawnVehicle(pojazd)
    end
end
setTimer(vr350000)--]]

--//////////////////////////////////////////////////////// Licencje

local categoryA={[463] = true,[462] = true,[461] = true,[581] = true,[448] = true,[468] = true,[471] = true,[521] = true,[522] = true,[523] = truelocal 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,[433] = 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}
local categoryD={[437] = true,[431] = true}
local categoryL={[592] = true,[577] = true,[511] = true,[512] = true,[593] = true,[520] = true,[553] = true,[476] = true,[519] = true,[460] = true,[513] = true,[548] = true,[425] = true,[417] = true,[487] = true,[488] = true,[497] = true,[563] = true,[447] = true,[469] = true}
addEventHandler("onVehicleStartEnter"resourceRoot, function(plr,seat,jacked)
    if seat == 0 then
        if categoryA[getElementModel(source)] then
           if exports["ogrpg-prace-settings"]:getVehicleLicense(plr,"A"then
            cancelEvent()
            end
        elseif categoryB[getElementModel(source)] then
            if exports["ogrpg-prace-settings"]:getVehicleLicense(plr,"B"then
            cancelEvent()
            end
        elseif categoryC[getElementModel(source)] then
            if exports["ogrpg-prace-settings"]:getVehicleLicense(plr,"C"then
            cancelEvent()
            end
            elseif categoryD[getElementModel(source)] then
            if exports["ogrpg-prace-settings"]:getVehicleLicense(plr,"D"then
            cancelEvent()
            end
                elseif categoryC[getElementModel(source)] then
            if exports["ogrpg-prace-settings"]:getVehicleLicense(plr,"L"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 mk2 exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND mk2=?",getElementData(source"vehicle:id"), "1")
local mk1 exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND mk1=?",getElementData(source"vehicle:id"), "1")
local mk3 exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND mk3=?",getElementData(source"vehicle:id"), "1")
local mk4 exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND mk4=?",getElementData(source"vehicle:id"), "1")
local gz exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND rh=?",getElementData(source"vehicle:id"), "1")
local np exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND naped=?",getElementData(source"vehicle:id"), "1")
local s18 exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND poj=?",getElementData(source"vehicle:id"), "s18")
local s20 exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND poj=?",getElementData(source"vehicle:id"), "s20")
local h1 exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND ham=?",getElementData(source"vehicle:id"), "1")
local h2 exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND ham=?",getElementData(source"vehicle:id"), "2")
local h3 exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND ham=?",getElementData(source"vehicle:id"), "3")
local g1 exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND kola=?",getElementData(source"vehicle:id"), "1")
if #mk1 > 0 then outputChatBox(" Pomy?lnie zaprogramowano MV1",plr,255,255,255) end
if #mk2 > 0 then outputChatBox(" Pomy?lnie zaprogramowano MV2",plr,255,255,255) end
if #mk3 > 0 then outputChatBox(" Pomy?lnie zaprogramowano MV3",plr,255,255,255) end
if #mk4 > 0 then outputChatBox(" Pomy?lnie zaprogramowano MV4",plr,255,255,255) end
if #gz > 0 then outputChatBox(" Pomy?lnie zaprogramowano GZ",plr,255,255,255) end
if #s18 > 0 then outputChatBox(" Pojazd posiada pojemno?c 1.8 dm3",plr,255,255,255) end
if #s20 > 0 then outputChatBox(" Pojazd posiada pojemno?c 2.0 dm3",plr,255,255,255) end
if #h1 > 0 then outputChatBox(" Pojazd posiada hamulce Monolityczne !",plr,255,255,255) end
if #h2 > 0 then outputChatBox(" Pojazd posiada hamulce Wentylowane !",plr,255,255,255) end
if #h3 > 0 then outputChatBox(" Pojazd posiada hamulce Ceramiczne !",plr,255,255,255) end
if #g1 > 0 then outputChatBox(" Pojazd posiada ogumienie o grubo?ci I",plr,255,255,255) end
end
end)

local strefa = { }
local strefy = {
    {1336.23840656.788769.8562460.50634765625146.8001098632816.164074325562 },
    {924.076901661.905769.25354194.91711425781138.3175048828123.899999046326},
    {2197.997802405.43872, -31.81085178.1982421875112.389648437557.499998474121},
}
 
local ogranicznik createElement ("ogranicznik");
for i,v in ipairs strefy  ) do
     strefa[i] = createColCuboid ], ], ], ], ], ], [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)



Do tabeli vehicles kolumna cb

Podpis
Portfolio marceliborowczak.me
Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-02-16, 20:36


Pyrek24







Wiek: 25
Na forum: 3438 dni
Posty: 546
Nick w MP: Pyrek

Piwa: 10

Respekt: 50

nie zapisuje dalej b??dy z DB3


Podpis
amta
Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-02-17, 15:16


Gravgor







Wiek: 22
Na forum: 3620 dni
Posty: 380
Nick w MP: 1944

Piwa: 702

Respekt: 57,8

"Pyrek24" napisał/a:

nie zapisuje dalej b??dy z DB3
Obrazek


Czym przecho zapisuje pojazdy? Jakim eventem?

Podpis
Portfolio marceliborowczak.me
Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-02-17, 17:00


Pyrek24







Wiek: 25
Na forum: 3438 dni
Posty: 546
Nick w MP: Pyrek

Piwa: 10

Respekt: 50

kod przecho
s.lua

chowalnie = {
{{-1356.75, -492.4714.17},createMarker(-1356.75, -492.4714.17-0.7"cylinder"3.5255800),setElementData(createColCuboid(-1365.9595947266, -503.1939392089812.67187518.7519.57.5),"przecho:chowanie:id",1),{["Plane"]=true,["Helicopter"]=true,},"Samoloty i Helikoptery"},
{{-2532.28, -14.2915.92},createMarker(-2532.28, -14.2915.92-0.7"cylinder"3.5255800),setElementData(createColCuboid(-2535.23828125, -18.53650093078614.92187577.53.5),"przecho:chowanie:id",2),{['Automobile']=true,['Bike']=true,['BMX']=true,['Quad']=true,['Monster Truck']=true,},"Samochody i motocykle"},
--{{2203.921233.6310.82},createMarker(2203.921233.6310.82-4"cylinder"5012225550),setElementData(createColCuboid(2201.461230.3410.82-1.37.57,5),"przecho:chowanie:id",3),{['Automobile']=true,['Bike']=true,['BMX']=true,['Quad']=true,['Monster Truck']=true,},"Samochody i motocykle"},
--{{1768.60, -2031.9513.62},createMarker(1768.60, -2031.9513.62-4"cylinder"5012225550),setElementData(createColCuboid(1764.3500976563, -2035.969482421912.49861335754478.253.75),"przecho:chowanie:id",4),{['Automobile']=true,['Bike']=true,['BMX']=true,['Quad']=true,['Monster Truck']=true,},"Samochody i motocykle"},
--{{192.15, -1896.070.28},createMarker(192.15, -1896.070.28-0.9"corona"90122255),setElementData(createColCuboid(196.75, -1898.520.02, -0.5398388671959.8433532714849.775),"przecho:chowanie:id",3),{['Boat']=true,['Speeder']=true,},"?odzie"},

}

for _,c in pairs(chowalnie) do
createBlip(c[1][1],c[1][2],c[1][3], 35,2,0,0,0,0,0,250)
local t=createElement("text")
setElementData(t,"scale",1.0)
setElementData(t,"name","Pozostawianie pojazd?w")
setElementPosition(t,c[1][1],c[1][2],c[1][3])
end

addEvent("onParkingGetRekords"true)
addEventHandler("onParkingGetRekords"root, function(id)
    local uid=getElementData(client,"player:uid")
    if not uid then return end
    local org getElementData(client,"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(client"onParkingGetVehicles"rootresult,id)
    end
end)

addEventHandler("onColShapeHit"root, function(el,md)
    local id_chow getElementData(source,"przecho:chowanie:id")
    if not id_chow then return end
    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 chowalnie[id_chow][4][getVehicleType(veh)] then
        if isTimer(timeroddaniathen return end
        setElementFrozen(veh,true)
        --outputChatBox("Trwa oddawanie  pojazdu."el,255,255,255,true)
        toggleControl(el,"enter_exit",false)
        timeroddania=setTimer(function()
            setElementFrozen(veh,false)
            local id=getElementData(veh,"vehicle:id")
            if not id then return end
            exports["ogrpg-vehicles"]:onSaveVehicle(veh)
            destroyElement(veh)
            exports["ogrpg-db"]:dbSet("UPDATE ogrpg_vehicles SET parking=1,tp_to_parking=? WHERE id=?","Schowany recznie(kierowca)"id)
            toggleControl(el,"enter_exit",true)
            outputChatBox("#06B200(&#10004;) #FFFFFFPomy?lnie zapisano pojazd."el255255 ,255 ,true)
        end501)
        end
    elseif getElementType(el) == "vehicle" then
        local gracz=getVehicleController(el)
        if gracz then return end
        local id=getElementData(el,"vehicle:id")
        if not id then return end
        if chowalnie[id_chow][4][getVehicleType(veh)] then
        if isTimer(timeroddaniathen return end
        timeroddania=setTimer(function()
            setElementFrozen(el,false)
            local id=getElementData(el,"vehicle:id")
            if not id then return end
            exports["ogrpg-vehicles"]:onSaveVehicle(el)
            destroyElement(el)
            exports["ogrpg-db"]:dbSet("UPDATE ogrpg_vehicles SET parking=1,tp_to_parking=? WHERE id=?","Schowany recznie(bez kierowcy)"id)
            outputChatBox("#06B200(&#10004;) #FFFFFFPomy?lnie zapisano pojazd."el255255 ,255 ,true)
        end501)
        setElementFrozen(el,true)
        setVehicleLocked(el,true)
        end
    end
end)

addEvent("onParkingVehicleSpawn"true)
addEventHandler("onParkingVehicleSpawn"root, function(id,miejsce)
    if not id then return end
    if not miejsce then return end
    local spawn=exports["ogrpg-vehicles"]:onRespawnVehicles(_,id,miejsce)
    if spawn then
    addEventHandler("onClientRender",root,render1)
    end
end)



function render1()
dxDrawText("Zrespiono pojazd"screenW 0.3656screenH 0.1553screenW 0.6273screenH 0.3193tocolor(255255255255), 2.50"pricedown""center""center"falsefalsefalsefalsefalse)
end


function renderstop1()
removeEventHandler("onClientRender",root,render1)
end


Podpis
amta
Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-02-18, 21:46


Gravgor







Wiek: 22
Na forum: 3620 dni
Posty: 380
Nick w MP: 1944

Piwa: 702

Respekt: 57,8

exports["ogrpg-vehicles"]:onSaveVehicle(veh) - poka? to

Podpis
Portfolio marceliborowczak.me
Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-02-19, 10:36


Pyrek24







Wiek: 25
Na forum: 3438 dni
Posty: 546
Nick w MP: Pyrek

Piwa: 10

Respekt: 50

kod vehicles
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 elementproperty )
    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["ogrpg-db"]:dbGet("SELECT * from ogrpg_admins WHERE serial=? AND level=?"getPlayerSerial(plr), level)
        if result and #result > 0 then
            return true
        else
            return false
        end
    else
        local result=exports["ogrpg-db"]:dbGet("SELECT * from ogrpg_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["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_vehicles WHERE parking=1 AND id=?"id)
        query=exports["ogrpg-db"]:dbSet("UPDATE ogrpg_vehicles SET parking=0 WHERE id=?"id)
    else
        result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_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(vehcolor[1], color[2], color[3], color[4],color[5], color[6], color[7], color[8],color[9], color[10], color[11], color[12])
        setVehicleHeadLightColor(vehlights[1], lights[2], lights[3])
        if vehicle["plateText"] ~= "" then
        setVehiclePlateText(vehvehicle["plateText"])
        else
         setVehiclePlateText(vehtostring("M "..vehicle["id"]))
        end
        setElementFrozen(veh, (vehicle["frozen"]) > 0)
        if vehicle["paintjob"] ~= 3 then
        setVehiclePaintjob(vehvehicle["paintjob"])
        end
        setElementHealth(vehvehicle["health"])
        setElementData(veh,"vehicle:spawn",true)
        setElementData(veh,"vehicle:id"vehicle["id"])
        setElementData(veh,"vehicle:fuel"vehicle["fuel"])
        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"])
        
        local mk1 vehicle['mk1']
        local mk2 vehicle['mk2']
        local mk3 vehicle['mk3']
        local mk4 vehicle['mk4']
        --[[local s18 vehicle['poj']
        local s20 vehicle['poj']
        local s22 vehicle['poj']
        local s24 vehicle['poj']
        local s26 vehicle['poj']--]]
        local h1 vehicle['ham']
        local h2 vehicle['ham']
        local h3 vehicle['ham']
        
        local g1 vehicle['kola']

        
        
        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
        
        
        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.5)
        setVehicleHandling(veh,"maxVelocity",maxfast+16)
        setVehicleHandling(veh,"mass",masa+100)
        setVehicleHandling(veh,"tractionMultiplier",xd+0.1)
        setVehicleHandling(veh,"steeringLock",40)
        setVehicleHandling(veh,"dragCoeff",coef-0.15)
        end
        
        if tonumber(mk2) ~= 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.7)
        setVehicleHandling(veh,"maxVelocity",maxfast+20)
        setVehicleHandling(veh,"tractionMultiplier",xd+0.2)
        setVehicleHandling(veh,"mass",masa+150)
        setVehicleHandling(veh,"steeringLock",42)
        setVehicleHandling(veh,"dragCoeff",coef-0.21)
        end
        
        if tonumber(mk3) ~= 0 then
        local fast getVehicleHandlingProperty(veh,"engineAcceleration")
        local maxfast getVehicleHandlingProperty(veh,"maxVelocity")
        setVehicleHandling(veh,"engineAcceleration",fast+1.7)
        setVehicleHandling(veh,"maxVelocity",maxfast+25)
        end
        
        if tonumber(mk4) ~= 0 then
        local fast getVehicleHandlingProperty(veh,"engineAcceleration")
        local maxfast getVehicleHandlingProperty(veh,"maxVelocity")
        setVehicleHandling(veh,"engineAcceleration",fast+1.8)
        setVehicleHandling(veh,"maxVelocity",maxfast+30)
        end
        
        if tonumber(h1) ~= 0 then
        local brake getVehicleHandlingProperty(veh,"brakeDeceleration")
        setVehicleHandling(veh,"brakeDeceleration",brake+6000)
        end
        
        if tonumber(h2) ~= 0 then
        local brake getVehicleHandlingProperty(veh,"brakeDeceleration")
        setVehicleHandling(veh,"brakeDeceleration",brake+8000)
        end
        
        if tonumber(h3) ~= 0 then
        local brake getVehicleHandlingProperty(veh,"brakeDeceleration")
        setVehicleHandling(veh,"brakeDeceleration",brake+10000)
        end
        

        
         if getElementData(veh"vehicle:capacity") == "1.2" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+0)
        elseif getElementData(veh"vehicle:capacity") == "1.4" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+0.1)
        elseif getElementData(veh"vehicle:capacity") == "1.6" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+0.2)
        elseif getElementData(veh"vehicle:capacity") == "1.8" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+0.3)
        elseif getElementData(veh"vehicle:capacity") == "2.0" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+0.4)
        elseif getElementData(veh"vehicle:capacity") == "2.2" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+0.5)
        elseif getElementData(veh"vehicle:capacity") == "2.4" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+0.6)
        elseif getElementData(veh"vehicle:capacity") == "2.6" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+0.7)
        elseif getElementData(veh"vehicle:capacity") == "2.8" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+0.8)
        elseif getElementData(veh"vehicle:capacity") == "3.0" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+0.9)
        elseif getElementData(veh"vehicle:capacity") == "3.2" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+1.1)
        elseif getElementData(veh"vehicle:capacity") == "3.4" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+1.2)
        elseif getElementData(veh"vehicle:capacity") == "3.6" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+1.3)
        elseif getElementData(veh"vehicle:capacity") == "3.8" then
            setVehicleHandling(veh"engineAcceleration"getVehicleHandling(veh).engineAcceleration+1.4)
        end
        
        --TU potem silniczki zrobiePozdrawiam Pyrek
        
        --[[if tonumber(s18) ~= 0 then
        local coef getVehicleHandlingProperty(veh,"dragCoeff")
        local fast getVehicleHandlingProperty(veh,"engineAcceleration")
        local maxfast getVehicleHandlingProperty(veh,"maxVelocity")
        setVehicleHandling(veh,"engineAcceleration",fast+1)
        setVehicleHandling(veh,"maxVelocity",maxfast+200)
        setVehicleHandling(veh,"dragCoeff",coef-0.05)
        end
    
        if tonumber(s20) ~= 0 then
        local coef getVehicleHandlingProperty(veh,"dragCoeff")
        local fast getVehicleHandlingProperty(veh,"engineAcceleration")
        local maxfast getVehicleHandlingProperty(veh,"maxVelocity")
        setVehicleHandling(veh,"engineAcceleration",fast+1)
        setVehicleHandling(veh,"maxVelocity",maxfast+250)
        setVehicleHandling(veh,"dragCoeff",coef-0.10)
        end
        
        if tonumber(s22) ~= 0 then
        local coef getVehicleHandlingProperty(veh,"dragCoeff")
        local fast getVehicleHandlingProperty(veh,"engineAcceleration")
        local maxfast getVehicleHandlingProperty(veh,"maxVelocity")
        setVehicleHandling(veh,"engineAcceleration",fast+2)
        setVehicleHandling(veh,"maxVelocity",maxfast+300)
        setVehicleHandling(veh,"dragCoeff",coef-0.15)
        end
        
        if tonumber(s24) ~= 0 then
        local coef getVehicleHandlingProperty(veh,"dragCoeff")
        local fast getVehicleHandlingProperty(veh,"engineAcceleration")
        local maxfast getVehicleHandlingProperty(veh,"maxVelocity")
        setVehicleHandling(veh,"engineAcceleration",fast+3)
        setVehicleHandling(veh,"maxVelocity",maxfast+350)
        setVehicleHandling(veh,"dragCoeff",coef-0.20)
        end
        
        if tonumber(s26) ~= 0 then
        local coef getVehicleHandlingProperty(veh,"dragCoeff")
        local fast getVehicleHandlingProperty(veh,"engineAcceleration")
        local maxfast getVehicleHandlingProperty(veh,"maxVelocity")
        setVehicleHandling(veh,"engineAcceleration",fast+4)
        setVehicleHandling(veh,"maxVelocity",maxfast+400)
        setVehicleHandling(veh,"dragCoeff",coef-0.30)
        end--]]
        
    --[[    if vehicle["rearlights"] ~= "" then
        setElementData(veh,"vehicle:light"vehicle["rearlights"])
        else
        setElementData(veh,"vehicle:light""High Quality")
        end]]--
        setElementData(veh,"neony"vehicle["neon"])
        if vehicle["blokada"] == "true" then
            setElementData(veh,"vehicle:block"true)
            setVehicleWheelStates(veh2222)
        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[mthen
        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", {neon1neon2})
        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(vehvend
        for i,v in ipairs(split(vehicle["panelstates"], ",")) do setVehiclePanelState(vehitonumber(v)) end
        setVehicleDamageProof(vehtrue)
    end
    outputDebugString("[MoveRPG-Car] Pojazdy za?adowane w ilo?ci. "..vehicles.." pojazd?w.Pozdraiwam Pyrek :D.")
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(vehicletrue)
        local driver=getElementData(vehicle,"vehicle:driver") or ""
        local rent=getElementData(vehicle,"vehicle:rent")
        local player=getElementData(vehicle,"vehicle:ownedPlayer")
     --   local group=getElementData(vehicle,"vehicle:ownedGroup")
        local blokada=getElementData(vehicle,"vehicle:block")
        local neon=getElementData(vehicle,"neony")
        local h1,h2,h3=getVehicleHeadLightColor(vehicle)
        local paintjob=getVehiclePaintjob(vehicle)
        local rear="Brak"
        local frozenisElementFrozen(vehicle) and or 0
        for i=0,do table.insert(panelstatesgetVehiclePanelState(vehicle,i)) end
        panelstates=table.concat(panelstates,",")
        upgrades=getVehicleUpgrades(vehicle)
        if not upgrades then upgrades={} end
        upgrades=table.concat(upgrades",")
        -- Query
        local query exports["ogrpg-db"]:dbSet(string.format("UPDATE ogrpg_vehicles SET model='%d', pos='%.2f,%.2f,%.2f,%.2f,%.2f,%.2f', rent='%d',text='%s', 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', neon='%d', blokada='%s' WHERE id=%d",
        modelx,y,zrx,ry,rz"0",deschealthfuelmileagefrozendriverc1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12panelstatespaintjobupgradesh1,h2,h3playerneontostring(blokada), id))
        if (type(rent) == "table"then
        local rr string.format("%s"table.concat(rent',') )
    --    outputDebugString(rr)
        local query2exports['ogrpg-db']:dbSet("UPDATE ogrpg_vehicles SET rent=? WHERE id=?",rr,id)
        end
    end
end

function onParkVehicle(vehicle) 
    local query=exports["ogrpg-db"]:dbSet("UPDATE ogrpg_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:uid")
    if not sid then return end
    if value == "faction" then
        local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_factions WHERE code=? AND sid=?"codesid)
        if result and #result > 0 then
            return result[1].code
        else
            return false
        end
    end
    if value == "organization" then
        local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_organizations WHERE sid=?"sid)
        if result and #result > 0 then
            return result[1].code
        else
            return false
        end
    end
    if value == "owner" then
        local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_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(source)
       setVehicleEngineState(sourcefalse)
    setVehicleDamageProof(sourcetrue)
    unbindKey(plr'n''down'bindHoron4)
end)


addEventHandler("onPlayerQuit"root, function()
    local veh=getPedOccupiedVehicle(source)
    if veh then
        setVehicleDamageProof(sourcetrue)
        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("[MoveRPG-Car] Saved all vehicles!")
end)

addEventHandler("onVehicleEnter"root, function(plr,seat)
    if seat ~= 0 then return end
    setVehicleEngineState(sourcefalse)
    setElementData(source,"vehicle:driver",getPlayerName(plr))
    if getElementData(source,"neony") and getElementData(source,"neony") ~= 0 then
        --triggerClientEvent(plr,"addNotification",root,"* Posiadasz neony w pojezdzie, mo?esz wl?czy? i wylaczyc je za pomoc? przycisku H.","info")
        outputChatBox("* Posiadasz neony w pojezdzie, mo?esz wl?czy? i wylaczyc je za pomoc? przycisku N.",plr)
        bindKey(plr'n''down'bindHoron4plr)
    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(plr4then
            return
        end
        if rent and (type(rent) == "table"then
            for i,s in pairs(rent) do
                if tonumber(s) == getElementData(plr,"player:uid"then
                return end
            end
        end
        
        local plrgroup getElementData(plr,"player:organization")
        if plrgroup then
        --    outputDebugString(group)
            if getSettings(plr,false,"organization") == group then return end
        end
        if player and player ~= getSettings(plr,false,"owner"then
            --triggerClientEvent(plr,"addNotification",root,"* Nie masz kluczyk?w do tego pojazdu.","error")
            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:uid"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.'plr255,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[mthen
        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", {neon1neon2})
        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(_,falseend)


--[[
vehicles retrieval mechanizm wylawiajacy pojazdy z wody
@author Lukasz Biegaj <wielebny@bestplay.pl>
@author Karer <karer.programmer@gmail.com>
@author WUBE <wube@lss-rp.pl>
@copyright 2011-2013 Lukasz Biegaj <wielebny@bestplay.pl>
]]--



--[[function shuffle(t)
  local n #t
 
  while >= do
    -- n is now the last pertinent index
    local k math.random(n) -- <= <= n
    -- Quick swap
    t[n], t[k] = t[k], t[n]
    1
  end
  return t
end

local function vr()

    local pojazdy=getElementsByType("vehicle")

    if (#pojazdy<1) then return end

    local pojazdwoda={}
    for _,pojazd in ipairs(pojazdy) do
        if isElementInWater(pojazd) and not getVehicleController(pojazdthen
            local x,y,z=getElementPosition(pojazd)
            if (z<-1then
                table.insert(pojazdwoda,pojazd)
            end
        end
    end
    if (#pojazdwoda<1) then return end

    outputDebugString("system_wylawiania_aut> Pojazdow w wodzie/pod mapa: " .. #pojazdwoda)

    shuffle(pojazdwoda)
    
    local pojazd=pojazdwoda[1]
    if getElementData(pojazd"vehicle:spawn"then
        onParkVehicle(pojazd)
    else
        respawnVehicle(pojazd)
    end
end
setTimer(vr350000)--]]

--//////////////////////////////////////////////////////// Licencje

local categoryA={[463] = true,[462] = true,[461] = true,[581] = true,[448] = true,[468] = true,[471] = true,[521] = true,[522] = true,[523] = truelocal 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,[433] = 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}
local categoryD={[437] = true,[431] = true}
local categoryL={[592] = true,[577] = true,[511] = true,[512] = true,[593] = true,[520] = true,[553] = true,[476] = true,[519] = true,[460] = true,[513] = true,[548] = true,[425] = true,[417] = true,[487] = true,[488] = true,[497] = true,[563] = true,[447] = true,[469] = true}
addEventHandler("onVehicleStartEnter"resourceRoot, function(plr,seat,jacked)
    if seat == 0 then
        if categoryA[getElementModel(source)] then
           if exports["ogrpg-prace-settings"]:getVehicleLicense(plr,"A"then
            cancelEvent()
            end
        elseif categoryB[getElementModel(source)] then
            if exports["ogrpg-prace-settings"]:getVehicleLicense(plr,"B"then
            cancelEvent()
            end
        elseif categoryC[getElementModel(source)] then
            if exports["ogrpg-prace-settings"]:getVehicleLicense(plr,"C"then
            cancelEvent()
            end
            elseif categoryD[getElementModel(source)] then
            if exports["ogrpg-prace-settings"]:getVehicleLicense(plr,"D"then
            cancelEvent()
            end
                elseif categoryC[getElementModel(source)] then
            if exports["ogrpg-prace-settings"]:getVehicleLicense(plr,"L"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 mk2 exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND mk2=?",getElementData(source"vehicle:id"), "1")
local mk1 exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND mk1=?",getElementData(source"vehicle:id"), "1")
local mk3 exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND mk3=?",getElementData(source"vehicle:id"), "1")
local mk4 exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND mk4=?",getElementData(source"vehicle:id"), "1")
local gz exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND rh=?",getElementData(source"vehicle:id"), "1")
local np exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND naped=?",getElementData(source"vehicle:id"), "1")
local s18 exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND poj=?",getElementData(source"vehicle:id"), "s18")
local s20 exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND poj=?",getElementData(source"vehicle:id"), "s20")
local h1 exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND ham=?",getElementData(source"vehicle:id"), "1")
local h2 exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND ham=?",getElementData(source"vehicle:id"), "2")
local h3 exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND ham=?",getElementData(source"vehicle:id"), "3")
local g1 exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND kola=?",getElementData(source"vehicle:id"), "1")
if #mk1 > 0 then outputChatBox(" Pomy?lnie zaprogramowano MV1",plr,255,255,255) end
if #mk2 > 0 then outputChatBox(" Pomy?lnie zaprogramowano MV2",plr,255,255,255) end
if #mk3 > 0 then outputChatBox(" Pomy?lnie zaprogramowano MV3",plr,255,255,255) end
if #mk4 > 0 then outputChatBox(" Pomy?lnie zaprogramowano MV4",plr,255,255,255) end
if #gz > 0 then outputChatBox(" Pomy?lnie zaprogramowano GZ",plr,255,255,255) end
if #s18 > 0 then outputChatBox(" Pojazd posiada pojemno?c 1.8 dm3",plr,255,255,255) end
if #s20 > 0 then outputChatBox(" Pojazd posiada pojemno?c 2.0 dm3",plr,255,255,255) end
if #h1 > 0 then outputChatBox(" Pojazd posiada hamulce Monolityczne !",plr,255,255,255) end
if #h2 > 0 then outputChatBox(" Pojazd posiada hamulce Wentylowane !",plr,255,255,255) end
if #h3 > 0 then outputChatBox(" Pojazd posiada hamulce Ceramiczne !",plr,255,255,255) end
if #g1 > 0 then outputChatBox(" Pojazd posiada ogumienie o grubo?ci I",plr,255,255,255) end
end
end)

local strefa = { }
local strefy = {
    {1336.23840656.788769.8562460.50634765625146.8001098632816.164074325562 },
    {924.076901661.905769.25354194.91711425781138.3175048828123.899999046326},
    {2197.997802405.43872, -31.81085178.1982421875112.389648437557.499998474121},
}
 
local ogranicznik createElement ("ogranicznik");
for i,v in ipairs strefy  ) do
     strefa[i] = createColCuboid ], ], ], ], ], ], [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)


Podpis
amta
Postaw piwo autorowi tego posta
 

 
Tagi: montaż :: radia
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Montaż CB Radia Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku