Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.
GTAONLINE.PL
Tematy otagowane jako: ipairs
1. Bad argument #1 to 'ipairs' (table expected, got boolean)
Witam, zaczn? ?e jestem ca?kowicie zielony w tym temacie :-? , ale wracaj?c
od pewnego czasu zacz??em bawi? si? paczk? MTA, wszystkie skrypty z bazami danych dzia?aj?, ale nie dzia?a jeden z nich. Jest to skrypt do systemu dom?w.
Po jego uruchomieniu wyrzuca b??d: interiory.lua:26: bad argument #1 to 'ipairs' (table expected, got boolean). Wrzucam tutaj skrypt interiory.lua z tym b??dem.
Po rozwi?zaniu problemu stawiam zimne :piwo:


interiory
={}


local dane=exports.srdb2:pobierzTabeleWynikow("SELECT id,interior,entrance,`exit` FROM domy_interiory WHERE `exit` IS NOT NULL AND active=1")
for 
_,v in ipairs(dane) do
local ii tonumber(v.id)
v.entrance=split(v.entrance,",")
v.id=nil
interiory
[ii]=v
end

addEvent
("moveMeTo"true)
addEventHandler("moveMeTo"resourceRoot, function(x,y,z,i,d)
setElementDimension(clientd)
setElementInterior(client,i,x,y,z)
setElementPosition(client,x,y,z)
setElementInterior(client,i)
end)
2. ipairs
nie rozumiem dlaczego wyskakuje mi druga pozycja w tabeli w ka?dym markerze wejscie b?d? wyj?cie.. dawno nie bawi?em si? w lua wi?c zwracam si? o pomoc w tym dziale. z g?ry dzi?kuje i stawiam :piwo:

[code]local sx, sy = guiGetScreenSize()
local zoom = 1
if sx < 1920 then
zoom = math.min(2, 1920 / sx)
end

local table = { -- x,y,z pozcja w kt?rej wchodze, x2,y2,z2-- pozycja do kt?rej tepa, int - interior, dim - dimension
{"Urz?d miasta", -2242.76855, -405.89798, 50.86719, -2249.63696, -392.19766, 50.86719, 0,0, 1},
{"Szko?a jazdy", -2238.04126, -402.31439, 50.86719, -2243.21973, -389.35394, 50.86719, 0,0, 2},
}

local sxsy = {
{sx/2- (626/2)/zoom, sy/2- -251/zoom, 626/zoom, 181/zoom},
{sx / 2 - 480 / zoom, sy / 2 - -430 / zoom, 1350 / zoom + sx / 2 - 875 / zoom, 580 / zoom + sy / 2 - 280 / zoom},
{sx / 2 - 480 / zoom, sy / 2 - -335 / zoom, 1350 / zoom + sx / 2 - 875 / zoom, 580 / zoom + sy / 2 - 280 / zoom},
}

function createTexture(path)
return dxCreateTexture("files/grafy/"..path, "argb", true, "clamp")
end

local g = {
createTexture("bg.png"),
}

function interpulacja (w,a,r,t,o,s,c,x)
return interpolateBetween(w, a, r, t, o, s, c, x)
end

function createFont(name,scale)
return dxCreateFont(name, scale)
end

local font = {
createFont("files/fonts/czcionka.ttf", 27/zoom),
createFont("files/fonts/czcionka.ttf&q...
3. pairs i ipairs
Czy m?g?by kto? mi wyt?umaczy? co robi pairs i ipairs? Szuka?em po internecie i niczego po polsku nie by?o :/ /
4. ipairs
[lua]
--[[
Autor: Malentas
]]

local sx, sy = guiGetScreenSize()
local font = dxCreateFont("cz.ttf", 12)


local panel = false
local kupno = false
local tryb = 1

local idni = guiCreateEdit(0.713, 0.56, 0.13, 0.04, "Dni", true)
guiSetVisible(idni, false)

function gui()
if panel == 1 then
local wlasciciel = info["nwlasciciel"]
if info["wlasciciel"] == 0 then
wlasciciel = "brak"
end
local zamek = "otwarty"
if info["zamkniety"] == 1 then
zamek = "zamkni?ty"
end
dxDrawImage(scale_x(548), scale_y(282), scale_x(345), scale_y(337), ":np-gui/grafiki/tlo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
shadowText(info["nazwa"], scale_x(546), scale_y(281), scale_x(893), scale_y(347), tocolor(255, 255, 255, 255), 1.00, font, "center", "center", false, false, false, false, false)
shadowText("W?a?ciciel: "..wlasciciel.."nCena: "..info["cena"].." PLNnZamek: "..zamek.."", scale_x(546), scale_y(348), scale_x(893), scale_y(497), tocolor(255, 255, 255, 255), 1.00, font, "center", "center", false, false, false, false, false)
dxDrawImage(scale_x(633), scale_y(549), scale_x(175), scale_y(51), ":np-gui/grafiki/button_off.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
if info["wlasciciel"] == 0 then
dxDrawIm...
5. nil value i ipairs
for kv in ipairs (playersOnPoliceTeam and getPlayersInTeamgetTeamFromName"Los Santos Police Department" ) ) ) do


a w debugscripcie wyswietla sie to -
bad argument #1 to 'ipairs' [table excepted, got boolean
6. DB i ipairs
Mam takie errory: https://scr.hu/WJ5e1G

dbExec(pol,"INSERT INTO `AG_House` (UID,x,y,z,owner,zamek,interior,dim) VALUES (?,?,?,?,?,?,?,?)",nuid,x,y,z,gracz,"Open",5,nuid)


local function getUID ()
    
local servee dbQuery pol"SELECT * FROM AG_House" )
    
local res dbPoll servee, -)
    for 
k,_ in ipairs res ) do
        
liczba k
    end
    
if liczba == or not liczba then
        
return false
    end
    
return liczba
end
7. for i, v in ipairs
Witam ot?? mam taki b??d:

attempt to index global 'veh'(a nil value)

22 linijka


local auta = {
    {
4073.85,1341.30,9.23},
    {
40717.00,1346.17,9.23},
    {
41630.56,1347.07,9.23},
}

for 
i,v in ipairs (auta) do
     
local pojazd createVehicle(veh[1], veh[2], veh[3] )
     
setElementData(pojazd"vehicle:fuel"100)
     
setElementFrozen(pojazdtrue)
     
setElementData(pojazd,"vehicle:desc","01[OSP]0"..i.."")
     
addVehicleUpgrade(pojazd1025)
     
setVehicleColor(pojazd255,0,0)
end

Stawiam zimne piwko :D