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

Wysłany: 2020-03-26, 21:26


Matikmontana

Modern Stories






Wiek: 22
Na forum: 2473 dni
Posty: 423
Nick w MP: Mazeusz*

Piwa: 1015

Respekt: 130
Respekt: 130

Ostrzeżeń: 60%
Witam posiadam skrypt na taxometr. Dzia?a ale posiadaj? go wszystkie auta w bazie danych zrobi?em tabelk? z taxi...

taxometr
--[[
    AutorMalentas
]]

local sxsy guiGetScreenSize()
local font dxCreateFont("cz.ttf"13)


addEventHandler("onClientRender"root, function()
    local pojazd getPedOccupiedVehicle(localPlayer)
    if getPedOccupiedVehicle(localPlayerthen
        if getElementData(pojazd"vehicle:taxo"then
        local seat getPedOccupiedVehicleSeat(localPlayer)
        if seat == 0 then
            if getVehicleController(pojazdthen
                kierowca getPlayerName(getVehicleController(pojazd))
            else
                kierowca "Brak"
            end
            pasazerowie = { }
            for i,v in pairs(getVehicleOccupants(getPedOccupiedVehicle(localPlayer)))do
                if getVehicleController(getPedOccupiedVehicle(localPlayer)) ~= v then
                    table.insert(pasazerowiegetPlayerName(v))
                end
            end
            dxDrawImage(scale_x(533), scale_y(718), scale_x(374), scale_y(162), ":RPG-Taksometr/grafiki/tlo.png"000tocolor(0,0,0,155), false)
            shadowText("Taksometr"scale_x(533), scale_y(718), scale_x(907), scale_y(758), tocolor(255255255255), 1.00font"center""center"falsefalsefalsefalsefalse)
            if #pasazerowie > 1 then
                shadowText("Pasa?erowie: "..table.concat(pasazerowie", "):gsub("#%x%x%x%x%x%x","").."\nCena za 1km: 100 PLN\nKierowca: "..kierowca:gsub("#%x%x%x%x%x%x",""), scale_x(532), scale_y(757), scale_x(907), scale_y(880), tocolor(255255255255), 1.00font"center""center"falsefalsefalsefalsefalse)
            else
                shadowText("Pasa?er: "..table.concat(pasazerowie", "):gsub("#%x%x%x%x%x%x","").."\nCena za 1km: 100 PLN\nKierowca: "..kierowca:gsub("#%x%x%x%x%x%x",""), scale_x(532), scale_y(757), scale_x(907), scale_y(880), tocolor(255255255255), 1.00font"center""center"falsefalsefalsefalsefalse)
            end
        else
            if getVehicleController(pojazdthen
                kierowca getPlayerName(getVehicleController(pojazd))
            else
                kierowca "Brak"
            end
            local ile = (getElementData(localPlayer"ileprzejechal") or 0) * 100
            pasazerowie={}
            for i,v in pairs(getVehicleOccupants(getPedOccupiedVehicle(localPlayer)))do
                if getVehicleController(getPedOccupiedVehicle(localPlayer)) ~= v then
                    table.insert(pasazerowiegetPlayerName(v))
                end
            end
            dxDrawImage(scale_x(533), scale_y(718), scale_x(374), scale_y(162), ":RPG-Taksometr/grafiki/tlo.png"000tocolor(255255255255), false)
            shadowText("Taksometr"scale_x(533), scale_y(718), scale_x(907), scale_y(758), tocolor(255255255255), 1.00font"center""center"falsefalsefalsefalsefalse)
            if #pasazerowie > 1 then
                shadowText("Pasa?erowie: "..table.concat(pasazerowie", "):gsub("#%x%x%x%x%x%x","").."\nCena za 1km: 100 PLN\nSuma za przejazd: "..ile.." PLN\nKierowca: "..kierowca:gsub("#%x%x%x%x%x%x",""), scale_x(532), scale_y(757), scale_x(907), scale_y(880), tocolor(255255255255), 1.00font"center""center"falsefalsefalsefalsefalse)
            else
                shadowText("Pasa?er: "..table.concat(pasazerowie", "):gsub("#%x%x%x%x%x%x","").."\nCena za 1km: 100 PLN\nSuma za przejazd: "..ile.." PLN\nKierowca: "..kierowca:gsub("#%x%x%x%x%x%x",""), scale_x(532), scale_y(757), scale_x(907), scale_y(880), tocolor(255255255255), 1.00font"center""center"falsefalsefalsefalsefalse)
            end
        end
    end
end
end)

addEventHandler("onClientPreRender"getRootElement(), function ()
    local pojazd getPedOccupiedVehicle(localPlayer)
    if not pojazd then return end
    if getElementData(pojazd"vehicle:taxo"then
     local s getPedOccupiedVehicleSeat(localPlayer)
    if not x1 or not y1 or not z1 then
        x1,y1,z1 getElementPosition(pojazd)
    end
    local x2,y2,z2 getElementPosition(pojazd)
    local dystans getDistanceBetweenPoints3D(x1,y1,z1x2,y2,z2)
    if dystans 100 then
        pasazerow 0
        for i,v in pairs(getVehicleOccupants(pojazd))do
            if getVehicleController(pojazd) ~= v then
                pasazerow pasazerow 1
            end
        end
        if pasazerow 0 then
            if == 0 then
                triggerServerEvent("da:kase"localPlayer100)
            else
                local ile getElementData(localPlayer"ileprzejechal") or 0
                if ile >= getPlayerMoney(localPlayerthen return end
                setElementData(localPlayer"ileprzejechal"ile+1)
            end
        end
        x1,y1,z1 getElementPosition(pojazd)
end
end
end)

addEventHandler("onClientVehicleStartExit"root, function(graczseat)
    if gracz ~= localPlayer then return end
    local pojazd getPedOccupiedVehicle(localPlayer)
    if seat == 0 then return end
    if getElementData(pojazd"vehicle:taxo"then
    local ile = (getElementData(localPlayer"ileprzejechal") or 0) * 100
    if ile == 0 then return end
    exports["np-notyfikacje"]:noti("Za przejazd p?acisz: "..ile.." PLN")
    triggerServerEvent("bier:kase"localPlayerile)
    setElementData(localPlayer"ileprzejechal"0)
end
end)

function scale_x(value)
    local result = (value 1440) * sx

    return result
end

function scale_y(value)
    local result = (value 900) * sy

    return result
end

function shadowText(text,x,y,w,h,color,size,font,xx,yy,x1,x2,x3,x4,x5)
    dxDrawText(text,x+1,y+1,w+1,h+1,tocolor(0,0,0),size,font,xx,yy,x1,x2,x3,x4,x5)
    dxDrawText(text,x,y,w,h,color,size,font,xx,yy,x1,x2,x3,x4,x5)
end


function wariant(plrcmdvar1var2)
    local veh getPedOccupiedVehicle(plr)
    if not veh then return end
     local var1var2 getVehicleVariant(veh)
    if (veh and getVehicleController(veh) ~= plrthen return end
    local speedxspeedyspeedz getElementVelocity(veh)
    if not speedx then speedx=0 end
    if not speedy then speedy=0 end
    if not speedz then speedz=0 end
    speedx tonumber(speedx);speedy=tonumber(speedy);speedz=tonumber(speedz)
    local speed = (speedx^speedy^speedz^2)^(0.5) * 180
    if speed 2 then 
    outputChatBox("* St?j w miejscu !",plr) return end
    local panel = {}
    for i=0,do
    panel[i] = getVehiclePanelState veh)
    end
    setVehicleVariant(vehtonumber(not var1), tonumber(not var1))
    for i=0do
    setVehiclePanelState veh,panel[i])
    end
end
addCommandHandler("wariant"wariant)

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["pystories-db"]:dbGet("SELECT * from pystories_admins WHERE serial=? AND level=?"getPlayerSerial(plr), level)
        if result and #result > 0 then
            return true
        else
            return false
        end
    else
        local result=exports["pystories-db"]:dbGet("SELECT * from pystories_admins WHERE serial=?"getPlayerSerial(plr))
        if result and #result > 0 then
            return true
        else
            return false
        end
    end
end
--///////////////////////////////////// WCZYTYWANIE POJAZD?W /////////////////////////////////
function onRespawnVehicles(_,id,poss)
    -- Settings (QUERY)
    if id then
        result=exports["pystories-db"]:dbGet("SELECT * FROM pystories_vehicles WHERE parking=1 AND id=?"id)
        query=exports["pystories-db"]:dbSet("UPDATE pystories_vehicles SET parking=0 WHERE id=?"id)
    else
        result=exports["pystories-db"]:dbGet("SELECT * FROM pystories_vehicles WHERE parking=0")
    end

    -- Pairs
    for ile,vehicle in pairs(result) do
        vehicles=ile

        if id then pos={poss[1], poss[2], poss[3], poss[4], poss[5], poss[6]}
        else pos=split(vehicle["pos"], ","end

        local color=split(vehicle["color"], ",")
        local lights=split(vehicle["headlights"], ",")

        local veh=createVehicle(vehicle["model"], pos[1], pos[2], pos[3], pos[4], pos[5], pos[6])
        setVehicleColor(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("SA "..vehicle["id"]))
        end
        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:bak"vehicle["bak"])
        setElementData(veh,"vehicle:desc"vehicle["text"] or false)
        setElementData(veh,"vehicle:mileage"vehicle["mileage"])
        setElementData(veh,"vehicle:driver"vehicle["driver"])
        setElementData(veh,"vehicle:ownedGroup"vehicle["ownedGroup"])
        setElementData(veh,"vehicle:ownedPlayer"vehicle["ownedPlayer"])
        setElementData(veh"vehicle:pojemnosc"vehicle["pojemnosc"])
        setElementData(veh,"vehicle:taxo"vehicle["taxi"])
        setElementData(veh"vehicle:rodzaj"vehicle["rodzaj"])
        
        if getElementData(veh"vehicle:rodzaj") == "LPG" then
            local acceleration getVehicleHandling(veh).engineAcceleration
            local velocity getVehicleHandling(veh).maxVelocity
            setElementData(veh"vehicle:fuel"false)
            setElementData(veh"vehicle:gas",vehicle["gas"])
            setVehicleHandling(veh"maxVelocity"velocity+1)
            setVehicleHandling(veh"engineAcceleration"acceleration+0.5)
            setVehicleHandling(veh"engineType""electric")
        elseif getElementData(veh"vehicle:rodzaj") == "ON" then
            local acceleration getVehicleHandling(veh).engineAcceleration
            local velocity getVehicleHandling(veh).maxVelocity
            setVehicleHandling(veh"maxVelocity"velocity+4)
            setVehicleHandling(veh"engineAcceleration"acceleration+2.0)
            setVehicleHandling(veh"engineType""diesel")
        elseif getElementData(veh"vehicle:rodzaj") == "PB" then
            local acceleration getVehicleHandling(veh).engineAcceleration
            local velocity getVehicleHandling(veh).maxVelocity
            setVehicleHandling(veh"maxVelocity"velocity+2)
            setVehicleHandling(veh"engineAcceleration"acceleration+1.3)
            setVehicleHandling(veh"engineType""petrol")
        end

        if getElementData(veh"vehicle:pojemnosc") == 1 then
            setElementData(veh"vehicle:poj""1.2")
        elseif getElementData(veh"vehicle:pojemnosc") == 2 then
            local acceleration getVehicleHandling(veh).engineAcceleration
            local velocity getVehicleHandling(veh).maxVelocity
            setElementData(veh"vehicle:poj""1.4")
            setVehicleHandling(veh"maxVelocity"velocity+2)
            setVehicleHandling(veh"engineAcceleration"acceleration+3)
        elseif getElementData(veh"vehicle:pojemnosc") == 3 then
            local acceleration getVehicleHandling(veh).engineAcceleration
            local velocity getVehicleHandling(veh).maxVelocity
            setElementData(veh"vehicle:poj""1.6")
            setVehicleHandling(veh"maxVelocity"velocity+3)
            setVehicleHandling(veh"engineAcceleration"acceleration+4)
        elseif getElementData(veh"vehicle:pojemnosc") == 4 then
            local acceleration getVehicleHandling(veh).engineAcceleration
            local velocity getVehicleHandling(veh).maxVelocity
            setElementData(veh"vehicle:poj""1.8")
            setVehicleHandling(veh"maxVelocity"velocity+6)
            setVehicleHandling(veh"engineAcceleration"acceleration+7)
        elseif getElementData(veh"vehicle:pojemnosc") == 5 then
            local acceleration getVehicleHandling(veh).engineAcceleration
            local velocity getVehicleHandling(veh).maxVelocity
            setElementData(veh"vehicle:poj""2.0")
            setVehicleHandling(veh"maxVelocity"velocity+9)
            setVehicleHandling(veh"engineAcceleration"acceleration+10)
        elseif getElementData(veh"vehicle:pojemnosc") == 6 then
            local acceleration getVehicleHandling(veh).engineAcceleration
            local velocity getVehicleHandling(veh).maxVelocity
            setElementData(veh"vehicle:poj""2.2")
            setVehicleHandling(veh"maxVelocity"velocity+10)
            setVehicleHandling(veh"engineAcceleration"acceleration+10)
        elseif getElementData(veh"vehicle:pojemnosc") == 7 then
            local acceleration getVehicleHandling(veh).engineAcceleration
            local velocity getVehicleHandling(veh).maxVelocity
            setElementData(veh"vehicle:poj""3.0")
            setVehicleHandling(veh"maxVelocity"velocity+14)
            setVehicleHandling(veh"engineAcceleration"acceleration+12)
        elseif getElementData(veh"vehicle:pojemnosc") == 8 then
            local acceleration getVehicleHandling(veh).engineAcceleration
            local velocity getVehicleHandling(veh).maxVelocity
            setElementData(veh"vehicle:poj""3.2")
            setVehicleHandling(veh"maxVelocity"velocity+16)
            setVehicleHandling(veh"engineAcceleration"acceleration+16)
        elseif getElementData(veh"vehicle:pojemnosc") == 9 then
            local acceleration getVehicleHandling(veh).engineAcceleration
            local velocity getVehicleHandling(veh).maxVelocity
            setElementData(veh"vehicle:poj""4.0")
            setVehicleHandling(veh"maxVelocity"velocity+18)
            setVehicleHandling(veh"engineAcceleration"acceleration+16)
        elseif getElementData(veh"vehicle:pojemnosc") == 10 then
            local acceleration getVehicleHandling(veh).engineAcceleration
            local velocity getVehicleHandling(veh).maxVelocity
            setElementData(veh"vehicle:poj""4.2")
            setVehicleHandling(veh"maxVelocity"velocity+20)
            setVehicleHandling(veh"engineAcceleration"acceleration+17)
        elseif getElementData(veh"vehicle:pojemnosc") == 11 then
            local acceleration getVehicleHandling(veh).engineAcceleration
            local velocity getVehicleHandling(veh).maxVelocity
            setElementData(veh"vehicle:poj""5.0")
            setVehicleHandling(veh"maxVelocity"velocity+24)
            setVehicleHandling(veh"engineAcceleration"acceleration+20)
        elseif getElementData(veh"vehicle:pojemnosc") == 12 then
            local acceleration getVehicleHandling(veh).engineAcceleration
            local velocity getVehicleHandling(veh).maxVelocity
            setElementData(veh"vehicle:poj""5.2")
            setVehicleHandling(veh"maxVelocity"velocity+25)
            setVehicleHandling(veh"engineAcceleration"acceleration+21)
        elseif getElementData(veh"vehicle:pojemnosc") == 13 then
            local acceleration getVehicleHandling(veh).engineAcceleration
            local velocity getVehicleHandling(veh).maxVelocity
            setElementData(veh"vehicle:poj""6.3")
            setVehicleHandling(veh"maxVelocity"velocity+29)
            setVehicleHandling(veh"engineAcceleration"acceleration+22)
        elseif getElementData(veh"vehicle:pojemnosc") == 14 then
            local acceleration getVehicleHandling(veh).engineAcceleration
            local velocity getVehicleHandling(veh).maxVelocity
            setElementData(veh"vehicle:poj""7.2")
            setVehicleHandling(veh"maxVelocity"velocity+33)
            setVehicleHandling(veh"engineAcceleration"acceleration+23)
        elseif getElementData(veh"vehicle:pojemnosc") == 15 then
            local acceleration getVehicleHandling(veh).engineAcceleration
            local velocity getVehicleHandling(veh).maxVelocity
            setElementData(veh"vehicle:poj""9.0")
            setVehicleHandling(veh"maxVelocity"velocity+40)
            setVehicleHandling(veh"engineAcceleration"acceleration+29)
        end
        
        if getElementHealth(veh) < 1000 then
        local zyciepojazdu getVehicleHandlingProperty(veh,"maxVelocity")
            setVehicleHandling(veh"maxVelocity"zyciepojazdu-5.5);
        elseif getElementHealth(veh) < 900 then
        local zyciepojazdu getVehicleHandlingProperty(veh,"maxVelocity")
            setVehicleHandling(veh"maxVelocity"zyciepojazdu-10.5);
        elseif getElementHealth(veh) < 800 then
        local zyciepojazdu getVehicleHandlingProperty(veh,"maxVelocity")
            setVehicleHandling(veh"maxVelocity"zyciepojazdu-30);
        elseif getElementHealth(veh) < 700 then
        local zyciepojazdu getVehicleHandlingProperty(veh,"maxVelocity")
            setVehicleHandling(veh"maxVelocity"zyciepojazdu-40.5);
        elseif getElementHealth(veh) < 600 then
        local zyciepojazdu getVehicleHandlingProperty(veh,"maxVelocity")
            setVehicleHandling(veh"maxVelocity"zyciepojazdu-50);
        elseif getElementHealth(veh) < 500 then
        local zyciepojazdu getVehicleHandlingProperty(veh,"maxVelocity")
            setVehicleHandling(veh"maxVelocity"zyciepojazdu-60.5);
        elseif getElementHealth(veh) < 400 then
        local zyciepojazdu getVehicleHandlingProperty(veh,"maxVelocity")
            setVehicleHandling(veh"maxVelocity"zyciepojazdu-70);
        elseif getElementHealth(veh) < 300 then
        local zyciepojazdu getVehicleHandlingProperty(veh,"maxVelocity")
            setVehicleHandling(veh"maxVelocity"zyciepojazdu-80.5);
        end
        
        
        local mk1 vehicle['mk1']
        local mk2 vehicle['mk2']
        local gleba vehicle['gleba']
        local naped vehicle['naped']
        local rh vehicle['rh']
        
        
        if (type(vehicle['rent']) == "string"then
        local tabelka = {}
        local rente split(vehicle['rent'], ',')
        for k,v in ipairs(rente) do
        table.insert(tabelka,v)
        end
        setElementData(veh,"vehicle:rent"tabelka or false)
        else
        setElementData(veh,"vehicle:rent",0)
        end
        
        
        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")
        local skret getVehicleHandlingProperty(veh,"steeringLock")
        setVehicleHandling(veh,"engineAcceleration",fast+5)
        setVehicleHandling(veh,"maxVelocity",maxfast+5)
        setVehicleHandling(veh,"mass",masa+8)
        setVehicleHandling(veh"steeringLock"skret+10.7)
        setVehicleHandling(veh,"tractionMultiplier",xd+0.1)
        setVehicleHandling(veh,"dragCoeff",coef+0.07)
        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+7)
        setVehicleHandling(veh"maxVelocity",maxfast+17)
        setVehicleHandling(veh,"tractionMultiplier",xd+0.1)
        setVehicleHandling(veh,"mass",masa+1)
        setVehicleHandling(veh,"dragCoeff",coef+0.07)
        end
        
        if tonumber(gleba) ~= 0 then
        local dol getVehicleHandlingProperty(veh,"engineAcceleration")
        setVehicleHandling(veh,"suspensionLowerLimit",dol-0.1)
        end
        
                if tonumber(naped) ~= 0 then
        local fast getVehicleHandlingProperty(veh,"engineAcceleration")        
        setVehicleHandling(veh,"driveType","awd")
        end
                local hood vehicle['removehood']
        if tonumber(hood) == 1 then
         setElementData(veh,"vehicle:bonnet",true)
        end
        local mask vehicle['masked']
        if tonumber(mask) ~= 0 then
         setElementData(veh,"vehicle:masked",vehicle['masked'])
        end
        setElementData(veh,"neony"vehicle["neon"])
        if vehicle["blokada"] == "true" then
            setElementData(veh,"vehicle:block"true)
            setVehicleWheelStates(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("[pojazdy] Loaded "..vehicles.." vehicles.")
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 blokada=getElementData(vehicle,"vehicle:block")
        local neon=getElementData(vehicle,"neony")
        local h1,h2,h3=getVehicleHeadLightColor(vehicle)
        local paintjob=getVehiclePaintjob(vehicle)
        local rear="Brak"
        local mask=getElementData(vehicle,"vehicle:masked") or 0
        local 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["pystories-db"]:dbSet(string.format("UPDATE pystories_vehicles SET model='%d', pos='%.2f,%.2f,%.2f,%.2f,%.2f,%.2f', rent='%d',text='%s', masked='%d', health='%d', fuel='%d', mileage='%d', frozen='%d', driver='%s', color='%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d', panelstates='%s', paintjob='%d', tuning='%s', headlights='%d,%d,%d', ownedPlayer='%d', neon='%d', blokada='%s' WHERE id=%d",
        modelx,y,zrx,ry,rz"0",descmaskhealthfuelmileagefrozendriverc1,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['pystories-db']:dbSet("UPDATE pystories_vehicles SET rent=? WHERE id=?",rr,id)
        end
    end
end

function onParkVehicle(vehicle) 
    local query=exports["pystories-db"]:dbSet("UPDATE pystories_vehicles SET parking=1 WHERE id=?"getElementData(vehicle,"vehicle:id"))
    if query then
        local zneony=getElementData(vehicle,"zneony")
        if (zneony and type(zneony)=="table"then
        destroyElement(zneony[1])
        destroyElement(zneony[2])
        removeElementData(vehicle,"zneony")
        end
        destroyElement(vehicle)
    end
end

--///////////////////////////////////// SPRAWDZANIE USTAWIE? /////////////////////////////////
function getSettings(plr,code,value)
    local sid=getElementData(plr,"player:sid")
    local uid=getElementData(plr,"player:sid")
    if not sid then return end
    if value == "faction" then
        local result=exports["pystories-db"]:dbGet("SELECT * FROM pystories_factions WHERE code=? AND sid=?"codesid)
        if result and #result > 0 then
            return result[1].code
        else
            return false
        end
    end
    if value == "organization" then
        local result=exports["pystories-db"]:dbGet("SELECT * FROM ogrpg_organizations WHERE uid=?"uid)
        if result and #result > 0 then
            return result[1].code
        else
            return false
        end
    end
    if value == "owner" then
        local result=exports["pystories-db"]:dbGet("SELECT * FROM pystories_users WHERE id=?"sid)
        if result and #result > 0 then
            return result[1].id
        else
            return false
        end
    end
end

--///////////////////////////////////// INNE USTAWIENIA /////////////////////////////////
addEventHandler("onVehicleExit"root, function(plr,seat)
    if seat ~= 0 then return end 
       onSaveVehicle(plr)
       setVehicleEngineState(plrfalse)
    setVehicleDamageProof(plrtrue)
    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("[pojazdy] 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,"vehicle:taxo") == 1 then
        outputChatBox("#00ff00&#10004; #ffffff- Posiadasz taxometr, domy?lna stawka za km to 500 $",plr,255,255,255,true)
        outputChatBox("#00ff00&#10004; #ffffff- Aby zmieni? stawk? taxometru wpisz /taxo.cena",plr,255,255,255,true)
    end
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
        outputChatBox("* Posiadasz neony w pojezdzie, mo?esz wl?czy? i wylaczyc je za pomoc? przycisku N.",plr)
        bindKey(plr'n''down'bindHoron4plr)
    end
end)...


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-03-26, 21:29


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Warto?? domy?ln? ustawi?e? chocia?by na liczb? (int) 0?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-03-26, 21:43


Matikmontana

Modern Stories






Wiek: 22
Na forum: 2473 dni
Posty: 423
Nick w MP: Mazeusz*

Piwa: 1015

Respekt: 130
Respekt: 130

Ostrzeżeń: 60%


tak mam

[ Dodano: 2020-03-27, 15:10 ]
Wie kto? jak to zapisa? ?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-03-28, 04:06


Hades.

Łiiiiiiiiii






Wiek: 22
Na forum: 4699 dni
Posty: 372
Nick w MP: Hades

Piwa: 3214

Respekt: 337,8
Respekt: 337,8Respekt: 337,8Respekt: 337,8

"Matikmontana" napisał/a:

Obrazek

tak mam

[ Dodano: 2020-03-27, 15:10 ]
Wie kto? jak to zapisa? ?


Nie ustawi?e? warto?ci na 0, "Brak" odpowiada za domy?ln? warto??, kliknij w strukture, Taxi >> zmie? i warto?? domy?lna ustaw na 0

Podpis
Skrypty/Grafiki na zamówienie!
Kontakt: Discord R35#5507

Discord związany z pomocą: https://discord.gg/ttkQTsc
Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
Matikmontana
Wysłany: 2020-03-28, 17:00


Matikmontana

Modern Stories






Wiek: 22
Na forum: 2473 dni
Posty: 423
Nick w MP: Mazeusz*

Piwa: 1015

Respekt: 130
Respekt: 130

Ostrzeżeń: 60%
ustawi?em na 0 i w skrypcie tak
addEventHandler("onClientRender"root, function()
    local pojazd getPedOccupiedVehicle(localPlayer)
    if getPedOccupiedVehicle(localPlayerthen
        if getElementData(veh'vehicle:taxo') == 0 then return end
        if getElementData(pojazd"vehicle:taxo"then
        local seat getPedOccupiedVehicleSeat(localPlayer)
        if seat == 0 then


[ Dodano: 2020-03-28, 17:00 ]
I dalej dupa

[ Dodano: 2020-03-28, 17:02 ]
Dobra Zrobiem

Komentarz Wilq dodany 2020-03-28, 17:26Czy problem został rozwiązany?
Ostatnio zmieniony przez Wilq 2020-03-28, 17:26, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Tagi: zapis :: pojazdów :: bazy
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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