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

Wysłany: 2020-04-18, 22:58


Januszek1337







Wiek: 31
Na forum: 2875 dni
Posty: 4



Respekt: 50

witam.
Posiadam problem z przechowalni? na paczce my world 0.3. Mianowicie po zakupie auta nie wy?wietla si? ono w odbioru pojazdu, jak to naprawi?? Mia? kto? ten problem? Odwdzi?czam si? :piwo:
Screen z gierki po zakupie auta: https://imgur.com/a/eyA0QmD

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-04-19, 00:41


Maniekxx

Amator






Wiek: 24
Na forum: 2894 dni
Posty: 232
Nick w MP: Maniekxx

Piwa: 225

Respekt: 110
Respekt: 110

Ostrzeżeń: 20%
Najpierw sprawd? czy pojazd tworzy si? w bazie danych, i czy w tabeli 'Parking' warto?? to 1, je?li nie, to przy zakupie pojazdu sprawd? czy nie masz b??d?w w /debugscript 3.

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
Januszek1337
Wysłany: 2020-04-19, 21:36


Januszek1337







Wiek: 31
Na forum: 2875 dni
Posty: 4



Respekt: 50

pojazd nie tworzy sie w bazie danych.
blad w debugscripcie:
ERROR: client (kamash) triggered serverside event dodajLogi, but event is not added serverside.
ERROR: client (kamash) triggered serverside event dodajLogi, but event is not added serverside. [DUP x6]

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-04-19, 22:09


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Nie ma eventu "dodajLogi" po stronie serwera. Musisz go doda?.


Więcej informacji znajdziesz w Wikipedii MTA:

addEvent


Więcej informacji znajdziesz w Wikipedii MTA:

addEventHandler


Ostatnio zmieniony przez Wilq 2020-04-20, 08:16, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-04-19, 23:31


Januszek1337







Wiek: 31
Na forum: 2875 dni
Posty: 4



Respekt: 50

Wilq, mo?esz mnie doda? na discordzie rybarcxyk#0272 i mi pomo?esz?

Komentarz Wilq dodany 2020-04-20, 08:16Staramy się pomagać na forum
Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-04-20, 00:34


Maniekxx

Amator






Wiek: 24
Na forum: 2894 dni
Posty: 232
Nick w MP: Maniekxx

Piwa: 225

Respekt: 110
Respekt: 110

Ostrzeżeń: 20%
Wklej tu kod odpowiedzialny za kupno pojazdu, stron? serwera oraz clietna. U?yj do tego znacznik?w [lua] Tu wklej kod [./lua] - Bez kropki.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-04-25, 19:00


Januszek1337







Wiek: 31
Na forum: 2875 dni
Posty: 4



Respekt: 50

"Maniekxx" napisał/a:

Wklej tu kod odpowiedzialny za kupno pojazdu, stron? serwera oraz clietna. U?yj do tego znacznik?w [lua] Tu wklej kod [./lua] - Bez kropki.


 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 /////////////////////////////////

addEvent "dodajLogi"true )
addEventHandler "dodajLogi"getRootElement(), specialEventHandler )
        imports["ogrpg-db"]:dbSet"UPDATE ogrpg_vehicles `id`, `model`, `frozen`, `pos`, `text`, `health`, `fuel`, `mileage`, `driver`, `color`, `headlights`, `paintjob`, `tuning`, `panelstates`, `rent`, `plateText`, `ownedGroup`, `ownedPlayer`, `parking`, `police`, `neon`, `blokada`, `registered`, `mk1`, `mk2`, `masked`, `createdate`, `firstowner`, `removehood`, `rh`, `tp_to_parking`, `naped`" )
        

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 onRespawnVehicles(_,id,poss)
    -- Settings (QUERY)
    if id then
        result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_vehicles WHERE parking=1 and not(police=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 and not(police=1)")
    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("NW  "..vehicle["id"]))
        end
        setElementFrozen(veh, (vehicle["frozen"]) > 0)
        if vehicle["paintjob"] ~= 3 then
        setVehiclePaintjob(vehvehicle["paintjob"])
        end
        setElementHealth(vehvehicle["health"])
        setElementData(veh,"vehicle:spawn",true)
        setElementData(veh,"vehicle:id"vehicle["id"])
        setElementData(veh,"vehicle:fuel"vehicle["fuel"])
        setElementData(veh,"vehicle:desc"vehicle["text"] or false)
                setElementData(veh,"vehicle:mileage"vehicle["mileage"])
                   setElementData(veh,"vehicle:bak"vehicle["bak"])
                    setElementData(veh,"vehicle:baklpg"vehicle["baklpg"])
        setElementData(veh,"vehicle:driver"vehicle["driver"])
        setElementData(veh,"vehicle:ownedGroup"vehicle["ownedGroup"])
        setElementData(veh,"vehicle:ownedPlayer"vehicle["ownedPlayer"])

        setElementData(veh,"vehicle:LPG"vehicle["gaz"])
        setElementData(veh,"Zamontowane:LPG"vehicle["GazZamont"])
                setElementData(veh,"Zamontowane:baklpg"vehicle["BakLPGzamont"])
        setElementData(veh,"licznik:kolor"vehicle["licznik"])
        setElementData(veh,"Zawieszenie:Pneumatyczne"vehicle["zawieszenie"])
        setElementData(veh,"Pojemnosc:silnika"vehicle["silnik"])
            local Pojemnosc getElementData(veh,"Pojemnosc:silnika") or "Zwykly"
            if Pojemnosc == '2.0dm3' then -- pojemnosc silnika 2.0
               setVehicleHandling(veh"engineAcceleration"12.0)
            elseif Pojemnosc == '2.5dm3' then -- pojemnosc silnika 2.5
               setVehicleHandling(veh"engineAcceleration"14)

                        elseif Pojemnosc == '3.0dm3' then -- pojemnosc silnika 3.5
                           setVehicleHandling(veh"engineAcceleration",17)
                           setVehicleHandling(veh"driveType""awd")
                           setVehicleHandling(veh"maxVelocity"205.0)
            end
              
        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 vehicle["rearlights"] ~= "" then
        setElementData(veh,"vehicle:light"vehicle["rearlights"])
        else
        setElementData(veh,"vehicle:light""High Quality")
        end]]--
        setElementData(veh,"neony"vehicle["neon"])
        if vehicle["blokada"] == "true" then
            setElementData(veh,"vehicle:block"true)
            setVehicleWheelStates(veh2222)
        else
            setElementData(veh,"vehicle:block"false)
        end
        local rodzajneonu=tonumber(getElementData(veh,"neony"))
        if getElementData(veh,"neony") ~= 0 then
        local m getElementModel(veh)
        local of
        if not nlOffsets[mthen
        of={-1,0,-0.5}
        else
        of=nlOffsets[m]
        end
        neon1=createObject(nlIDX[rodzajneonu],0,0,0)
        neon2=createObject(nlIDX[rodzajneonu],0,0,0)
        setElementData(veh,"zneony", {neon1neon2})
        attachElements(neon1,veh,of[1],of[2],of[3])
        attachElements(neon2,veh,-of[1],of[2],of[3])
        end

        for i,v in ipairs(split(vehicle["tuning"], ",")) do addVehicleUpgrade(vehvend
        for i,v in ipairs(split(vehicle["panelstates"], ",")) do setVehiclePanelState(vehitonumber(v)) end
        setVehicleDamageProof(vehtrue)
                setElementData(veh"vehicle:BezynaWloczone"true)
                setElementFrozen(veh,true)
    end
    outputDebugString("[og-vehicles] Wczytano "..vehicles.." pojazdow.")
end
--///////////////////////////////////// ZAPISYWANIE POJAZD?W /////////////////////////////////
function onSaveVehicle(vehicle)
    if getElementData(vehicle,"vehicle:spawn"then
        -- Setting
        local panelstates={}
        local model=getElementModel(vehicle)
        local health=getElementHealth(vehicle)
        local x,y,z=getElementPosition(vehicle)
        local rx,ry,rz=getElementRotation(vehicle)
        local desc=getElementData(vehicle,"vehicle:desc") or ""
        local id=getElementData(vehicle,"vehicle:id")
        local fuel=getElementData(vehicle,"vehicle:fuel")
        local mileage=getElementData(vehicle,"vehicle:mileage")
                local bak=getElementData(vehicle,"vehicle:bak") 
                            local baklpg=getElementData(vehicle,"vehicle:baklpg")
        local c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12=getVehicleColor(vehicletrue)
        local driver=getElementData(vehicle,"vehicle:driver") or ""
                local gaz=getElementData(vehicle,"vehicle:LPG")
        local silnik=getElementData(vehicle,"Pojemnosc:silnika") or "Zwykly"
        local licznik=getElementData(vehicle,"licznik:kolor") or "Zwykly"
        local GazZamont=getElementData(vehicle,"Zamontowane:LPG") or "Brak"
        local BakLPGzamont=getElementData(vehicle,"Zamontowane:baklpg") or "Brak"
        local zawieszenie=getElementData(vehicle,"Zawieszenie:Pneumatyczne") or "Brak"
        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 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["ogrpg-db"]:dbSet(string.format("UPDATE ogrpg_vehicles SET model='%d', pos='%.2f,%.2f,%.2f,%.2f,%.2f,%.2f', rent='%d',text='%s', masked='%d', health='%d', fuel='%d', mileage='%d',bak='%d',baklpg='%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',silnik='%s', gaz='%d', GazZamont='%s',BakLPGzamont='%s', zawieszenie='%s', blokada='%s' WHERE id=%d",
        modelx,y,zrx,ry,rz"0",descmask,healthfuelmileage,bakbaklpgfrozendriverc1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12panelstatespaintjobupgradesh1,h2,h3playerneon,silnikgazGazZamont,BakLPGzamontzawieszenietostring(blokada), id))
        if (type(rent) == "table"then
        local rr string.format("%s"table.concat(rent',') )
    --    outputDebugString(rr)
        local query2exports['ogrpg-db']:dbSet("UPDATE ogrpg_vehicles SET rent=? WHERE id=?",rr,id)
        end
    end
end

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

--///////////////////////////////////// SPRAWDZANIE USTAWIE? /////////////////////////////////
function getSettings(plr,code,value)
    local 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=?"codeuid)
        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 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 
    if isElement(sourcethen
       onSaveVehicle(source)
       setVehicleEngineState(sourcefalse)
    setVehicleDamageProof(sourcetrue)
    end
    unbindKey(plr'h''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("[og-vehicles] Saved all vehicles!")
end)

addEventHandler("onVehicleEnter"root, function(plr,seat)
    if seat ~= 0 then return end
    setVehicleEngineState(sourcefalse)
    setElementData(source,"vehicle:driver",getPlayerName(plr))
    if getElementData(source,"neony") and getElementData(source,"neony") ~= 0 then
        triggerClientEvent(plr,"addNotification",root,"* Posiadasz neony w pojezdzie, mo?esz wl?czy? i wylaczyc je za pomoc? przycisku H.","info")
        bindKey(plr'h''down'bindHoron4plr)
    end
end)

addEventHandler("onVehicleEnter"root, function(plr,seat)
    if seat ~= 0 then return end 
            local Pojemnosc getElementData(source,"Pojemnosc:silnika") or "Zwykly"
            if Pojemnosc == '2.0dm3' then -- pojemnosc silnika 2.0
               setVehicleHandling(veh"engineAcceleration"12.0)
            elseif Pojemnosc == '2.5dm3' then -- pojemnosc silnika 2.5
               setVehicleHandling(veh"engineAcceleration"14)

                        elseif Pojemnosc == '3.0dm3' then -- pojemnosc silnika 3.5
                           setVehicleHandling(veh"engineAcceleration",17)
                           setVehicleHandling(veh"driveType""awd")
                           setVehicleHandling(veh"maxVelocity"205.0)
            end
end)

addEventHandler("onVehicleEnter"root, function(plr,seat)
    if seat ~= 0 then return end 
        local zawiesze getElementData(source,"Zawieszenie:Pneumatyczne")
                   if zawiesze == 'Tak' then
                        outputChatBox("* Posiadasz zawieszenie pneumatyczne, mo?esz je regulowa? komend? /zawieszenie 1-5"plr255,255,255)
     return
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(plr3) or getAdmin2(plr4then
            return
        end
        if rent and (type(rent) == "table"then
            for i,s in pairs(rent) do
                if tonumber(s) == getElementData(plr,"player:uid"then
                return end
            end
        end
        
        local plrgroup getElementData(plr,"player:organization")
        if plrgroup then
        --    outputDebugString(group)
            if getSettings(plr,false,"organization") == group then return end
        end
        if player and player ~= getSettings(plr,false,"owner"then
            triggerClientEvent(plr,"addNotification",root,"* Nie masz kluczyk?w do tego pojazdu.","error")
            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)

addEvent("neonfix",true)
addEventHandler("neonfix",resourceRoot,function(vehicle,distance)
if not vehicle then return end
if not distance then return end
montujneony(vehicle,distance)
end)

function hasNeon(vehicle)
    if not vehicle then return end
    if getElementData(vehicle"zneony"then
        return true
    else
        return false
    end
end


function montujneony(vehicle,distance)
if not vehicle then return end
if not distance then return end
local rodzajneonu=tonumber(getElementData(veh,"neony"))
if not rodzajneonu then return end
if rodzajneonu==0 then 
outputChatBox('* Brak Neonow.'plr255,0)
return end
--if not nlIDX[rodzajneonuthen return end
if hasNeon(vehiclethen return false end
local zDis distance
local xygetElementPosition(vehicle)
local rxryrz getElementRotation(vehicle)    
local vHandling getVehicleHandling(vehicle)
local rDis vHandling["suspensionLowerLimit"]
local neon1 createObject(nlIDX[rodzajneonu], xyz)
setElementRotation(neon1rxryrz)
local neon2 createObject(nlIDX[rodzajneonu], xyz)
setElementRotation(neon2rxryrz)
attachElements(neon1vehicle0.80, -(zDis+rDis))
attachElements(neon2vehicle, -0.80, -(zDis+rDis))
setElementData(veh,"zneony", {neon1neon2})
triggerClientEvent(plr,"addNotification",root,'* W??czy?e? Neony. Pojawi? si? one jak poruszysz pojazdem!',"info")
end

function bindHoron4(plr)
        veh=getPedOccupiedVehicle(plr)
        if not veh then return end
        local rodzajneonu=tonumber(getElementData(veh,"neony"))
        if not rodzajneonu then return end
        if rodzajneonu==0 then 
        outputChatBox('* Brak Neonow.'plr255,0)
        return end
        local zneony=getElementData(veh,"zneony")
        if (zneony and type(zneony)=="table"then
        destroyElement(zneony[1])
        destroyElement(zneony[2])
        removeElementData(veh,"zneony")
        triggerClientEvent(plr,"addNotification",root,'* Wy??czy?e? Neony.',"warning")
        else
        triggerClientEvent(plr,"neonfix",resourceRoot)
        end
end

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


addEventHandler("onResourceStart"resourceRoot, function() onRespawnVehicles(_,falseend)


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



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

local function vr()

    local pojazdy=getElementsByType("vehicle")

    if (#pojazdy<1) then return end

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

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

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


local pozwolone ={ 
[471] = true, -- quad
[453] = true, -- kutry
[509] = true, -- bike
[481] = true, -- bmx
[510] = true, -- MountainBike
}
--//////////////////////////////////////////////////////// Licencje
local categoryA={[463] = true,[461] = true,[581] = true,[448] = true,[468] = true,[521] = true,[522] = true,[523] = truelocal categoryB={[602] = true,[545] = true,[496] = true,[517] = true,[401] = true,[410] = true,[518] = true,[600] = true,[527] = true,[436] = true,[589] = true,[580] = true,[419] = true,[439] = true,[533] = true,[549] = true,[526] = true,[491] = true,[474] = true,[445] = true,[467] = true,[604] = true,[426] = true,[507] = true,[547] = true,[585] = true,[405] = true,[587] = true,[409] = true,[466] = true,[550] = true,[492] = true,[566] = true,[546] = true,[540] = true,[551] = true,[421] = true,[516] = true,[529] = true,[488] = true,[460] = true,
[469] = true,[487] = true,[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 pozwolone[getElementModel(source)] then return end
        if categoryA[getElementModel(source)] then
           if exports["new_world-prace-settings"]:getVehicleLicense(plr,"A"then
            cancelEvent()
            end
        elseif categoryB[getElementModel(source)] then
            if exports["new_world-prace-settings"]:getVehicleLicense(plr,"B"then
            cancelEvent()
            end
        elseif categoryC[getElementModel(source)] then
            if exports["new_world-prace-settings"]:getVehicleLicense(plr,"C"then
            cancelEvent()
            end
        end
    end
end)


--[[

local categoryL={592,553,577,488,511,497,548,563,512,476,593,447,425,519,520,460,417,469,487,513}

addEventHandler("onVehicleStartEnter"root, function(plr,seat,jacked)
    if seat ~= 0 then return end
    local resultA=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_punish WHERE type=? AND active=1 AND serial=? AND time>NOW() LIMIT 1","A"getPlayerSerial(plr))
    if (resultA and #resultA > 0) then
        if pozwolone[getElementModel(source)] then
        outputChatBox("* Posiadasz zawieszone prawo jazdy do "..resultA["time"]..", za: "..resultA["reason"], plr25500)
        outputChatBox("* Wsiadles do pojazdu nie potrzebujacego licencji!"plr25500)
        return end
        cancelEvent()
        outputChatBox("* Posiadasz zawieszone prawo jazdy do "..resultA["time"]..", za: "..resultA["reason"], plr25500)
    else
        exports["ogrpg-db"]:dbSet("DELETE FROM ogrpg_punish WHERE type=? AND active=1 AND serial=?""A"getPlayerSerial(plr))
    end
end)

addEventHandler("onVehicleEnter"root, function(plr,seat,jacked)
    if seat ~= 0 then return end
    local resultA=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_punish WHERE type=? AND active=1 AND serial=? AND time>NOW() LIMIT 1","A"getPlayerSerial(plr))
    if (resultA and #resultA > 0) then
            if pozwolone[getElementModel(source)] then
        outputChatBox("* Posiadasz zawieszone prawo jazdy do "..resultA["time"]..", za: "..resultA["reason"], plr25500)
        outputChatBox("* Wsiadles do pojazdu nie potrzebujacego licencji!"plr25500)
        return end
            setControlState plr"enter_exit"true )
            setTimer(toggleControl30001,  plr,"enter_exit"true)
            outputChatBox("* Posiadasz zawieszone prawo jazdy do "..resultA["time"]..", za: "..resultA["reason"], plr25500)
        else
            exports["ogrpg-db"]:dbSet("DELETE FROM ogrpg_punish WHERE type=? AND active=1 AND serial=?""A"getPlayerSerial(plr))
        end
end)

]]


local strefa = { }
local strefy = {
    {1336.23840656.788769.8562460.50634765625146.8001098632816.164074325562 },
    {924.076901661.905769.25354194.91711425781138.3175048828123.899999046326},
    {2197.997802405.43872, -31.81085178.1982421875112.389648437557.499998474121},
}
 
local ogranicznik createElement ("ogranicznik");
for i,v in ipairs strefy  ) do
     strefa[i] = createColCuboid ], ], ], ], ], ], [7] )
     setElementParent (strefa [i], ogranicznik);
end
 
addEventHandler("onColShapeHit"ogranicznik, function(el,md)
    if getElementType(el)=="vehicle" then
            setElementData(el,"vehicle:tempspeed"50)
    end
end)
addEventHandler("onColShapeLeave"ogranicznik, function(el,md)
    if getElementType(el)=="vehicle" then
        removeElementData(el,"vehicle:tempspeed")
    end
end)




addEventHandler("onVehicleEnter"root, function(plr,seat,jacked)
if source then 
if source and getElementData(source,"vehicle:masked"then
setElementData(plr,"player:old:nick",getPlayerName(plr))
local x string.format("#040707%s",getPlayerName(plr):gsub("#%x%x%x%x%x%x",""))
setPlayerName(plr,x)
end
end
end)
addEventHandler("onVehicleExit"root, function(plr,seat,jacked)
if source then 
if source and getElementData(source,"vehicle:masked"then
local name getElementData(plr,"player:old:nick")
setPlayerName(plr,name)
end
end
end)
addEventHandler("onElementDestroy"root, function()
if getElementType(source) ~= "vehicle" then return end
if getElementData(source,"vehicle:masked"then
for i,p in pairs(getVehicleOccupants(source)) do
local name getElementData(p,"player:old:nick")
setPlayerName(p,name)
end
end
end)


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)

local pozwolone ={
[453] = true, -- kutry
[509] = true, -- rower
}
-- 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
    if pozwolone[getElementModel(source)] then return end
    if getElementData(source,"multiseat"then return end
    local query=string.format("SELECT * FROM ogrpg_punish WHERE typ=%q AND active=1 AND serial=%q AND time>NOW() LIMIT 1","prawko"getPlayerSerial(plr))
    local result=exports["ogrpg-db"]:pobierzWyniki(query)
    if (resultthen
        outputChatBox(" Posiadasz zawieszone prawo jazdy do "..result["time"]..", za: "..result["reason"], plr25500)
        cancelEvent()
    else
        exports["ogrpg-db"]:dbSet("DELETE FROM ogrpg_punish WHERE typ=? AND active=1 AND serial=?""prawko"getPlayerSerial(plr))
    end
end,true,"low-1")

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

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




Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-04-26, 16:49


Maniekxx

Amator






Wiek: 24
Na forum: 2894 dni
Posty: 232
Nick w MP: Maniekxx

Piwa: 225

Respekt: 110
Respekt: 110

Ostrzeżeń: 20%
Kod odpowiedzialny za kupno pojazd?w, czyli tam gdzie kupujesz dane auto, np salon albo cygan.

Postaw piwo autorowi tego posta
 

 
Tagi: pr0blem :: przechowalnia :: world :: 0.3
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Odpowiedz do tematu

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