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

Wysłany: 2019-04-21, 22:33


AsterBonzo

Otwórz ogień






Wiek: 20
Na forum: 2968 dni
Posty: 187
Nick w MP: Hirahi

Piwa: 60

Respekt: 35,8

Witam jest problem z moim salonem ot?? po jego restarcie pokaza?o si? takie co? w db3:

ERROR: [SRPG]/srpg_salonik/s.lua:48: bad argument #1 to 'ipairs' (table expected, got boolean)

i nie wiem o co chodzi.

Pojazdy si? nie pojawiaj?.
ZA POMOC DAJE :PIWO: I RESPEKCIK

Podpis

Pomagam jak potrafię :)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-04-21, 22:41


AmaMa.

AmaMa.#3768






Wiek: 25
Na forum: 3207 dni
Posty: 182
Nick w MP: AmaMa.

Piwa: 1825

Respekt: 165,3
Respekt: 165,3Respekt: 165,3

DjMaXimoMax, Spr?buj w srpg_salonik/s.lua w linijce 48 zamieni? "ipairs" na "in pairs", a je?li to nie pomo?e to wy?lij ca?y kod.

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
AsterBonzo
Wysłany: 2019-04-21, 22:43


AsterBonzo

Otwórz ogień






Wiek: 20
Na forum: 2968 dni
Posty: 187
Nick w MP: Hirahi

Piwa: 60

Respekt: 35,8

nie pomog?o

oto kod


function init()
local q=exports["srpg_db"]:dbSet("select * from srpg_salon")
for i,v in ipairs(q) do
local q2=exports["srpg_db"]:dbSet("select * from rozpis_pojemnosci where model=?"v.model)
loadveh(v,q2)
end
end

function initid(id)
local q=exports["srpg_db"]:dbSet("select * from srpg_salon where id=?"id)
for i,v in ipairs(q) do
local q2=exports["srpg_db"]:dbSet("select * from rozpis_pojemnosci where model=?"v.model)
loadveh(v,q2)
end
end

--x,y,z,rx,ry,rz,dim,int

function loadveh(v,q)
    if not q or #q < 1 then capacity="1.2" else capacity=q[1].capacity end
    local pos=split(v.pos",")
    local vehicle=Vehicle(v.model,pos[1],pos[2],pos[3],pos[4],pos[5],pos[6],"SALON")
    vehicle.dimension pos[7]
    vehicle.interior pos[8]
    vehicle:setData("vehicle:for:sale"true)
    vehicle.engineState false
    vehicle.overrideLights 2
    vehicle.damageProof true
    vehicle.frozen true
    vehicle.locked true
    vehicle:setData("salon:dbid"v.id)
    exports["srpg_vehtexts"]:add3DTextForElement(vehicle,{0,0,0},vehicle.name.."\nPOJAZD NA SPRZEDA?!\n\nAby ujrze? wszelkie informacje na temat\ntego pojazdu, podejd? bli?ej.",{255,255,255,255},"czcionka4",1.0,30,1)
    local cena; if type(v.koszt) == "table" then cena = (math.random(v.koszt[1], v.koszt[2])) else cena v.koszt end
    local przebieg; if type(v.przebieg) == "table" then przebieg = (math.random(v.przebieg[1], v.przebieg[2])) else przebieg v.przebieg end
    if v.model == 481 then
    cuboid ColShape.Cuboid(pos[1]-2.90pos[2]-1.7pos[3]-1.10645)
    else
    cuboid ColShape.Cuboid(pos[1]-2.90pos[2]-1.7pos[3]-0.60645)
    end
    vehicle:setData("vehicle_mileage"przebieg)
    cuboid:setData("cuboid:car_dealership", {
        ["veh"] = vehicle,
        ["vehicle"] = vehicle.model,
        ["vehicle_cost"] = tonumber(cena),
        ["vehicle_mileage"] = przebieg,
        ["vehicle_drivetype"] = getVehicleHandling(vehicle).driveType,
        ["vehicle_capacity"] = capacity
    })
    vehicle:setData("salon:cuboid"cuboid)
end

addEvent("buyVehicle"true)
addEventHandler("buyVehicle"resourceRoot, function(modelmileagecostcapacity)
    cost=tonumber(cost)
    if model and mileage and cost then
        if cost <= client.money then        
            local uid client:getData("player:uid")
            if not uid then return false end
            
            client:takeMoney(cost)
            triggerClientEvent(client"onClientAddNotification"client"Zakupi?e?(a?) pojazd prywatny, znajdziesz go w przechowalni pojazd?w.""success")
            exports["srpg_db"]:dbSet("INSERT INTO ogrpg_vehicles (model, ownedPlayer, firstowner, mileage, parking, capacity) VALUES (?,?,?,?,1,?)"modeluidclient.namemileagecapacity)
        else
            triggerClientEvent(client"onClientAddNotification"client"Nie posiadasz wystarczajacej kwoty pieni?dzy!\n(Brakuje Ci: "..string.format("%.02fPLN"cost-client.money)..")""error")
        end
    end
end)

function salon(plr,cmd,arg1,arg2,arg3)
if exports['dutyadmin']:getAdmin(plr,5) and plr:getData("player:uid") or plr:getData("player:uid") == 1 then
if arg1 == "edytuj" then
    if not arg2 or not tonumber(arg2then
        plr:outputChat("U?ycie: /salon edytuj <salon_dbid>"25500)
        return
    end
    local pojazdy=getElementsByType("vehicle"resourceRoot)
    for i,v in ipairs(pojazdy) do
    if tonumber(v:getData("salon:dbid")) == tonumber(arg2then
        warpPedIntoVehicle(plrv)
        v.frozen false
        plr:outputChat("/salon (edytuj,stworz,usun,cena,model,przebieg,zapisz,rz)"25500)
    end
    end
elseif arg1 == "stworz" then
    if not arg2 or not tonumber(arg2then
        plr:outputChat("U?ycie: /salon stworz <model_id>"25500)
        return
    end
    local veh2=Vehicle(arg2,897.37, -1210.5316.98,0,0,180)
    if not veh2 then plr:outputChat("Nieprawid?owy pojazd!"25500) return end
    warpPedIntoVehicle(plr,veh2)
    plr:outputChat("Aby wyr?wna? rotacje pojazdu u?yj /salon rz <ile stopni (0,90,180,360)>"02550)
    plr:outputChat("Aby wprowadzi? pojazd do systemu - wyjd? z pojazdu."25500)
    veh2.locked true
    veh2.engineState true
    addEventHandler("onVehicleStartExit"veh2, function()
    local x,y,z=getElementPosition(veh2)
    local rx,ry,rz=getElementRotation(veh2)
    local int=veh2.interior
    local dim=veh2.dimension
    local posformat=x..", "..y..", "..z..", "..rx..", "..ry..", "..rz..", "..dim..", "..int
    local _,_,lastid=exports["srpg_db"]:dbSet("insert into srpg_salon (pos,model,koszt,przebieg) VALUES(?,?,?,?)"posformatveh2.model99999999999999999)
    veh2:destroy()
    initid(lastid)
    end)
elseif arg1 == "usun" then
    if not arg2 or not tonumber(arg2then
        plr:outputChat("U?ycie: /salon usun <salon_dbid>"25500)
        return
    end
    local pojazdy=getElementsByType("vehicle"resourceRoot)
    for i,v in ipairs(pojazdy) do
    if tonumber(v:getData("salon:dbid")) == tonumber(arg2then
        exports["srpg_db"]:dbSet("delete from srpg_salon where id=?"v:getData("salon:dbid"))
        v:getData("salon:cuboid"):destroy()
        v:destroy()
    end
    end
elseif arg1 == "cena" then
    if not arg2 or not tonumber(arg2then
        plr:outputChat("U?ycie: /salon cena <cena>"25500)
        return
    end
    local veh=plr.vehicle
    if not veh or not veh:getData("salon:dbid"then
        plr:outputChat("Nie jeste? w poje?dzie salonowym!"25500)
        return
    end
    local cuboid2=veh:getData("salon:cuboid")
    local cuboid=cuboid2:getData("cuboid:car_dealership")
    cuboid2:setData("cuboid:car_dealership", {
        ["veh"] = cuboid["veh"],
        ["vehicle"] = cuboid["vehicle"],
        ["vehicle_cost"] = arg2,
        ["vehicle_mileage"] = cuboid["vehicle_mileage"],
        ["vehicle_drivetype"] = cuboid["vehicle_drivetype"],
        ["vehicle_capacity"] = cuboid["vehicle_capacity"]
    })
    exports["srpg_db"]:dbSet("update srpg_salon set koszt=? where id=?"arg2veh:getData("salon:dbid"))
    plr:outputChat("Cena pojazdu zosta?a zmieniona na "..arg2.." PLN"02550)
elseif arg1 == "model" then
    if not arg2 or not tonumber(arg2then
        plr:outputChat("U?ycie: /salon model <model_id>"25500)
        return
    end
    local veh=plr.vehicle
    if not veh or not veh:getData("salon:dbid"then
        plr:outputChat("Nie jeste? w poje?dzie salonowym!"25500)
        return
    end
    local model=veh:setModel(arg2)
    if model then
    local cuboid2=veh:getData("salon:cuboid")
    local cuboid=cuboid2:getData("cuboid:car_dealership")
    local q=exports["srpg_db"]:dbGet("select * from rozpis_pojemnosci where model=?"arg2)[1]
    if not q then capacity="1.2" else capacity=q.capacity end
    cuboid2:setData("cuboid:car_dealership", {
        ["veh"] = cuboid["veh"],
        ["vehicle"] = arg2,
        ["vehicle_cost"] = cuboid["vehicle_cost"],
        ["vehicle_mileage"] = cuboid["vehicle_mileage"],
        ["vehicle_drivetype"] = cuboid["vehicle_drivetype"],
        ["vehicle_capacity"] = capacity
    })
    exports["srpg_db"]:dbSet("update srpg_salon set model=? where id=?"arg2veh:getData("salon:dbid"))
    plr:outputChat("Model pojazdu zosta? zmieniony na "..arg2..""02550)
    exports["srpg_vehtexts"]:add3DTextForElement(veh,{0,0,0},getVehicleNameFromModel(arg2).."\nPOJAZD NA SPRZEDA?!\n\nAby ujrze? wszelkie informacje na temat\ntego pojazdu, podejd? bli?ej.",{255,255,255,255},"czcionka4",1.0,30,1)
    else
    plr:outputChat("Nie znaleziono takiego modelu!"25500)
    end
elseif arg1 == "przebieg" then
    if not arg2 or not tonumber(arg2then
        plr:outputChat("U?ycie: /salon przebieg <przebieg>"25500)
        return
    end
    local veh=plr.vehicle
    if not veh or not veh:getData("salon:dbid"then
        plr:outputChat("Nie jeste? w poje?dzie salonowym!"25500)
        return
    end
    local cuboid2=veh:getData("salon:cuboid")
    local cuboid=cuboid2:getData("cuboid:car_dealership")
    cuboid2:setData("cuboid:car_dealership", {
        ["veh"] = cuboid["veh"],
        ["vehicle"] = cuboid["vehicle"],
        ["vehicle_cost"] = cuboid["vehicle_cost"],
        ["vehicle_mileage"] = arg2,
        ["vehicle_drivetype"] = cuboid["vehicle_drivetype"],
        ["vehicle_capacity"] = cuboid["vehicle_capacity"]
    })
    exports["srpg_db"]:dbSet("update srpg_salon set przebieg=? where id=?"arg2veh:getData("salon:dbid"))
    plr:outputChat("Przebieg pojazdu zosta? zmieniony na "..arg2.." KM"02550)
elseif arg1 == "rz" then
    if not arg2 or not tonumber(arg2then
        plr:outputChat("U?ycie: /salon rz <rz>"25500)
        return
    end
    local veh=plr.vehicle
    if not veh then
        plr:outputChat("Nie jeste? w poje?dzie!"25500)
        return
    end
    for i,v in ipairs(getElementsByType("vehicle"), resourceRoot) do
        if == veh then
            local rx,ry,rz getElementRotation(veh)
            setElementRotation(veh,rx,ry,arg2)
        end
    end
    plr:outputChat("Aby zapisa? pojazd u?yj /salon zapisz"02550)
elseif arg1 == "zapisz" then
    local veh=plr.vehicle
    if not veh or not veh:getData("salon:dbid"then
        plr:outputChat("Nie jeste? w poje?dzie salonowym!"25500)
        return
    end
    local x,y,z=getElementPosition(veh)
    local rx,ry,rz=getElementRotation(veh)
    local int=veh.interior
    local dim=veh.dimension
    local posformat=x..", "..y..", "..z..", "..rx..", "..ry..", "..rz..", "..dim..", "..int
    exports["srpg_db"]:dbSet("update srpg_salon set pos=? where id=?"posformatveh:getData("salon:dbid"))
    restartResource(getThisResource())
else
plr:outputChat("U?ycie: /salon (edytuj,stworz,usun,cena,model,przebieg,zapisz,rz)"25500)
end
end
end
addCommandHandler("salon"salon)

addEventHandler("onVehicleStartEnter"resourceRoot, function(playerseat)
    if source:getData("vehicle:for:sale"then
        cancelEvent()
    end
end)

init()


Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-04-21, 22:46


AmaMa.

AmaMa.#3768






Wiek: 25
Na forum: 3207 dni
Posty: 182
Nick w MP: AmaMa.

Piwa: 1825

Respekt: 165,3
Respekt: 165,3Respekt: 165,3

DjMaXimoMax, To jest salon z jakiej? paczki? Je?li tak, to jakiej?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-04-22, 15:42


AsterBonzo

Otwórz ogień






Wiek: 20
Na forum: 2968 dni
Posty: 187
Nick w MP: Hirahi

Piwa: 60

Respekt: 35,8

Tak to jest salon z its'a (ten lepszy salon ?e podchodzisz i okienko do kupna, ale chce naprawi? ten b??d bo to ju? 3 raz. Bo jak nie naprawie to co restart serwera i potem salonu to potem salon musze od nowa robi?).

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-04-22, 15:46


AmaMa.

AmaMa.#3768






Wiek: 25
Na forum: 3207 dni
Posty: 182
Nick w MP: AmaMa.

Piwa: 1825

Respekt: 165,3
Respekt: 165,3Respekt: 165,3

DjMaXimoMax, A to nie jest tak, ?e te pojazdy s? zapisane w MySQL? Po restarcie powinny si? normalnie pojawi?.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-04-22, 16:35


AsterBonzo

Otwórz ogień






Wiek: 20
Na forum: 2968 dni
Posty: 187
Nick w MP: Hirahi

Piwa: 60

Respekt: 35,8

S? w mysql ale klikam restart i ten b??d w db3 oraz pojazdy si? nie pojawiaj? po restarcie.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-04-22, 17:05


AmaMa.

AmaMa.#3768






Wiek: 25
Na forum: 3207 dni
Posty: 182
Nick w MP: AmaMa.

Piwa: 1825

Respekt: 165,3
Respekt: 165,3Respekt: 165,3

DjMaXimoMax, Wy?lij ss'a tabeli srpg_salon w mysql.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-04-22, 17:16


AsterBonzo

Otwórz ogień






Wiek: 20
Na forum: 2968 dni
Posty: 187
Nick w MP: Hirahi

Piwa: 60

Respekt: 35,8




[ Dodano: 2019-04-22, 21:58 ]
Polecam Amame pomaga zawsze :D .


Do zamkni?cia

[ Dodano: 2019-04-22, 21:58 ]
Polecam Amame pomaga zawsze :D .


Do zamkni?cia

Postaw piwo autorowi tego posta
 

 
Tagi: pr0blem :: salonem
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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