Exedion
Active Member
- Joined
- Jun 11, 2007
- Messages
- 628
- Reaction score
- 30
i have this error with the idle creature event:
and this is my script:
and this the line of the error:
with this, i can't cast spells!! i don't understend... please help!
Code:
[16:52:02.635] [Error - CreatureScript Interface]
[16:52:02.636] data/creaturescripts/scripts/idle.lua:onThink
[16:52:02.639] Description:
[16:52:02.640] data/creaturescripts/scripts/idle.lua:12: attempt to perform arit
hmetic on local 'interval' (a table value)
[16:52:02.642] stack traceback:
[16:52:02.643] data/creaturescripts/scripts/idle.lua:12: in function <data/crea
turescripts/scripts/idle.lua:6>
and this is my script:
Lua:
local config = {
idleWarning = getConfigValue('idleWarningTime'),
idleKick = getConfigValue('idleKickTime')
}
function onThink(cid, interval)
if(getTileInfo(getCreaturePosition(cid)).nologout or getCreatureNoMove(cid) or
getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_ALLOWIDLE)) then
return true
end
local idleTime = getPlayerIdleTime(cid) + interval
doPlayerSetIdleTime(cid, idleTime)
if(config.idleKick > 0 and idleTime > config.idleKick) then
doRemoveCreature(cid)
elseif(config.idleWarning > 0 and idleTime == config.idleWarning) then
local message = "You have been idle for " .. math.ceil(config.idleWarning / 60000) .. " minutes"
if(config.idleKick > 0) then
message = message .. ", you will be disconnected in "
local diff = math.ceil((config.idleWarning - config.idleKick) / 60000)
if(diff > 1) then
message = message .. diff .. " minutes"
else
message = message .. "one minute"
end
message = message .. " if you are still idle"
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, message .. ".")
end
return true
end
and this the line of the error:
Lua:
local idleTime = getPlayerIdleTime(cid) + interval
with this, i can't cast spells!! i don't understend... please help!