MadMOOK
Hoo
- Joined
- Apr 20, 2011
- Messages
- 802
- Reaction score
- 44
Here is the creaturescript..
Here is the function in functions.lua
Here is my error when they die
Code:
function onDeath(cid, corpse)
if isPlayer(cid) then
for k,v in pairs(instance_config) do
local instance = instance_config[k]
if isInArray(instance.players, getPlayerName(cid)) then
clearInstance(k, true)
break
end
end
end
return true
end
Here is the function in functions.lua
Code:
function clearInstance(id)
local instance = instance_config[id]
if instance.players ~= nil then
for k,v in pairs(instance.players) do
if v ~= nil then
local player = v
if isPlayer(player) then
doTeleportThing(player, instance.exitPos)
doPlayerSendCancel(player, "Time has run out.")
end
end
end
instance.players = nil
end
end
Here is my error when they die
[14:11:29.918] [Error - CreatureScript Interface]
[14:11:29.928] data/creaturescripts/scripts/InstanceDeath.luanDeath
[14:11:29.940] Description:
[14:11:29.946] data/lib/050-function.lua:253: bad argument #1 to 'ipairs' (table
expected, got nil)
[14:11:29.963] stack traceback:
[14:11:29.968] [C]: in function 'ipairs'
[14:11:29.976] data/lib/050-function.lua:253: in function 'isInArray'
[14:11:29.988] data/creaturescripts/scripts/InstanceDeath.lua:5: in function <d
ata/creaturescripts/scripts/InstanceDeath.lua:1>