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

[OTX 2.5] Character doesnt get kicked or receive idle warnings while AFK

ralke

(҂ ͠❛ ෴ ͡❛)ᕤ
Joined
Dec 17, 2011
Messages
1,470
Solutions
27
Reaction score
844
Location
Santiago - Chile
GitHub
ralke23
Twitch
ralke23
I wondered if it is possible that u guys help me with this. I have the idle time script bad, while the char is AFK it doesnt get kicked or receive idle warnings, either if is on protection zone or anywhere. If you have any idea how I could fix it, or any clue, it would serve me a lot, I have the VPS contracted and the server ready but that problem don't let me add otserver to otservlist.org (ive been banned on the site for the same reason)

btw if someone see please change my thread to support!

here is my login.lua

Ralke said:
local config = {
loginMessage = getConfigValue('loginMessage'),
useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}

function onLogin(cid)

local playerTown = getPlayerTown(cid)
if playerTown ~= 2 then
if not isPremium(cid) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You has been teleported, because your premium has ended.")
doPlayerSetTown(cid, 2)
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
end
return TRUE
end
if playerTown == 2 then
if not isPremium(cid) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your premium has ended.")
end
return TRUE
end

if(getBooleanFromString(getConfigValue('accountManager')) == false) then
if (getCreatureName(cid) == "Account Manager") then
return doRemoveCreature(cid, true)
end
end

local loss = getConfigValue('deathLostPercent')
if(loss ~= nil) then
doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
end

local accountManager = getPlayerAccountManager(cid)
if(accountManager == MANAGER_NONE) then
local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
if(lastLogin > 0) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
else
str = str .. " Please choose your outfit."
doPlayerSendOutfitWindow(cid)
end

doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
elseif(accountManager == MANAGER_NAMELOCK) then
addEvent(valid(doCreatureSay), 500, cid, "Hello, it appears that your character has been locked for name violating rules, what new name would you like to have?", TALKTYPE_PRIVATE_NP, true, cid)
elseif(accountManager == MANAGER_ACCOUNT) then
addEvent(valid(doCreatureSay), 500, cid, "Hello, type {account} to manage your account. If you would like to start over, type {cancel} anywhere.", TALKTYPE_PRIVATE_NP, true, cid)
else
addEvent(valid(doCreatureSay), 500, cid, "Hello, type {account} to create an account or {recover} to recover an account.", TALKTYPE_PRIVATE_NP, true, cid)
end

if(not isPlayerGhost(cid)) then
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
end

registerCreatureEvent(cid, "Idle")
registerCreatureEvent(cid, "Mail")
if(getPlayerOperatingSystem(cid) >= CLIENTOS_OTCLIENT_LINUX) then
registerCreatureEvent(cid, "ExtendedOpcode")
end

registerCreatureEvent(cid, "ReportBug")
if(config.useFragHandler) then
registerCreatureEvent(cid, "SkullCheck")
end

registerCreatureEvent(cid, "GuildEvents")
registerCreatureEvent(cid, "AdvanceSave")
registerCreatureEvent(cid, "recordIp")
registerCreatureEvent(cid, "partyAndGuildProtection")

registerCreatureEvent(cid, "InquisitionPortals")
registerCreatureEvent(cid, "ArenaKill")
registerCreatureEvent(cid, "Reward")
registerCreatureEvent(cid, "guildmembersonlook")

if getPlayerStorageValue(cid, 42309) < 1 then
for i = 42300, 42309 do
setPlayerStorageValue(cid, i, 0)
end
end
if getPlayerStorageValue(cid, 42319) < 1 then
for i = 42310, 42319 do
setPlayerStorageValue(cid, i, 0)
end
end
if getPlayerStorageValue(cid, 42329) < 1 then
for i = 42320, 42329 do
setPlayerStorageValue(cid, i, 0)
end
end
if getPlayerStorageValue(cid, 42355) == -1 then
setPlayerStorageValue(cid, 42355, 0)
end
setPlayerStorageValue(cid, 42350, 0)
setPlayerStorageValue(cid, 42352, 0)

return true
end

the idle.lua

Ralke said:
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 = "There was no variation in your behaviour 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 there is no change in your actions until then."
end

doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, message .. ".")
end

return true
end

and also config.lua

Ralke said:
idleWarningTime = 14 * 60 * 1000
idleKickTime = 15 * 60 * 1000

expireReportsAfterReads = 1
playerQueryDeepness = -1
protectionTileLimit = 10
houseTileLimit = 10
tileLimit = 7

Please help! :D
 
Last edited:
@login12
definitly my idle.lua is not working properly
im looking if there's exists a way to put idle time here:
math.ceil("value of idle time"/ 60000) .. " minutes"

here is my login.lua

Ralke said:
local config = {
loginMessage = getConfigValue('loginMessage'),
useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}

function onLogin(cid)

local playerTown = getPlayerTown(cid)
if playerTown ~= 2 then
if not isPremium(cid) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You has been teleported, because your premium has ended.")
doPlayerSetTown(cid, 2)
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
end
return TRUE
end
if playerTown == 2 then
if not isPremium(cid) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your premium has ended.")
end
return TRUE
end

if(getBooleanFromString(getConfigValue('accountManager')) == false) then
if (getCreatureName(cid) == "Account Manager") then
return doRemoveCreature(cid, true)
end
end

local loss = getConfigValue('deathLostPercent')
if(loss ~= nil) then
doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
end

local accountManager = getPlayerAccountManager(cid)
if(accountManager == MANAGER_NONE) then
local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
if(lastLogin > 0) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
else
str = str .. " Please choose your outfit."
doPlayerSendOutfitWindow(cid)
end

doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
elseif(accountManager == MANAGER_NAMELOCK) then
addEvent(valid(doCreatureSay), 500, cid, "Hello, it appears that your character has been locked for name violating rules, what new name would you like to have?", TALKTYPE_PRIVATE_NP, true, cid)
elseif(accountManager == MANAGER_ACCOUNT) then
addEvent(valid(doCreatureSay), 500, cid, "Hello, type {account} to manage your account. If you would like to start over, type {cancel} anywhere.", TALKTYPE_PRIVATE_NP, true, cid)
else
addEvent(valid(doCreatureSay), 500, cid, "Hello, type {account} to create an account or {recover} to recover an account.", TALKTYPE_PRIVATE_NP, true, cid)
end

if(not isPlayerGhost(cid)) then
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
end

registerCreatureEvent(cid, "Idle")
registerCreatureEvent(cid, "Mail")
if(getPlayerOperatingSystem(cid) >= CLIENTOS_OTCLIENT_LINUX) then
registerCreatureEvent(cid, "ExtendedOpcode")
end

registerCreatureEvent(cid, "ReportBug")
if(config.useFragHandler) then
registerCreatureEvent(cid, "SkullCheck")
end

registerCreatureEvent(cid, "GuildEvents")
registerCreatureEvent(cid, "AdvanceSave")
registerCreatureEvent(cid, "recordIp")
registerCreatureEvent(cid, "partyAndGuildProtection")

registerCreatureEvent(cid, "InquisitionPortals")
registerCreatureEvent(cid, "ArenaKill")
registerCreatureEvent(cid, "Reward")
registerCreatureEvent(cid, "guildmembersonlook")

if getPlayerStorageValue(cid, 42309) < 1 then
for i = 42300, 42309 do
setPlayerStorageValue(cid, i, 0)
end
end
if getPlayerStorageValue(cid, 42319) < 1 then
for i = 42310, 42319 do
setPlayerStorageValue(cid, i, 0)
end
end
if getPlayerStorageValue(cid, 42329) < 1 then
for i = 42320, 42329 do
setPlayerStorageValue(cid, i, 0)
end
end
if getPlayerStorageValue(cid, 42355) == -1 then
setPlayerStorageValue(cid, 42355, 0)
end
setPlayerStorageValue(cid, 42350, 0)
setPlayerStorageValue(cid, 42352, 0)

return true
end

the idle.lua

Ralke said:
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 = "There was no variation in your behaviour 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 there is no change in your actions until then."
end

doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, message .. ".")
end

return true
end

and also config.lua

Ralke said:
idleWarningTime = 14 * 60 * 1000
idleKickTime = 15 * 60 * 1000

expireReportsAfterReads = 1
playerQueryDeepness = -1
protectionTileLimit = 10
houseTileLimit = 10
tileLimit = 7

Please help! :D
 
Last edited:
Last edited:
[Movemevent] Using this script to fix, allows me to kick players who spend more that 30 minutes without moving.

12a177afcd.png


And now i have this error when player logout and still having the efect of storage id

1297802009.png


Someone knows how to fix?
 
Last edited:
Back
Top