Ich habe ein Problem mit einer Funktion und einem Array seit gestern. Es scheint, dass der Hebel ID deklariert oder etwas nicht ...LUA Eine Funktion und ein Array, deklariert ID, null Ariable?
Hier ist mein Code:
function tpp(leverID, from, to)
if item.uid == leverID and item.itemid == 1945 then
local count_players = #to
local store = {}
for i = 1, count_players do
local pid = getTopCreature(from[i]).uid
if (pid == 0 or not isPlayer(pid)) then
return doPlayerSendCancel(cid, 'You need ' .. count_players .. ' players to use this lever.')
end
store[i] = pid
end
for i = 1, count_players do
doSendMagicEffect(from[i], CONST_ME_POFF)
doTeleportThing(store[i], to[i], false)
doSendMagicEffect(to[i], CONST_ME_TELEPORT)
end
doTransformItem(item.uid, item.itemid + 1)
elseif item.uid == leverID and item.itemid == 1946 then
doTransformItem(item.uid, item.itemid -1)
end
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
local pos = {
['pos_start'] = {
{['x'] = 1059, ['y'] = 1034, ['z'] = 7},
{['x'] = 1060, ['y'] = 1034, ['z'] = 7}
},
['pos_end'] = {
{['x'] = 1059, ['y'] = 1032, ['z'] = 7},
{['x'] = 1060, ['y'] = 1032, ['z'] = 7}
}
}
tpp(10150, pos['pos_start'], pos['pos_end'])
return true
end
ich diesen Fehler:
attempt to index global 'item' (a nil value)
ich lua neu bin. Kann mir jemand helfen? Vielen Dank!