• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Attempt to index global 't' (a nil value)

Dankasby

New Member
Joined
Apr 26, 2012
Messages
1
Reaction score
0
I added a system of the inquisition teleports. But when I kill other monsters (except bosses of the Inquisition), he does not die and this error appears

erro.jpg


The script:


Code:
local config = {
        timeToRemove = 180, -- segundos
                message = "Go into the teleport in 180 seconds, else it will disappear.",
        teleportId = 9773,
        bosses = { -- Nome do monstro,  Posicao do teleporte
                ["Ushuriel"] = {  pos={x=1294, y=705, z=15, stackpos=1}, aid=11001 },
                ["Zugurosh"] = {  pos={x=1328, y=704, z=15, stackpos=1}, aid=11002},
                ["Madareth"] = {  pos={x=1291, y=731, z=15, stackpos=1}, aid=11003},
                ["Annihilon"] = {  pos={x=1366, y=689, z=15, stackpos=1}, aid=11005},
                ["Hellgorak"] = {  pos={x=1371, y=731, z=15	, stackpos=1}, aid=11006},
				["Latrivan"] = {pos={x=1326, y=735, z=15, stackpos=1},aid=11004}

}	}	
 local function change(position)
        doItemSetAttribute(getTileItemById(position, config.teleportId).uid, "aid", 3000)
    return TRUE
end

function onKill(cid, target, lastHit)
    if(config.bosses[getCreatureName(target)]) then
                local t = config.bosses[getCreatureName(target)]
                local position = t.pos
                doItemSetAttribute(getTileItemById(position, config.teleportId).uid, "aid", t.aid)
				doCreatureSay(cid, config.message, TALKTYPE_ORANGE_1)
                addEvent(change, config.timeToRemove * 1000, position)
				return TRUE
		
		else
                        local position = t.pos
                        doItemSetAttribute(getTileItemById(position, config.teleportId).uid, "aid", t.aid)
                        doItemSetAttribute(teleport, "aid", t.aid)
                        doCreatureSay(cid, config.message, TALKTYPE_ORANGE_1)
                        addEvent(removal, config.timeToRemove * 1000, position)
                end
        end
        return TRUE

Anyone help me ?
Thanks.
 
Back
Top