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

Wysłany: 2018-08-30, 19:04


Yank3S







Wiek: 21
Na forum: 2978 dni
Posty: 21
Nick w MP: Yank3S

Piwa: 24

Respekt: 60

A wi?c tak, gdy pr?buje zabra? prawo jazdy, to pisze ?e zabra?o a i tak moge wchodzic do pojazdu. Jak wpisuje /opj 1, to pisze ?e odda?o.


SS'y z Zabierania prawka:
https://imgur.com/a/6etA1K2


SS'y z ACL:





Kody:


ogrpg-core/vehicles.lua:
--[[
    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.
]]
-- Get vehicle keys
function getVehicleKey(plr,veh)
    if plr and veh then
        local uid=getElementData(plr,"player:uid")
        if not uid then return end
        if getElementData(plr,"player:admin") or uid == getElementData(veh,"vehicle:ownedPlayer") then
            return true
        else
            return false
        end
    end
end
local categoryL={[592] = true,[553] = true,[577] = true,[488] = true,[511] = true,[497] = true,[548] = true,[563] = true,[512] = true,[476] = true,[593] = true,[447] = true,[425] = true,[519] = true,[520] = true,[460] = true,[417] = true,[469] = true,[487] = true,[513] = true}
addEventHandler("onVehicleStartEnter", root, function(plr,seat,jacked)
    if getElementHealth(source) < 302 then
        setElementHealth(source,302)
    end
end)
function jestwtabeli(***,truj)
    for k,v in pairs(***) do
        if v == truj then
           return true
        end
    end
    return false
end
addCommandHandler("vdodaj",function(plr,cmd,target)
    local veh = getPedOccupiedVehicle(plr)
    if not veh then outputChatBox("* Nie siedzisz w aucie!",plr,255,0,0) return end
    if getElementData(veh,"vehicle:ownedPlayer") ~= getElementData(plr,"player:uid") then outputChatBox("* Ten pojazd nie nale?y od ciebie!",plr,255,0,0) return end
    if not target then
        outputChatBox("* Zabrano dostep wszystkim gracz?!",plr,255,0,0)
        setElementData(veh,"vehicle:rent",0)
    else
        local target=findPlayer(plr, target)
        if not target then
            outputChatBox("* Nie znaleziono gracza online!",plr,255,0,0)
            return
        end
        local rent = getElementData(veh,"vehicle:rent")
        if (type(rent) ~= "table") then
            local tabelka = {}
            table.insert(tabelka,getElementData(target,"player:uid"))
            setElementData(veh,"vehicle:rent",tabelka)
            outputChatBox(string.format("*Dodano gracza "..getPlayerName(target).."(UID :"..getElementData(target,"player:uid")..") do wypo?ycze?"),plr)
        else
            local tabelka = rent
            if jestwtabeli(tabelka,getElementData(target,"player:uid")) then outputChatBox("* Ten gracz aktualnie posiada kluczyki do twojego pojazdu!",plr) return end
             if #tabelka > 5 then outputChatBox("Mo?esz wypo?yczy? maksymalnie 5 gracz?!",plr) return end
            table.insert(tabelka,getElementData(target,"player:uid"))
            setElementData(veh,"vehicle:rent",tabelka)
            outputChatBox(string.format("*Dodano gracza "..getPlayerName(target).."(UID :"..getElementData(target,"player:uid")..") do wypo?ycze?"),plr)
        end
    end
end)

-- Tutaj dalsza cze?c kodu
--[[addEventHandler("onVehicleStartEnter", root, function(plr,seat,jacked)
    if seat ~= 0 then return end
    if categoryL[getElementModel(source)] then return end
    local query=string.format("SELECT * FROM ogrpg_punish WHERE type=%q AND active=1 AND serial=%q AND time>NOW() LIMIT 1","prawko", getPlayerSerial(plr))
    local result=exports["ogrpg-db"]:dbSet(query)
    if (result) then
        outputChatBox(" Posiadasz zawieszone prawo jazdy do "..result["time"]..", za: "..result["reason"], plr, 255, 0, 0)
        cancelEvent()
    else
        exports["ogrpg-db"]:dbSet("DELETE FROM ogrpg_punish WHERE type=? AND active=1 AND serial=?", "prawko", getPlayerSerial(plr))
    end
end)

addEventHandler("onVehicleEnter", root, function(plr,seat,jacked)
    if seat ~= 0 then return end
    if categoryL[getElementModel(source)] then return end
        local queryA=string.format("SELECT * FROM ogrpg_punish WHERE type=%q AND active=1 AND serial=%q AND time>NOW() LIMIT 1","prawko", getPlayerSerial(plr))
        local resultA=exports["ogrpg-db"]:pobierzWyniki(queryA)
        if (resultA) then
            --setControlState ( plr, "enter_exit", true )
            setTimer(setControlState, 800, 1, plr,"enter_exit", true)
            setTimer(setControlState, 1800, 1, plr,"enter_exit", false)
            outputChatBox("* Posiadasz zawieszone prawo jazdy do "..resultA["time"]..", za: "..resultA["reason"], plr, 255, 0, 0)
        else
            exports["ogrpg-db"]:dbSet("DELETE FROM ogrpg_punish WHERE type=? AND active=1 AND serial=?", "prawko", getPlayerSerial(plr))
        end
end)

addEventHandler("onVehicleStartEnter", root, function(plr,seat,jacked)
    if seat ~= 0 then return end
    if not categoryL[getElementModel(source)] then return end
    local query=string.format("SELECT * FROM ogrpg_punish WHERE type=%q AND active=1 AND serial=%q AND time>NOW() LIMIT 1","L", getPlayerSerial(plr))
    local result=exports["ogrpg-db"]:pobierzWyniki(query)
    if (result) then
        outputChatBox(" Posiadasz zawieszona licencje  do "..result["time"]..", za: "..result["reason"], plr, 255, 0, 0)
        cancelEvent()
    else
        exports["ogrpg-db"]:dbSet("DELETE FROM ogrpg_punish WHERE type=? AND active=1 AND serial=?", "L", getPlayerSerial(plr))
    end
end)

addEventHandler("onVehicleEnter", root, function(plr,seat,jacked)
    if seat ~= 0 then return end
    if not categoryL[getElementModel(source)] then return end
        local queryA=string.format("SELECT * FROM ogrpg_punish WHERE type=%q AND active=1 AND serial=%q AND time>NOW() LIMIT 1","L", getPlayerSerial(plr))
        local resultA=exports["ogrpg-db"]:pobierzWyniki(queryA)
        if (resultA) then
            --setControlState ( plr, "enter_exit", true )
            setTimer(setControlState, 800, 1, plr,"enter_exit", true)
            setTimer(setControlState, 1800, 1, plr,"enter_exit", false)
            outputChatBox("* Posiadasz zawieszona licencje do "..resultA["time"]..", za: "..resultA["reason"], plr, 255, 0, 0)
        else
            exports["ogrpg-db"]:dbSet("DELETE FROM ogrpg_punish WHERE type=? AND active=1 AND serial=?", "L", getPlayerSerial(plr))
        end
end)--]]

addCommandHandler("vopis", function(plr,cmd,...)
    if not getElementData(plr, "player:admin") then outputChatBox("* Brak uprawnie? do u?ycia tej komendy !", plr) return end
    local desc=table.concat(arg, " ")
    local veh=getPedOccupiedVehicle(plr)
    if not veh then
        outputChatBox("* Musisz siedzie? w poje?dzie kt?rego opis chcesz zmieni?.", plr, 255, 0, 0)
        return
    end
    if getElementData(veh, "vehicle:desc") then
        setElementData(veh, "vehicle:desc", false)
    return end
    if string.len(desc) < 2 then
        outputChatBox("* U?ycie: /vopis <opis min 2 znaki>", plr)
        return
    end

    descc=string.format("%s", desc)
    setElementData(veh,"vehicle:desc",descc)
end)

addEventHandler ( "onVehicleEnter", getRootElement(), function(thePlayer, seat, jacked) 
    if seat==0 then
--        setVehicleDoorOpenRatio(source, 2, 0, 500)
        if (getVehicleDoorState(source,2)==0) then
            setVehicleDoorState(source,2,1)
            setVehicleDoorState(source,2,0)
        end
    elseif seat==1 then
        if (getVehicleDoorState(source,3)==0) then
            setVehicleDoorState(source,3,1)
            setVehicleDoorState(source,3,0)
        end
    else
--        if (getVehicleDoorState(source,4)==0) then
            setVehicleDoorState(source,4,1)
            setVehicleDoorState(source,4,0)
--        end
--        if (getVehicleDoorState(source,5)==0) then
            setVehicleDoorState(source,5,1)
            setVehicleDoorState(source,5,0)
--        end

    end
end)

addEventHandler("onPlayerQuit", root, function()
    if not getElementData(source,"player:job") then return end
    local veh=getPedOccupiedVehicle(source)
    if not veh then return end
    local id=getElementData(veh,"vehicle:id")
    if not id then
    if getElementData(source,"player:job") == "Sweepers" then return end
    triggerEvent("destroyVehicle", root, veh)
    end
end)


--[[
function streamIn( element, forpl )
   element = element or source
   if ( not getVehicleOccupant(element, 0) and not getVehicleOccupant( element, 1 ) and not getVehicleOccupant( element, 2 ) and not getVehicleOccupant( element, 3 ) and not getVehicleOccupant( element, 4 ) ) then
      local towed = getVehicleTowedByVehicle(element)
      if towed then
        triggerClientEvent( forpl, "setElementPosForPl", forpl, element, towed ) 
      else
        triggerClientEvent( forpl, "setElementPosForPl", forpl, element, false ) 
      end
   else
      local tower = getVehicleTowingVehicle(element)
      if tower then
        triggerClientEvent( forpl, "setElementPosForPl", forpl, tower, element ) 
      else
        triggerClientEvent( forpl, "setElementPosForPl", forpl, element, false ) 
      end
    end
end
addEvent( "streamIn", true )

addEventHandler( "streamIn", getRootElement(), streamIn )

]]--
 


ogrpg-vehicles/s_vehbuy.lua
vehicles=0
root=getRootElement()
resourceRoot=getResourceRootElement(getThisResource())

local nlOffsets={
    [411]={-1,0,-0.6},    -- infernus
    [470]={-1,0,-0.4},    -- patriot
    [541]={-0.9,0,-0.4},    -- bulelt
    [549]={-0.9,0,-0.4},    -- tampa
    [587]={-1,0,-0.5},    -- euros
}

local nlIDX={
    3962,2113,1784,2054,2428,2352
}

function getVehicleHandlingProperty ( element, property )
    if isElement ( element ) and getElementType ( element ) == "vehicle" and type ( property ) == "string" then
        local handlingTable = getVehicleHandling ( element ) 
        local value = handlingTable[property] 
 
        if value then
            return value
        end
    end
 
    return false
end

function getAdmin2(plr,level)
    if level then
        local result=exports["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("SA "..vehicle["id"]))
        end
        setElementFrozen(veh, (vehicle["frozen"]) > 0)
        if vehicle["paintjob"] ~= 3 then
        setVehiclePaintjob(veh, vehicle["paintjob"])
        end
        setElementHealth(veh, vehicle["health"])
        setElementData(veh,"vehicle:spawn",true)
        setElementData(veh,"vehicle:id", vehicle["id"])
        setElementData(veh,"vehicle:fuel", vehicle["fuel"])
        setElementData(veh,"vehicle: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 xfour = vehicle['naped']
        
        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(xfour) == 1 then
        setVehicleHandling(veh,"driveType","awd")
        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+4.5)
        setVehicleHandling(veh,"maxVelocity",maxfast+18)
        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+8.3)
        setVehicleHandling(veh,"maxVelocity",maxfast+28)
        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")
        local masa = getVehicleHandlingProperty(veh,"mass")
        local masa2 = getVehicleHandlingProperty(veh,"turnMass")
        local xd = getVehicleHandlingProperty(veh,"tractionMultiplier")
        local coef = getVehicleHandlingProperty(veh,"dragCoeff")
        setVehicleHandling(veh,"engineAcceleration",fast+10.3)
        setVehicleHandling(veh,"maxVelocity",maxfast+48)
        setVehicleHandling(veh,"tractionMultiplier",xd+0.2)
        setVehicleHandling(veh,"mass",masa+200)
        setVehicleHandling(veh,"steeringLock",42)
        setVehicleHandling(veh,"dragCoeff",coef-0.21)
        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(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
        -- Setting
        local panelstates={}
        local model=getElementModel(vehicle)
        local health=getElementHealth(vehicle)
        local x,y,z=getElementPosition(vehicle)
        local rx,ry,rz=getElementRotation(vehicle)
        local desc=getElementData(vehicle,"vehicle:desc") or ""
        local id=getElementData(vehicle,"vehicle:id")
        local fuel=getElementData(vehicle,"vehicle:fuel")
        local mileage=getElementData(vehicle,"vehicle:mileage")
        local c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12=getVehicleColor(vehicle, true)
        local driver=getElementData(vehicle,"vehicle:driver") or ""
        local rent=getElementData(vehicle,"vehicle:rent")
        local player=getElementData(vehicle,"vehicle:ownedPlayer")
     --   local 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', 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",
        model, x,y,z, rx,ry,rz, "0",desc, health, fuel, mileage, frozen, driver, c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12, panelstates, paintjob, upgrades, h1,h2,h3, player, neon, tostring(blokada), id))
        if (type(rent) == "table") then
        local rr = string.format("%s", table.concat(rent, ',') )
    --    outputDebugString(rr)
        local query2= exports['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 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 ms_organizacje 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["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, 'b', '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")
        outputChatBox("* Posiadasz neony w pojezdzie, mo?esz wl?czy? i wylaczyc je za pomoc? przycisku N.",plr)
        bindKey(plr, 'b', 'down', bindHoron4, plr)
    end
end)

--///////////////////////////////////// SPRAWDZENIE W?A?CICIELA /////////////////////////////////
addEventHandler("onVehicleStartEnter", resourceRoot, function(plr,seat,jacked)
    if seat == 0 then
        local rent=getElementData(source, "vehicle:rent")
        local group=getElementData(source, "vehicle:ownedGroup")
        if group == "0" then group = "Brak" end
        local player=getElementData(source, "vehicle:ownedPlayer")
        if getAdmin2(plr, 4) or getPlayerName(plr) == "Ryjek" then
            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.', plr, 255, 0 ,0)
        return end
        local zneony=getElementData(veh,"zneony")
        if (zneony and type(zneony)=="table") then
        destroyElement(zneony[1])
        destroyElement(zneony[2])
        removeElementData(veh,"zneony")

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

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


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


--[[
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("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(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)

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 mk3 = exports['ogrpg-db']:dbGet("SELECT * FROM ogrpg_vehicles WHERE id=? AND mk3=?",getElementData(source, "vehicle:id"), "1")
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 rh = 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")
if #mk1 > 0 then outputChatBox("&#9432; Pomy?lnie zaprogramowano MK1",plr,0,154,255) end
if #mk2 > 0 then outputChatBox("&#9432; Pomy?lnie zaprogramowano MK2",plr,0,154,255) end
if #mk3 > 0 then outputChatBox("&#9432; Pomy?lnie zaprogramowano MK3",plr,0,154,255) end
if #rh > 0 then outputChatBox("&#9432; Pomy?lnie zaprogramowano RH1",plr,0,154,255) end
if #np > 0 then outputChatBox("&#9432; Pomy?lnie zaprogramowano Nap?d 4x4",plr,0,154,255) 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)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-30, 19:08


Norbert1234

Nie umiem w LUA






Wiek: 22
Na forum: 4129 dni
Posty: 319
Nick w MP: Gusterowskyy

Piwa: 244

Respekt: 60

b??dy db 3 :P

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-30, 19:08


Yank3S







Wiek: 21
Na forum: 2978 dni
Posty: 21
Nick w MP: Yank3S

Piwa: 24

Respekt: 60

ju? podaje ;)

[ Dodano: 2018-08-30, 19:09 ]
@edit: nic nie wyskakuje z b??d?w db3

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-30, 19:12


Norbert1234

Nie umiem w LUA






Wiek: 22
Na forum: 4129 dni
Posty: 319
Nick w MP: Gusterowskyy

Piwa: 244

Respekt: 60

Mam pytanie. Albo jestem ?lepy xD, albo nie widz? kodu, kt?ry odpowiada za zabieranie owego prawka :)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-30, 19:13


Yank3S







Wiek: 21
Na forum: 2978 dni
Posty: 21
Nick w MP: Yank3S

Piwa: 24

Respekt: 60

no bo nie moge wys?a? dutyadmin, s_cmd.lua, bo pisze ?e za d?ugie jest (35k znak?w max.)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-30, 19:15


Gravgor







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

Piwa: 702

Respekt: 57,8

Modu? wgrany? DB2 i ogrpg-db pod??czone? Dutyadmin dodane do ACL admin?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-30, 19:15


Yank3S







Wiek: 21
Na forum: 2978 dni
Posty: 21
Nick w MP: Yank3S

Piwa: 24

Respekt: 60

addCommandHandler("zpj", function(plr,cmd,cel,time,type,...)
    if getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1) or getAdmin(plr,4) then
        local reason=table.concat({...}, " ")
        if not cel or not tonumber(time) or not type or not reason then
            outputChatBox("* U?ycie: /zpj <nick/ID> <czas> <jednostka: m/h/y/w> <pow?d>", plr)
            return
        end
        local target=exports["ogrpg-core"]:findPlayer(plr,cel)
        if not target then
            outputChatBox("* Nie znaleziono podanego gracza.", plr, 255, 0, 0)
            return
        end
        if isPedInVehicle(target) then
            removePedFromVehicle(target)
        end
        --if getElementData(target,"player:uid") == 1 then outputChatBox("* Nie mo?na zabra? prawo jazdy graczowi o uid: 1 !",plr) return end
        result=pobierzDate(type,time)
        triggerClientEvent(root, "admin:rendering", root, "* ["..getElementData(target,"id").."]"..getPlayerName(target):gsub("#%x%x%x%x%x%x","").." otrzyma?(a) zakaz prowadzenia pojazd?w kat(ABC) od ["..getElementData(plr,"id").."]"..getPlayerName(plr):gsub("#%x%x%x%x%x%x","")..": "..reason.."("..time .. type ..")")
        exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_punish (serial,reason,time,type) VALUES (?,?,?,?)", getPlayerSerial(target), reason, result, "A")
        exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_punish (serial,reason,time,type) VALUES (?,?,?,?)", getPlayerSerial(target), reason, result, "B")
        exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_punish (serial,reason,time,type) VALUES (?,?,?,?)", getPlayerSerial(target), reason, result, "C")
        outputChatBox(" ", target, 255, 0, 0)
        outputChatBox(" ", target, 255, 0, 0)
        outputChatBox("Otrzyma?e?(a?) zakaz prowadzenia pojazd?w od "..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").."", target, 255, 0, 0)
        outputChatBox(" ", target, 255, 0, 0)
        outputChatBox("Pow?d: "..reason:gsub("#%x%x%x%x%x%x","").."", target, 255, 255, 255)
        outputChatBox(" ", target, 255, 0, 0)
        outputChatBox("Czas: "..time .. type .."", target, 255, 255, 255)
        outputChatBox(" ", target, 255, 0, 0)
        outputChatBox(" ", target, 255, 0, 0)
    end
end)

addCommandHandler("zpl", function(plr,cmd,cel,time,rodzaj,...)
    if getAdmin(plr,4) or getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1) then
        local reason=table.concat({...}, " ")
        if not cel or not tonumber(time) or not rodzaj or not reason then
            outputChatBox("* U?ycie: /zpl <nick/ID> <czas> <jednostka: m/h/d/w> <pow?d>", plr)
            return
        end
        local target=exports["ogrpg-core"]:findPlayer(plr,cel)
        if not target then
            outputChatBox("* Nie znaleziono podanego gracza.", plr, 255, 0, 0)
            return
        end
        local query=string.format("SELECT * FROM ogrpg_punish WHERE type=%q AND active=1 AND serial=%q AND time>NOW() LIMIT 1","L", getPlayerSerial(target))
        local result=exports["DB2"]:pobierzWyniki(query)
        if (result) then
            return outputChatBox("* Gracz Posiada zawieszone prawo jazdy do "..result["time"]..", za: "..result["reason"], plr, 255, 0, 0)
        else
            exports["ogrpg-db"]:dbSet("DELETE FROM ogrpg_punish WHERE type=? AND active=1 AND serial=?", "L", getPlayerSerial(plr))
        end
        if isPedInVehicle(target) then
            removePedFromVehicle(target)
        end
        if tonumber(time) <= 0 then return end
        local result = "DATE()"
        if rodzaj == "m" then
        result = string.format('DATE_ADD(NOW(), INTERVAL %d MINUTE)',time)
        elseif rodzaj == "h" then
        result = string.format('DATE_ADD(NOW(), INTERVAL %d HOUR)',time)
        elseif rodzaj == "d" then
        result = string.format('DATE_ADD(NOW(), INTERVAL %d DAY)',time)
        elseif rodzaj == "w" then
        result = string.format('DATE_ADD(NOW(), INTERVAL %d WEEK)',time)
        end
        reason = reason.." |od "..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").."|"
        triggerClientEvent(root, "admin:rendering", root, "* ["..getElementData(target,"id").."]"..getPlayerName(target):gsub("#%x%x%x%x%x%x","").." otrzyma?(a) zakaz prowadzenia maszyn Lotniczych (L) "..reason.."("..time .. rodzaj ..")")
        local query = string.format("INSERT INTO ogrpg_punish (serial,reason,time,type) VALUES ('%s','%s',%s,'%s')", getPlayerSerial(target), reason, result, "L")
        exports["ogrpg-db"]:dbSet(query)
    end
end)

addCommandHandler("opl", function(plr,cmd,cel)
    if getAdmin(plr,4) or getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1) then
        if not cel then
            outputChatBox("* U?ycie: /opl <nick/ID> ", plr)
            return
        end
        local target=exports["ogrpg-core"]:findPlayer(plr,cel)
        if not target then
            outputChatBox("* Nie znaleziono podanego gracza.", plr, 255, 0, 0)
            return
        end
        local query=string.format("SELECT * FROM ogrpg_punish WHERE type=%q AND active=1 AND serial=%q AND time>NOW() LIMIT 1","L", getPlayerSerial(target))
        local result=exports["DB2"]:pobierzWyniki(query)
        if (result) then
            exports["ogrpg-db"]:dbSet("DELETE FROM ogrpg_punish WHERE type=? AND active=1 AND serial=?", "L", getPlayerSerial(target))
            outputChatBox("* Gracz "..getPlayerName(target):gsub("#%x%x%x%x%x%x","").." odzyskal swoja Licencje!", plr, 0, 255, 0)
            outputChatBox("* "..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").." oddal Twoja Licencje!", target, 0, 255, 0)
        else
            outputChatBox("* Gracz "..getPlayerName(target):gsub("#%x%x%x%x%x%x","").." nie posiada zabranej Licencji!", plr, 0, 255, 0)
        end
        exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_prawka_logs (komu_oddali,kto_oddal,typ) VALUES (?,?,?)", getPlayerName(target):gsub("#%x%x%x%x%x%x",""), getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), "licencja lotnicza")
    end
end)


[ Dodano: 2018-08-30, 19:16 ]
@Gravor, tak wszystko pod??czone. Bawi?em si? z ogrpg-core bo przecho nie dzia?a?o, a po wgraniu innego po prostu nie dzia?a, nie wiem co si? sta?o.

[ Dodano: 2018-08-30, 19:17 ]
modu? tak?e wgrany.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-30, 19:19


Norbert1234

Nie umiem w LUA






Wiek: 22
Na forum: 4129 dni
Posty: 319
Nick w MP: Gusterowskyy

Piwa: 244

Respekt: 60

To daj tylko linijke gdzie s? te s?owa klucz, kt?re odpowiadaj? za prawko, np.

 outputChatBox("x", source, 0, 187, 84, true ) 
end
else 
outputChatBox("x", source, 0, 187, 87, true ) return end
end

[b] addCommandHandler("co?", ox)[/b]  


albo mo?e by? pod tym
addCommandHandler("cos", ox)

 outputChatBox("x", source, 0, 187, 84, true ) 
end
else 
outputChatBox("x!", source, 0, 187, 87, true ) return end
end


Rozumiesz?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-30, 19:20


Yank3S







Wiek: 21
Na forum: 2978 dni
Posty: 21
Nick w MP: Yank3S

Piwa: 24

Respekt: 60

da?em ;)

[ Dodano: 2018-08-30, 19:20 ]
Zabieranie prawka:

addCommandHandler("zpj", function(plr,cmd,cel,time,type,...)
    if getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1) or getAdmin(plr,4) then
        local reason=table.concat({...}, " ")
        if not cel or not tonumber(time) or not type or not reason then
            outputChatBox("* U?ycie: /zpj <nick/ID> <czas> <jednostka: m/h/y/w> <pow?d>", plr)
            return
        end
        local target=exports["ogrpg-core"]:findPlayer(plr,cel)
        if not target then
            outputChatBox("* Nie znaleziono podanego gracza.", plr, 255, 0, 0)
            return
        end
        if isPedInVehicle(target) then
            removePedFromVehicle(target)
        end
        --if getElementData(target,"player:uid") == 1 then outputChatBox("* Nie mo?na zabra? prawo jazdy graczowi o uid: 1 !",plr) return end
        result=pobierzDate(type,time)
        triggerClientEvent(root, "admin:rendering", root, "* ["..getElementData(target,"id").."]"..getPlayerName(target):gsub("#%x%x%x%x%x%x","").." otrzyma?(a) zakaz prowadzenia pojazd?w kat(ABC) od ["..getElementData(plr,"id").."]"..getPlayerName(plr):gsub("#%x%x%x%x%x%x","")..": "..reason.."("..time .. type ..")")
        exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_punish (serial,reason,time,type) VALUES (?,?,?,?)", getPlayerSerial(target), reason, result, "A")
        exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_punish (serial,reason,time,type) VALUES (?,?,?,?)", getPlayerSerial(target), reason, result, "B")
        exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_punish (serial,reason,time,type) VALUES (?,?,?,?)", getPlayerSerial(target), reason, result, "C")
        outputChatBox(" ", target, 255, 0, 0)
        outputChatBox(" ", target, 255, 0, 0)
        outputChatBox("Otrzyma?e?(a?) zakaz prowadzenia pojazd?w od "..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").."", target, 255, 0, 0)
        outputChatBox(" ", target, 255, 0, 0)
        outputChatBox("Pow?d: "..reason:gsub("#%x%x%x%x%x%x","").."", target, 255, 255, 255)
        outputChatBox(" ", target, 255, 0, 0)
        outputChatBox("Czas: "..time .. type .."", target, 255, 255, 255)
        outputChatBox(" ", target, 255, 0, 0)
        outputChatBox(" ", target, 255, 0, 0)
    end
end)

addCommandHandler("zpl", function(plr,cmd,cel,time,rodzaj,...)
    if getAdmin(plr,4) or getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1) then
        local reason=table.concat({...}, " ")
        if not cel or not tonumber(time) or not rodzaj or not reason then
            outputChatBox("* U?ycie: /zpl <nick/ID> <czas> <jednostka: m/h/d/w> <pow?d>", plr)
            return
        end
        local target=exports["ogrpg-core"]:findPlayer(plr,cel)
        if not target then
            outputChatBox("* Nie znaleziono podanego gracza.", plr, 255, 0, 0)
            return
        end
        local query=string.format("SELECT * FROM ogrpg_punish WHERE type=%q AND active=1 AND serial=%q AND time>NOW() LIMIT 1","L", getPlayerSerial(target))
        local result=exports["DB2"]:pobierzWyniki(query)
        if (result) then
            return outputChatBox("* Gracz Posiada zawieszone prawo jazdy do "..result["time"]..", za: "..result["reason"], plr, 255, 0, 0)
        else
            exports["ogrpg-db"]:dbSet("DELETE FROM ogrpg_punish WHERE type=? AND active=1 AND serial=?", "L", getPlayerSerial(plr))
        end
        if isPedInVehicle(target) then
            removePedFromVehicle(target)
        end
        if tonumber(time) <= 0 then return end
        local result = "DATE()"
        if rodzaj == "m" then
        result = string.format('DATE_ADD(NOW(), INTERVAL %d MINUTE)',time)
        elseif rodzaj == "h" then
        result = string.format('DATE_ADD(NOW(), INTERVAL %d HOUR)',time)
        elseif rodzaj == "d" then
        result = string.format('DATE_ADD(NOW(), INTERVAL %d DAY)',time)
        elseif rodzaj == "w" then
        result = string.format('DATE_ADD(NOW(), INTERVAL %d WEEK)',time)
        end
        reason = reason.." |od "..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").."|"
        triggerClientEvent(root, "admin:rendering", root, "* ["..getElementData(target,"id").."]"..getPlayerName(target):gsub("#%x%x%x%x%x%x","").." otrzyma?(a) zakaz prowadzenia maszyn Lotniczych (L) "..reason.."("..time .. rodzaj ..")")
        local query = string.format("INSERT INTO ogrpg_punish (serial,reason,time,type) VALUES ('%s','%s',%s,'%s')", getPlayerSerial(target), reason, result, "L")
        exports["ogrpg-db"]:dbSet(query)
    end
end)

addCommandHandler("opl", function(plr,cmd,cel)
    if getAdmin(plr,4) or getAdmin(plr,3) or getAdmin(plr,2) or getAdmin(plr,1) then
        if not cel then
            outputChatBox("* U?ycie: /opl <nick/ID> ", plr)
            return
        end
        local target=exports["ogrpg-core"]:findPlayer(plr,cel)
        if not target then
            outputChatBox("* Nie znaleziono podanego gracza.", plr, 255, 0, 0)
            return
        end
        local query=string.format("SELECT * FROM ogrpg_punish WHERE type=%q AND active=1 AND serial=%q AND time>NOW() LIMIT 1","L", getPlayerSerial(target))
        local result=exports["DB2"]:pobierzWyniki(query)
        if (result) then
            exports["ogrpg-db"]:dbSet("DELETE FROM ogrpg_punish WHERE type=? AND active=1 AND serial=?", "L", getPlayerSerial(target))
            outputChatBox("* Gracz "..getPlayerName(target):gsub("#%x%x%x%x%x%x","").." odzyskal swoja Licencje!", plr, 0, 255, 0)
            outputChatBox("* "..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").." oddal Twoja Licencje!", target, 0, 255, 0)
        else
            outputChatBox("* Gracz "..getPlayerName(target):gsub("#%x%x%x%x%x%x","").." nie posiada zabranej Licencji!", plr, 0, 255, 0)
        end
        exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_prawka_logs (komu_oddali,kto_oddal,typ) VALUES (?,?,?)", getPlayerName(target):gsub("#%x%x%x%x%x%x",""), getPlayerName(plr):gsub("#%x%x%x%x%x%x",""), "licencja lotnicza")
    end
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-30, 19:21


Norbert1234

Nie umiem w LUA






Wiek: 22
Na forum: 4129 dni
Posty: 319
Nick w MP: Gusterowskyy

Piwa: 244

Respekt: 60

Yank3S, Ja nic nie widz?, na pewno wszystko dobrze jest? doda?e? do ACL? i modu?y i baza itp?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-30, 19:22


Yank3S







Wiek: 21
Na forum: 2978 dni
Posty: 21
Nick w MP: Yank3S

Piwa: 24

Respekt: 60

tak wszystko jest.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-30, 19:25


Kalizman







Wiek: 24
Na forum: 3793 dni
Posty: 1394

Piwa: 4624

Respekt: 358,8
Respekt: 358,8Respekt: 358,8Respekt: 358,8Respekt: 358,8

dodaj tak? instrukcj? warunkow?, zobaczymy czy zmienia dane w mysql
        exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_punish (serial,reason,time,type) VALUES (?,?,?,?)", getPlayerSerial(target), reason, result, "A")
        exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_punish (serial,reason,time,type) VALUES (?,?,?,?)", getPlayerSerial(target), reason, result, "B")
        exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_punish (serial,reason,time,type) VALUES (?,?,?,?)", getPlayerSerial(target), reason, result, "C")
na
local pjA = exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_punish (serial,reason,time,type) VALUES (?,?,?,?)", getPlayerSerial(target), reason, result, "A")
local pjB = exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_punish (serial,reason,time,type) VALUES (?,?,?,?)", getPlayerSerial(target), reason, result, "B")
local pjC = exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_punish (serial,reason,time,type) VALUES (?,?,?,?)", getPlayerSerial(target), reason, result, "C")
if pjA and pjB and pjC then
    outputDebugString("dodano do mysql")
else
    outputDebugString("NIE dodano do mysql")
end

Powinno wy?wietli? informacj? w DB3 gdy zabra?e? prawko o tym, czy dodano do mysql

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-30, 19:28


Yank3S







Wiek: 21
Na forum: 2978 dni
Posty: 21
Nick w MP: Yank3S

Piwa: 24

Respekt: 60

to wyswietlilo mi,
[18-08-30 19:26:58] WARNING: [Podlaczenie MySql]/ogrpg-db/s_db.lua:25: dbPoll failed; Table 'db_36367.saj' doesn't exist
[18-08-30 19:26] WARNING: [Podlaczenie MySql]/ogrpg-db/s_db.lua:25: dbPoll failed; Table 'db_36367.saj' doesn't exist
[18-08-30 19:26:48] WARNING: [Podlaczenie MySql]/ogrpg-db/s_db.lua:25: dbPoll failed; Table 'db_36367.saj' doesn't exist
[18-08-30 19:26] WARNING: [Podlaczenie MySql]/ogrpg-db/s_db.lua:25: dbPoll failed; Table 'db_36367.saj' doesn't exist
[18-08-30 19:26:38] WARNING: [Podlaczenie MySql]/ogrpg-db/s_db.lua:25: dbPoll failed; Table 'db_36367.saj' doesn't exist
[18-08-30 19:26] WARNING: [Podlaczenie MySql]/ogrpg-db/s_db.lua:25: dbPoll failed; Table 'db_36367.saj' doesn't exist
[18-08-30 19:26:28] WARNING: [Podlaczenie MySql]/ogrpg-db/s_db.lua:25: dbPoll failed; Table 'db_36367.saj' doesn't exist
[18-08-30 19:26] WARNING: [Podlaczenie MySql]/ogrpg-db/s_db.lua:25: dbPoll failed; Table 'db_36367.saj' doesn't exist
[18-08-30 19:26:18] WARNING: [Podlaczenie MySql]/ogrpg-db/s_db.lua:25: dbPoll failed; Table 'db_36367.saj' doesn't exist
[18-08-30 19:26] WARNING: [Podlaczenie MySql]/ogrpg-db/s_db.lua:25: dbPoll failed; Table 'db_36367.saj' doesn't exist
[18-08-30 19:26:10] INFO: Zaladowano zmienionych domow: 0
[18-08-30 19:26:08] WARNING: [Podlaczenie MySql]/ogrpg-db/s_db.lua:25: dbPoll failed; Table 'db_36367.saj' doesn't exist
[18-08-30 19:26] WARNING: [Podlaczenie MySql]/ogrpg-db/s_db.lua:25: dbPoll failed; Table 'db_36367.saj' doesn't exist
[18-08-30 19:25:57] WARNING: [Podlaczenie MySql]/ogrpg-db/s_db.lua:25: dbPoll failed; Table 'db_36367.saj' doesn't exist
[18-08-30 19:25] WARNING: [Podlaczenie MySql]/ogrpg-db/s_db.lua:25: dbPoll failed; Table 'db_36367.saj' doesn't exist
[18-08-30 19:25:47] WARNING: [Podlaczenie MySql]/ogrpg-db/s_db.lua:25: dbPoll failed; Table 'db_36367.saj' doesn't exist
[18-08-30 19:25] WARNING: [Podlaczenie MySql]/ogrpg-db/s_db.lua:25: dbPoll failed; Table 'db_36367.saj' doesn't exist
[18-08-30 19:25:37] WARNING: [Podlaczenie MySql]/ogrpg-db/s_db.lua:25: dbPoll failed; Table 'db_36367.saj' doesn't exist
[18-08-30 19:25] WARNING: [Podlaczenie MySql]/ogrpg-db/s_db.lua:25: dbPoll failed; Table 'db_36367.saj' doesn't exist
[18-08-30 19:25:27] WARNING: [Podlaczenie MySql]/ogrpg-db/s_db.lua:25: dbPoll failed; Table 'db_36367.saj' doesn't exist
[18-08-30 19:25] WARNING: [Podlaczenie MySql]/ogrpg-db/s_db.lua:25: dbPoll failed; Table 'db_36367.saj' doesn't exist
[18-08-30 19:25:20] INFO: Zaladowano zmienionych domow: 0
[18-08-30 19:25:17] WARNING: [Podlaczenie MySql]/ogrpg-db/s_db.lua:25: dbPoll failed; Table 'db_36367.saj' doesn't exist
[18-08-30 19:25] WARNING: [Podlaczenie MySql]/ogrpg-db/s_db.lua:25: dbPoll failed; Table 'db_36367.saj' doesn't exist
[18-08-30 19:25:07] WARNING: [Podlaczenie MySql]/ogrpg-db/s_db.lua:25: dbPoll failed; Table 'db_36367.saj' doesn't exist
[18-08-30 19:25] WARNING: [Podlaczenie MySql]/ogrpg-db/s_db.lua:25: dbPoll failed; Table 'db_36367.saj' doesn't exist
[18-08-30 19:24:57] WARNING: [Podlaczenie MySql]/ogrpg-db/s_db.lua:25: dbPoll failed; Table 'db_36367.saj' doesn't exist
[18-08-30 19:24] WARNING: [Podlaczenie MySql]/ogrpg-db/s_db.lua:25: dbPoll failed; Table 'db_36367.saj' doesn't exist
[18-08-30 19:24:47] WARNING: [Podlaczenie MySql]/ogrpg-db/s_db.lua:25: dbPoll failed; Table 'db_36367.saj' doesn't exist
[18-08-30 19:24] WARNING: [Podlaczenie MySql]/ogrpg-db/s_db.lua:25: dbPoll failed; Table 'db_36367.saj' doesn't exist
[18-08-30 19:24:37] WARNING: [Podlaczenie MySql]/ogrpg-db/s_db.lua:25: dbPoll failed; Table 'db_36367.saj' doesn't exist
[18-08-30 19:24] WARNING: [Podlaczenie MySql]/ogrpg-db/s_db.lua:25: dbPoll failed; Table 'db_36367.saj' doesn't exist
[18-08-30 19:24:30] INFO: Zaladowano zmienionych domow: 0


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-30, 19:31


Norbert1234

Nie umiem w LUA






Wiek: 22
Na forum: 4129 dni
Posty: 319
Nick w MP: Gusterowskyy

Piwa: 244

Respekt: 60

co to jest ? xd

a we? poka? skrypt db
ale na pocz?tku mo?e zmie? tak db_36367.saj na db_36367
Zobaczymy :)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-30, 19:32


Yank3S







Wiek: 21
Na forum: 2978 dni
Posty: 21
Nick w MP: Yank3S

Piwa: 24

Respekt: 60

w jakim sensie zmieni??

Postaw piwo autorowi tego posta
 

 
Tagi: zpj :: zpl :: nie :: działa
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