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

Wysłany: 2018-07-17, 19:57


turbonet

Kradnę kody uważaj :)






Wiek: 29
Na forum: 3044 dni
Posty: 30
Nick w MP: AJgorEx

Piwa: 465

Respekt: 50

Przerobi mi kto? to aby po oddaniu do przecho nie usuwa?o si? mk?


function handling(gracz,cmd)
pojazd = getPedOccupiedVehicle(gracz)
if pojazd then
local slock = 50.5 -- (Promien) 
local trac = 1.0 -- (Przyczepno??)
  local id = getElementData(pojazd, "vehicle:id")
  exports["ogrpg-db"]:dbSet("UPDATE ogrpg_vehicles SET mk1=1 WHERE id=?", id)
setVehicleHandling(pojazd, "tractionMultiplier", trac)
setVehicleHandling(pojazd, "steeringLock", slock)
end
end 
addCommandHandler("dodajmk1", handling)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-07-17, 20:40


amited







Wiek: 26
Na forum: 3855 dni
Posty: 1233
Nick w MP: Amited

Piwa: 512

Respekt: 466
Respekt: 466

wejdz tam gdzei auto sie repspi z przecho i dodaj linijke cos w tym stylu:
 if result[1].mk1== true then --ustawia handling end
albo daj kod to ci pokaze

Podpis
"amited" napisał/a:
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-07-17, 22:07


turbonet

Kradnę kody uważaj :)






Wiek: 29
Na forum: 3044 dni
Posty: 30
Nick w MP: AJgorEx

Piwa: 465

Respekt: 50

s.lua

local mdestroy=createMarker(-1786.47, 1203.85, 25.12-1, "cylinder", 5, 25, 255, 25, 75)
createBlip(-1782.12 ,1205.73, 25.12, 35,2,0,0,0,0,0,250)

local t=createElement("text")
setElementData(t,"scale",1.5)
setElementData(t,"name","Pozostawianie pojazd?w")
setElementPosition(t,-1786.47, 1203.85, 25.12)

addEvent("onParkingGetRekords", true)
addEventHandler("onParkingGetRekords", root, function()
    local uid=getElementData(source,"player:uid")
    if not uid then return end
    local org = getElementData(source,"player:organization")
    local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_vehicles WHERE (ownedPlayer=? OR ownedGroup=?) AND parking=1",uid,org or "Brak")
    if #result > 0 then
        triggerClientEvent(source, "onParkingGetVehicles", source, result)
    end
end)

function pozostaw(player, seat)
    if seat == 0 then
    local id = getElementData(source, "vehicle:id")
        if id then
            if isElementWithinMarker(source, mdestroy) then
            exports["ogrpg-vehicles"]:onSaveVehicle(source)
            destroyElement(source)
            exports["ogrpg-db"]:dbSet("UPDATE ogrpg_vehicles SET parking=1 WHERE id=?", id)
            end
        end
    end
end
addEventHandler("onVehicleExit", getRootElement(), pozostaw)

addEvent("onParkingVehicleSpawn", true)
addEventHandler("onParkingVehicleSpawn", root, function(id)
    if not id then return end
    local spawn=exports["ogrpg-vehicles"]:onRespawnVehicles(_,id,{-1776.46, 1203.26, 25.12, 0.5, 2.4, 180.1})
    if spawn then
    end
end)


c.lua

local screenW, screenH = guiGetScreenSize()

local marker=createMarker(-1782.12,1205.73,25.12-1, "cylinder", 2, 50, 90, 200, 75)
local sphere=createColSphere(-1782.12,1205.73,25.12-1,5)

local t=createElement("text")
setElementData(t,"scale",1.5)
setElementData(t,"name","Odbi?r pojazd?w")
setElementPosition(t,-1782.12,1205.73,25.12)

function gui()
dxDrawRectangle(screenW * 0.2628, screenH * 0.2135, screenW * 0.4744, screenH * 0.5742, tocolor(0, 0, 0, 200), false)
        
dxDrawRectangle(screenW * 0.2628, screenH * 0.2135, screenW * 0.4744, screenH * 0.0742, tocolor(0, 93, 147, 200), false)
       
dxDrawText("Przechowalnia pojazd?w!", (screenW * 0.3829) + 1, (screenH * 0.2266) + 1, (screenW * 0.7657) + 1, (screenH * 0.2799) + 1, tocolor(0, 0, 0, 255), 2.00, "clear", "left", "top", false, false, false, false, false)
        
dxDrawText("Przechowalnia pojazd?w!", screenW * 0.3829, screenH * 0.2266, screenW * 0.7657, screenH * 0.2799, tocolor(255, 255, 255, 255), 2.00, "clear", "left", "top", false, false, false, false, false)
        
dxDrawRectangle(screenW * 0.2701, screenH * 0.7096, screenW * 0.1999, screenH * 0.0651, tocolor(0, 93, 147, 200), false)
        
dxDrawRectangle(screenW * 0.5300, screenH * 0.7096, screenW * 0.1999, screenH * 0.0651, tocolor(0, 93, 147, 200), false)
        
dxDrawText("Wyci?gnij pojazd!", (screenW * 0.2855) + 1, (screenH * 0.7161) + 1, (screenW * 0.4568) + 1, (screenH * 0.7799) + 1, tocolor(0, 0, 0, 255), 2.00, "clear", "left", "top", false, false, false, false, false)
        
dxDrawText("Wyci?gnij pojazd!", screenW * 0.2855, screenH * 0.7161, screenW * 0.4568, screenH * 0.7799, tocolor(255, 255, 255, 255), 2.00, "clear", "left", "top", false, false, false, false, false)
        
dxDrawText("Zamknij panel!", (screenW * 0.5622) + 1, (screenH * 0.7161) + 1, (screenW * 0.7335) + 1, (screenH * 0.7799) + 1, tocolor(0, 0, 0, 255), 2.00, "clear", "left", "top", false, false, false, false, false)
        
dxDrawText("Zamknij panel!", screenW * 0.5622, screenH * 0.7161, screenW * 0.7335, screenH * 0.7799, tocolor(255, 255, 255, 255), 2.00, "clear", "left", "top", false, false, false, false, false)

end

local pozostaw=createMarker(-1786.64,1203.86,25.12-1, "cylinder", 5, 255,255,255,0)

function info()
dxDrawText("                     Aby odda? pojazd do przechowalni wysi?d? z niego!", (screenW * 0.1808) + 1, (screenH * 0.0143) + 1, (screenW * 0.8067) + 1, (screenH * 0.0794) + 1, tocolor(0, 0, 0, 255), 1.5, "clear", "left", "top", false, false, false, false, false)
        
dxDrawText("                     Aby odda? pojazd do przechowalni wysi?d? z niego!", screenW * 0.1808, screenH * 0.0143, screenW * 0.8067, screenH * 0.0794, tocolor(255, 255, 255, 255), 1.5, "clear", "left", "top", false, false, false, false, false)
end

addEventHandler("onClientMarkerHit",pozostaw,function(el)
if el~=localPlayer then return end
if getElementType(el) == "player" then
local veh = getPedOccupiedVehicle(el)
if not veh then return end
addEventHandler("onClientRender", root, info)
setTimer(function()
removeEventHandler("onClientRender", root, info)
end, 3500, 1)
end
end)

local wm={}
wm.window=guiCreateGridList(screenW * 0.2738, screenH * 0.3008, screenW * 0.4524, screenH * 0.3958, false)
guiGridListAddColumn(wm.window, "ID", 0.1)
guiGridListAddColumn(wm.window, "Model", 0.2)
guiGridListAddColumn(wm.window, "Przebieg", 0.2)
guiGridListAddColumn(wm.window, "Paliwo", 0.5)
wm.close=guiCreateButton(screenW * 0.5300, screenH * 0.7096, screenW * 0.1999, screenH * 0.0651, "", false)
guiSetAlpha(wm.close,0.00)
wm.submit=guiCreateButton(screenW * 0.2701, screenH * 0.7096, screenW * 0.1999, screenH * 0.0651, "", false)
guiSetAlpha(wm.submit,0.00)
guiSetVisible(wm.window,false)

addEvent("onParkingGetVehicles", true)
addEventHandler("onParkingGetVehicles", root, function(result)
    guiGridListClear(wm.window)
    if not result then return end
    for i,v in pairs(result) do
    local row=guiGridListAddRow(wm.window)
        guiGridListSetItemText(wm.window, row, 1, v["id"], false, false)
        guiGridListSetItemText(wm.window, row, 2, getVehicleNameFromModel(v["model"]), false, false)
                guiGridListSetItemText(wm.window, row, 3, v["mileage"], false, false)
                guiGridListSetItemText(wm.window, row, 4, v["fuel"], false, false)
    end
end)

addEventHandler("onClientMarkerHit", marker, function(el,md)
    if el~=localPlayer then return end
    if isPedInVehicle(el) then return end
    if guiGetVisible(wm.window) == false then
        showCursor(true)
        guiSetVisible(wm.window,true)
                addEventHandler("onClientRender", root, gui)
        triggerServerEvent("onParkingGetRekords", localPlayer)
    end
end)

addEventHandler("onClientGUIClick", resourceRoot, function()
    if source == wm.close then
        if guiGetVisible(wm.window) == true then
            showCursor(false)
            guiSetVisible(wm.window,false)
                        removeEventHandler("onClientRender", root, gui)
        end
    end
    if source == wm.submit then
        local selectedRow=guiGridListGetSelectedItem(wm.window) or -1
        if selectedRow < 0 then return end
                local vehicles=getElementsWithinColShape(sphere,"vehicle")
        if #vehicles > 0 then
            addEventHandler("onClientRender",root,render1)
            setTimer(renderstop1,4500,1)
            return
        end
        local id=guiGridListGetItemText(wm.window, selectedRow, 1)
        guiGridListRemoveRow(wm.window, selectedRow)
                removeEventHandler("onClientRender", root, gui)
                guiSetVisible(wm.window,false)
                showCursor(false)
                setElementPosition(localPlayer,-1781, 1197, 25.12)
        triggerServerEvent("onParkingVehicleSpawn", localPlayer, tonumber(id))
    end
end)


function render1()
dxDrawText(" Nie ma miejsca aby wyci?gn?? pojazd", screenW * 0.3656, screenH * 0.1553, screenW * 0.6273, screenH * 0.3193, tocolor(255, 0, 0, 255), 1.50, "pricedown", "center", "center", false, false, false, false, false)
end

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


addCommandHandler("kordy",function() 
    outputChatBox("Interior: " .. getElementInterior(localPlayer) .. " Dimension: " .. getElementDimension(localPlayer))
    local x,y,z = getElementPosition(localPlayer)
    p = string.format("%.2f, %.2f, %.2f", x,y,z)
    outputChatBox("Pozycja gracza: ".. p)
    setClipboard(p)
    local pojazd = getPedOccupiedVehicle(localPlayer)
    if pojazd then
        local x,y,z = getElementPosition(pojazd)
        local rx,ry,rz = getElementRotation(pojazd)
    local model = getVehicleModelFromName(pojazd)
        p = string.format("%.2f, %.2f, %.2f, %.1f, %.1f, %.1f", x, y, z, rx, ry, rz)
        outputChatBox("Pozycja pojazdu: ".. p)
        setClipboard(p)
    end
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-07-18, 00:06


amited







Wiek: 26
Na forum: 3855 dni
Posty: 1233
Nick w MP: Amited

Piwa: 512

Respekt: 466
Respekt: 466

daj kod z spawnem pojazdow a nie przecho ;p

Podpis
"amited" napisał/a:
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-07-18, 00:20


turbonet

Kradnę kody uważaj :)






Wiek: 29
Na forum: 3044 dni
Posty: 30
Nick w MP: AJgorEx

Piwa: 465

Respekt: 50

Jaki to b?dzie plik :P Troch? zielony jestem :/

[ Dodano: 2018-07-18, 00:21 ]

--[[
    Resource: OURGame v2
    Developers: Split <split.programista@gmail.com>
    You have no right to use this code without my permission.
    (c) 2015 <split.programista@gmail.com>. All rights reserved.
]]

--///////////////////////////////////// USTAWIENIA ////////////////////////////////////////
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 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(veh, color[1], color[2], color[3], color[4],color[5], color[6], color[7], color[8],color[9], color[10], color[11], color[12])
        setVehicleHeadLightColor(veh, lights[1], lights[2], lights[3])
        if vehicle["plateText"] ~= "" then
        setVehiclePlateText(veh, vehicle["plateText"])
        else
        setVehiclePlateText(veh, tostring("SF "..vehicle["id"]))
        end
        setElementFrozen(veh, (vehicle["frozen"]) > 0)
        if vehicle["paintjob"] ~= 3 then
        setVehiclePaintjob(veh, vehicle["paintjob"])
        end
        if vehicle["health"] > 300 then
        setElementHealth(veh, vehicle["health"])
        else
        setElementHealth(veh,301)
        end
        setElementData(veh,"vehicle:spawn",true)
        setElementData(veh,"vehicle:id", vehicle["id"])
        setElementData(veh,"vehicle:fuel", vehicle["fuel"])
        setElementData(veh,"vehicle:desc", vehicle["desc"])
        setElementData(veh,"vehicle:mileage", vehicle["mileage"])
        setElementData(veh,"vehicle:driver", vehicle["driver"])
        setElementData(veh,"vehicle:ownedGroup", vehicle["ownedGroup"])
        setElementData(veh,"vehicle:ownedPlayer", vehicle["ownedPlayer"])
        setElementData(veh,"vehicle:ownedFaction", vehicle["ownedFaction"])
    --[[    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(veh, 2, 2, 2, 2)
        else
            setElementData(veh,"vehicle:block", false)
        end
        local rodzajneonu=tonumber(getElementData(veh,"neony"))
        if getElementData(veh,"neony") ~= 0 then
        local m = getElementModel(veh)
        local of
        if not nlOffsets[m] then
        of={-1,0,-0.5}
        else
        of=nlOffsets[m]
        end
        neon1=createObject(nlIDX[rodzajneonu],0,0,0)
        neon2=createObject(nlIDX[rodzajneonu],0,0,0)
        setElementData(veh,"zneony", {neon1, neon2})
        attachElements(neon1,veh,of[1],of[2],of[3])
        attachElements(neon2,veh,-of[1],of[2],of[3])
        end

        for i,v in ipairs(split(vehicle["tuning"], ",")) do addVehicleUpgrade(veh, v) end
        for i,v in ipairs(split(vehicle["panelstates"], ",")) do setVehiclePanelState(veh, i, tonumber(v)) end
        setVehicleDamageProof(veh, true)
    end
    outputDebugString("[og-vehicles] Loaded "..vehicles.." vehicles.")
end

--///////////////////////////////////// ZAPISYWANIE POJAZD?W /////////////////////////////////
function onSaveVehicle(vehicle)
    if getElementData(vehicle,"vehicle:spawn") then
        -- Settings
        local panelstates={}
        local model=getElementModel(vehicle)
        local health=getElementHealth(vehicle)
        local x,y,z=getElementPosition(vehicle)
        local rx,ry,rz=getElementRotation(vehicle)
        local desc=getElementData(vehicle,"vehicle:desc") or ""
        local id=getElementData(vehicle,"vehicle:id")
        local fuel=getElementData(vehicle,"vehicle:fuel")
        local mileage=getElementData(vehicle,"vehicle:mileage")
        local c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12=getVehicleColor(vehicle, true)
        local driver=getElementData(vehicle,"vehicle:driver") or ""
        local faction=getElementData(vehicle,"vehicle:ownedFaction")
        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 frozen= isElementFrozen(vehicle) and 1 or 0
        for i=0,6 do table.insert(panelstates, getVehiclePanelState(vehicle,i)) end
        panelstates=table.concat(panelstates,",")
        upgrades=getVehicleUpgrades(vehicle)
        if not upgrades then upgrades={} end
        upgrades=table.concat(upgrades, ",")
        -- Query
        local query = exports["ogrpg-db"]:dbSet(string.format("UPDATE ogrpg_vehicles SET model='%d', pos='%.2f,%.2f,%.2f,%.2f,%.2f,%.2f', 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', ownedFaction='%s', ownedPlayer='%d', ownedGroup='%d', neon='%d', blokada='%s' WHERE id=%d",
        model, x,y,z, rx,ry,rz, desc, health, fuel, mileage, frozen, driver, c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12, panelstates, paintjob, upgrades, h1,h2,h3, faction, player, group, neon, tostring(blokada), id))
    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 uid=getElementData(plr,"player:uid")
    if not uid then return end
    if value == "faction" then
        local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_factions WHERE code=? AND uid=?", code, uid)
        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 code=? AND uid=?", code, uid)
        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=?", uid)
        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(source, false)
    setVehicleDamageProof(source, true)
    unbindKey(plr, 'h', 'down', bindHoron4)
end)


addEventHandler("onPlayerQuit", root, function()
    local veh=getPedOccupiedVehicle(source)
    if veh then
        setVehicleDamageProof(source, true)
        onSaveVehicle(veh)
    end
end)

addEventHandler("onResourceStop", resourceRoot, function()
    for i,v in ipairs(getElementsByType("vehicle")) do
        onSaveVehicle(v)
        local zneony=getElementData(v,"zneony")
        if (zneony and type(zneony)=="table") then
        destroyElement(zneony[1])
        destroyElement(zneony[2])
        removeElementData(v,"zneony")
        end
    end
    outputDebugString("[og-vehicles] Saved all vehicles!")
end)


addEventHandler("onVehicleEnter", root, function(plr,seat)
    if seat ~= 0 then return end
    setVehicleEngineState(source, false)
    setElementData(source,"vehicle:driver",getPlayerName(plr))
    if getElementData(source,"neony") and getElementData(source,"neony") ~= 0 then
        triggerClientEvent(plr,"addNotification",root,"* Posiadasz neony w pojezdzie, mo?esz wl?czy? i wylaczyc je za pomoc? przycisku H.","info")
        bindKey(plr, 'h', 'down', bindHoron4, plr)
    end
end)
addEventHandler("onVehicleStartEnter", root, function(plr,seat,jacked)
    if seat == 0 then
        if getElementHealth(source) < 301 then
        setElementHealth(source,301)
        end
    end
end)
--///////////////////////////////////// SPRAWDZENIE W?A?CICIELA ///////////////////////////////
addEventHandler("onVehicleStartEnter", resourceRoot, function(plr,seat,jacked)
    if seat == 0 then
        local faction=getElementData(source, "vehicle:ownedFaction")
        local group=getElementData(source, "vehicle:ownedGroup")
        local player=getElementData(source, "vehicle:ownedPlayer")
        if getAdmin2(plr, 3) or getPlayerName(plr) == "Ryjek" then
            return
        end
        if faction and string.len(faction) > 3 then
            if faction ~= getSettings(plr,faction,"faction") then
                triggerClientEvent(plr,"addNotification",root,"* Nie masz kluczyk?w do tego pojazdu.","error")
                cancelEvent()
            end
            return
        end
        if group and group ~= 0 then
            if group ~= getSettings(plr,group,"organization") then
            triggerClientEvent(plr,"addNotification",root,"* Nie masz kluczyk?w do tego pojazdu.","error")
                cancelEvent()
            end
            return
        end
        if player and player ~= getSettings(plr,false,"owner") then
            triggerClientEvent(plr,"addNotification",root,"* Nie masz kluczyk?w do tego pojazdu.","error")
            cancelEvent()
        end
    end
end)
addEventHandler("onVehicleStartEnter", root, function(plr,seat,jacked)
    if getElementData(source,"ladowany") then cancelEvent() end
end)
addEventHandler("onVehicleStartEnter", root, function(plr,seat,jacked)
    if jacked then 
        cancelEvent()
    end
end)

addEventHandler("onVehicleStartEnter", root, function(plr,seat,jacked)
    if seat == 0 then
        if getElementData(source,"spawnowany")== true then
            if getElementData(plr,"player:admin")== false then
                cancelEvent()
            end
        end
    end
end)



function bindHoron4(plr)
        veh=getPedOccupiedVehicle(plr)
        if not veh then return end
        local rodzajneonu=tonumber(getElementData(veh,"neony"))
        if not rodzajneonu then return end
        if rodzajneonu==0 then 
        outputChatBox('* Brak Neonow.', plr, 255, 0 ,0)
        return end
        local zneony=getElementData(veh,"zneony")
        if (zneony and type(zneony)=="table") then
        destroyElement(zneony[1])
        destroyElement(zneony[2])
        removeElementData(veh,"zneony")

        outputChatBox('* Wy??czy?e? Neony.', plr, 255, 0 ,0)
        else
        local m = getElementModel(veh)
        local of
        if not nlOffsets[m] then
        of={-1,0,-0.5}
        else
        of=nlOffsets[m]
        end
        neon1=createObject(nlIDX[rodzajneonu],0,0,0)
        neon2=createObject(nlIDX[rodzajneonu],0,0,0)
        setElementData(veh,"zneony", {neon1, neon2})
        attachElements(neon1,veh,of[1],of[2],of[3])
        attachElements(neon2,veh,-of[1],of[2],of[3])
        triggerClientEvent(plr,"addNotification",root,'* W??czy?e? Neony. Pojawi? si? one jak poruszysz pojazdem!',"info")
        end
end

addEventHandler("onElementDestroy", getRootElement(), function ()
  if getElementType(source) == "vehicle" then
      local zneony=getElementData(source,"zneony")
    if (zneony and type(zneony)=="table") then
        destroyElement(zneony[1])
        destroyElement(zneony[2])
        removeElementData(source,"zneony")
        end
    end
end)


addEventHandler("onResourceStart", resourceRoot, function() onRespawnVehicles(_,false) end)


--[[
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 n >= 2 do
    -- n is now the last pertinent index
    local k = math.random(n) -- 1 <= k <= n
    -- Quick swap
    t[n], t[k] = t[k], t[n]
    n = 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(pojazd) then
            local x,y,z=getElementPosition(pojazd)
            if (z<-1) then
                table.insert(pojazdwoda,pojazd)
            end
        end
    end
    if (#pojazdwoda<1) then return end

    outputDebugString("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(vr, 35000, 0)

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

--local categoryA={[463] = true,[462] = true,[461] = true,[581] = true,[448] = true,[468] = true,[471] = true,[521] = true,[522] = true,[523] = true} 
--local categoryB={[602] = true,[545] = true,[496] = true,[517] = true,[401] = true,[410] = true,[518] = true,[600] = true,[527] = true,[436] = true,[589] = true,[580] = true,[419] = true,[439] = true,[533] = true,[549] = true,[526] = true,[491] = true,[474] = true,[445] = true,[467] = true,[604] = true,[426] = true,[507] = true,[547] = true,[585] = true,[405] = true,[587] = true,[409] = true,[466] = true,[550] = true,[492] = true,[566] = true,[546] = true,[540] = true,[551] = true,[421] = true,[516] = true,[529] = true,[488] = true,[460] = true,
--[469] = true,[487] = true,[510] = true,[509] = true,[481] = true,[586] = true,[472] = true,[473] = true,[493] = true,[595] = true,[484] = true,[430] = true,[453] = true,[452] = true,[446] = true,[454] = true,[485] = true,[552] = true,
--[438] = true,[574] = true,[420] = true,[525] = true,[408] = true,[596] = true,[597] = true,[427] = true,[599] = true,[490] = true,[432] = true,[528] = true,[601] = true,[407] = true,[544] = true,[470] = true,[598] = true,[588] = true,
--[532] = true,[443] = true,[486] = true,[531] = true,[543] = true,[422] = true,[583] = true,[478] = true,[605] = true,[554] = true,[530] = true,[418] = true,[572] = true,[582] = true,[536] = true,[575] = true,[534] = true,
--[567] = true,[535] = true,[576] = true,[412] = true,[402] = true,[542] = true,[603] = true,[475] = true,[449] = true,[537] = true,[570] = true,[441] = true,[464] = true,[501] = true,[465] = true,[564] = true,[568] = true,[557] = true,[424] = true,[504] = true,[495] = true,[457] = true,[539] = true,[483] = true,[571] = true,[500] = true, 
--[444] = true,[556] = true,[429] = true,[411] = true,[541] = true,[559] = true,[415] = true,[561] = true,[480] = true,[560] = true,[562] = true,[506] = true,[565] = true,[451] = true,[434] = true,[558] = true,[494] = true,[555] = true,[502] = true,[477] = true,[503] = true,[579] = true,[400] = true,[404] = true,[489] = true,[505] = true,[479] = true,[442] = true,[458] = true,
--[606] = true,[607] = true,[610] = true,[590] = true,[569] = true,[611] = true,[584] = true,[608] = true,[435] = true,[450] = true,[591] = true,[594] = true}
--local categoryC={[403] = true,[406] = true,[413] = true,[414] = true,[416] = true,[423] = true,[428] = true,[431] = true,[433] = true,[437] = true,[440] = true,[455] = true,[456] = true,[459] = true,[482] = true,[498] = true,[499] = true,[508] = true,[514] = true,[515] = true,[524] = true,[538] = true,[573] = true}
--addEventHandler("onVehicleStartEnter", resourceRoot, function(plr,seat,jacked)
--    if seat == 0 then
--        if categoryA[getElementModel(source)] then
--           if exports["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
--        end
--    end
--end)







local strefa = { }
local strefy = {
    {1336.23840, 656.78876, 9.85624, 60.50634765625, 146.80010986328, 16.164074325562 },
    {924.07690, 1661.90576, 9.25354, 194.91711425781, 138.31750488281, 23.899999046326},
    {2197.99780, 2405.43872, -31.81085, 178.1982421875, 112.3896484375, 57.499998474121},
}
 
local ogranicznik = createElement ("ogranicznik");
for i,v in ipairs ( strefy  ) do
     strefa[i] = createColCuboid ( v [ 1 ], v [ 2 ], v [ 3 ], v [ 4 ], v [ 5 ], v [ 6 ], v [7] )
     setElementParent (strefa [i], ogranicznik);
end
 
addEventHandler("onColShapeHit", ogranicznik, function(el,md)
    if getElementType(el)=="vehicle" then
            setElementData(el,"vehicle:tempspeed", 50)
    end
end)
addEventHandler("onColShapeLeave", ogranicznik, function(el,md)
    if getElementType(el)=="vehicle" then
        removeElementData(el,"vehicle:tempspeed")
    end
end)



Czy o to chodzi?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-07-18, 11:25


amited







Wiek: 26
Na forum: 3855 dni
Posty: 1233
Nick w MP: Amited

Piwa: 512

Respekt: 466
Respekt: 466


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(veh, color[1], color[2], color[3], color[4],color[5], color[6], color[7], color[8],color[9], color[10], color[11], color[12])
        setVehicleHeadLightColor(veh, lights[1], lights[2], lights[3])
        if vehicle["plateText"] ~= "" then
        setVehiclePlateText(veh, vehicle["plateText"])
        else
        setVehiclePlateText(veh, tostring("SF "..vehicle["id"]))
        end
        setElementFrozen(veh, (vehicle["frozen"]) > 0)
        if vehicle["paintjob"] ~= 3 then
        setVehiclePaintjob(veh, vehicle["paintjob"])
        end
        if vehicle["health"] > 300 then
        setElementHealth(veh, vehicle["health"])
        else
        setElementHealth(veh,301)
        end
        setElementData(veh,"vehicle:spawn",true)
        setElementData(veh,"vehicle:id", vehicle["id"])
        setElementData(veh,"vehicle:fuel", vehicle["fuel"])
        setElementData(veh,"vehicle:desc", vehicle["desc"])
        setElementData(veh,"vehicle:mileage", vehicle["mileage"])
        setElementData(veh,"vehicle:driver", vehicle["driver"])
        setElementData(veh,"vehicle:ownedGroup", vehicle["ownedGroup"])
        setElementData(veh,"vehicle:ownedPlayer", vehicle["ownedPlayer"])
        setElementData(veh,"vehicle:ownedFaction", vehicle["ownedFaction"])
    --[[    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(veh, 2, 2, 2, 2)
        else
            setElementData(veh,"vehicle:block", false)
        end
        local rodzajneonu=tonumber(getElementData(veh,"neony"))
        if getElementData(veh,"neony") ~= 0 then
        local m = getElementModel(veh)
        local of
        if not nlOffsets[m] then
        of={-1,0,-0.5}
        else
        of=nlOffsets[m]
        end
        neon1=createObject(nlIDX[rodzajneonu],0,0,0)
        neon2=createObject(nlIDX[rodzajneonu],0,0,0)
        setElementData(veh,"zneony", {neon1, neon2})
        attachElements(neon1,veh,of[1],of[2],of[3])
        attachElements(neon2,veh,-of[1],of[2],of[3])
        end
        
        if getElementData(veh,"mk1") ~= 0 then
            if veh then
                setVehicleHandling(veh, "tractionMultiplier", 1.0)
                setVehicleHandling(veh, "steeringLock", 50.5)
            end
        end
        
        for i,v in ipairs(split(vehicle["tuning"], ",")) do addVehicleUpgrade(veh, v) end
        for i,v in ipairs(split(vehicle["panelstates"], ",")) do setVehiclePanelState(veh, i, tonumber(v)) end
        setVehicleDamageProof(veh, true)
    end
    outputDebugString("[og-vehicles] Loaded "..vehicles.." vehicles.")
end

tutaj masz wczytywanie pojazd?w, a zapis w przecho robisz tak ?e teraz musisz sobie doda? kolumn? z mk1 w mysql, a w funckji zapisu z przecho musisz pobiera? elementDate z mk1 i zrobi? tak samo jak jest w query z innymi.

Podpis
"amited" napisał/a:
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-07-18, 21:39


turbonet

Kradnę kody uważaj :)






Wiek: 29
Na forum: 3044 dni
Posty: 30
Nick w MP: AJgorEx

Piwa: 465

Respekt: 50

Jak pobra? elementdate?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-07-19, 13:01


amited







Wiek: 26
Na forum: 3855 dni
Posty: 1233
Nick w MP: Amited

Piwa: 512

Respekt: 466
Respekt: 466

No je?eli takich rzeczy nie potrafisz to dalej ci nie pomoge :) Sam dojd? do tego jak u?y? setElementData / getElementData bo jak ci wszystko napisze to nic sie nie nauczysz. Ca?y kod polega na elementDatach wi?c go przeczytaj. Potrzeba jeszcze angielskiego na poziomie podstaw?wki albo translatora.

Podpis
"amited" napisał/a:
Postaw piwo autorowi tego posta
 

 
Tagi: tuning :: mechaniczny
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Tuning mechaniczny 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