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

TFS 1.X+ [tfs 1.3] - for 8.6 (have exit trainer, i want to remove)

you can use this as an option, is a moveevent that work when you step in and step out, log you out and teleport to a certain place when time is finished

LUA:
local config = {
   timer = 300, -- time in minutes (0.1 = 6 seconds, for easy testing)
   teleport = {x = 1039, y = 999, z = 7} -- teleport position
}

kick_player = {}

local function kickPlayer(cid)
   if not isPlayer(cid) then
       return true
   end
   doTeleportThing(cid, config.teleport)
   addEvent(doRemoveCreature, 0, cid)
   return true
end

local function stopKick(cid)
   if stopEvent(kick_player[cid]) then
       if not isPlayer(cid) then
           return true
       end
       doPlayerSendTextMessage(cid, 23, "You will no longer be forcibly logged out.")
   end
   return true
end

function onStepIn(cid, item, position, fromPosition)
   if not isPlayer(cid) then
       return false
   end
   kick_player[cid] = addEvent(kickPlayer, config.timer * 60 * 1000, cid)
   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "[Trainer]: If you remain on this tile longer then " .. config.timer .. " minutes, the system will automatically log you out.")
   return true
end

function onStepOut(cid, item, position, fromPosition)
   if not isPlayer(cid) then
       return false
   end
   addEvent(stopKick, 0, cid)
   return true
end
 
edit: Using it i solve the problem, but i look for another (otimized function)
LUA:
function Creature:onTargetCombat(target)
    if self:isPlayer() and self:getIp() == 0 then
        self:setTarget(nil)
    end
    return RETURNVALUE_NOERROR
end

because this executes in all spells and attacks
 
and i'm using this code, @Homeslice saied that not count 4 mcs or more, that we can use no-logout zone, and another things. (Very important - Rules change on otservlist.org (https://otland.net/threads/very-important-rules-change-on-otservlist-org.247531/page-6))

but i think it not work fine, because i use this code, i no dont use no-logout zone, and i get banned by spoof msg.

edit, in part he says: in player.h move
Code:
int32_t idleTime = 0;
from the private: section to below "public:"

i have moved a function:
this function
above this line:
this line

its correct?
 
Last edited:
Back
Top