• 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!

[MOD] table expected, got nil

olavo

New Member
Joined
May 29, 2007
Messages
74
Reaction score
0
Lua:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Death Portais" version="1.0" author="Olavo" contact="[email protected]" enabled="yes">
	<config name="portais_config"><![CDATA[
		config = {
			message = "Entre no teleporte em ate 2 minutos, ao passar este tempo ele desaparecera!",
			timeToRemove = 120, -- seconds
			teleportId = 1387,
			bosses = {
				["Akaoni"] = {['from'] = {x = 0, y = 0, z = 0}, ['to'] = { x = 948, y = 1161, z = 11}, ['storage'] = {id = 0, value = -1}},
				["Merlin"] = {['from'] = {x = 0, y = 0, z = 0}, ['to'] = { x = 948, y = 1148, z = 11}, ['storage'] = {id = 0, value = -1}},
				["Urnoghor"] = {['from'] = {x = 0, y = 0, z = 0}, ['to'] = { x = 948, y = 1136, z = 11}, ['storage'] = {id = 0, value = -1}},
				["Logharok"] = {['from'] = {x = 0, y = 0, z = 0}, ['to'] = { x = 948, y = 1118, z = 11}, ['storage'] = {id = 0, value = -1}},

				["Argor"] = {['from'] = {x = 0, y = 0, z = 0}, ['to'] = { x = 948, y = 1161, z = 11}, ['storage'] = {id = 0, value = -1}},
				["Brutal energy"] ={['from'] = {x = 0, y = 0, z = 0}, ['to'] = { x = 948, y = 1161, z = 11}, ['storage'] = {id = 0, value = -1}}, 
				["Gharkan"] = {['from'] = {x = 0, y = 0, z = 0}, ['to'] = { x = 948, y = 1161, z = 11}, ['storage'] = {id = 0, value = -1}},
				["Khurnor"] = {['from'] = {x = 0, y = 0, z = 0}, ['to'] = { x = 948, y = 1161, z = 11}, ['storage'] = {id = 0, value = -1}}
			}
		}
		function removal(position, teleportId) -- remove teleportId?
			position.stackpos = 1
			if getThingfromPos(position).itemid == config.teleportId then
				doRemoveItem(getTileItemById(position, teleportId).uid) -- test
				--doRemoveItem(getThingfromPos(position, teleportId).uid)
			end
			return TRUE
		end
	]]></config>
	<event type="death" name="Portais" event="script"><![CDATA[
		domodlib('portais_config')

		function onDeath(cid, corpse, killer)
			registerCreatureEvent(cid, "Portais")
			local position = getCreaturePosition(cid)
	
			for name, boss in pairs(config.bosses) do
				if name == getCreatureName(cid) then
					if(getThingFromPos(boss['from'])) then
						position = boss['from']
					end
					if(boss['storage'].id ~= 0) then
						doPlayerSetStorageValue(killer, boss['storage'].id, boss['storage'].value)
					end
					teleport = doCreateTeleport(config.teleportId, boss['to'], position)
					doCreatureSay(cid, config.message, TALKTYPE_ORANGE_1)
					addEvent(removal, config.timeToRemove * 1000, position, config.teleportId)
				end
			end
			return TRUE
		end
	]]></event>
</mod>
Returned this error (config.bosses = nil?):
[25/08/2009 13:46:38] Lua Script Error: [CreatureScript Interface]
[25/08/2009 13:46:38] buffer:eek:nDeath

[25/08/2009 13:46:38] [string "loadBuffer"]:7: bad argument #1 to 'pairs' (table expected, got nil)
[25/08/2009 13:46:38] stack traceback:
[25/08/2009 13:46:38] [C]: in function 'pairs'
[25/08/2009 13:46:38] [string "loadBuffer"]:7: in function <[string "loadBuffer"]:3>

whats wrong in this?
 
Back
Top