OldXar
Member
- Joined
- Feb 17, 2009
- Messages
- 215
- Reaction score
- 6
I keep getting this error in my server console this is about the idle.lua file, I tried to fix it myself but no results,...
If I change values it either kicks a player out of my server or players can't get in...
So so far the only problem Im having with this script is the error that keeps spamming over and over again, Im pretty sure this follows with alot of memory loss and lagg.
Anyone a clue how to fix this ?
Error:
Idle.lua (Original)
If I change values it either kicks a player out of my server or players can't get in...
So so far the only problem Im having with this script is the error that keeps spamming over and over again, Im pretty sure this follows with alot of memory loss and lagg.
Anyone a clue how to fix this ?
Error:
Code:
[02/06/2010 17:28:48] [Error - CreatureScript Interface]
[02/06/2010 17:28:48] data/creaturescripts/scripts/idle.lua:onThink
[02/06/2010 17:28:48] Description:
[02/06/2010 17:28:48] data/creaturescripts/scripts/idle.lua:14: attempt to compare number with nil
[02/06/2010 17:28:48] stack traceback:
[02/06/2010 17:28:48] data/creaturescripts/scripts/idle.lua:14: in function <data/creaturescripts/scripts/idle.lua:6>
Idle.lua (Original)
Code:
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 > 1 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