• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Stupid -- warning kick idle --

Zool

Banned User
Joined
Jun 9, 2009
Messages
742
Reaction score
5
Location
Poland/St Wola
Code:
	idleWarningTime = 150 * 60 * 1000
	idleKickTime = 150 * 60 * 1000

Why all time when player click Exit system kicked him after 1 minutes (60 second)
???

Its stupid when some one make Skull and click exit ;|

Idle.lua
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 > 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

creaturescripts.xml :
Code:
	<event type="think" name="Idle" event="script" value="idle.lua"/>

Login.lua
Code:
local config = {
	loginMessage = getConfigValue('loginMessage'),
	useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}

function onLogin(cid)
	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
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")
	elseif(accountManager == MANAGER_ACCOUNT) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.")
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")
	end

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

	registerCreatureEvent(cid, "Mail")
	registerCreatureEvent(cid, "GuildMotd")

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

	registerCreatureEvent(cid, "ReportBug")
	registerCreatureEvent(cid, "AdvanceSave")
	return true
end


I CAN PAY ZŁ / EURO.
I CAN GIVE 1000 PTK TO KOSMOS.TIBIAHOSTING.PL (SMS SHOP)
OR I CAN BUY SOME PTK ON OTHERS OTS -FOR HELP-
 
You must edit source. Remove this part from player.cpp:

Code:
void Player::onThink(uint32_t interval)
{
	Creature::onThink(interval);
	int64_t timeNow = OTSYS_TIME();
	if(timeNow - lastPing >= 5000)
	{
		lastPing = timeNow;
		if(client)
			client->sendPing();
		else if(g_config.getBool(ConfigManager::STOP_ATTACK_AT_EXIT))
			setAttackedCreature(NULL);
	}

[B][COLOR="red"]	if((timeNow - lastPong) >= 60000 && canLogout(true))
	{
		if(client)
			client->logout(true, true);
		else if(g_creatureEvents->playerLogout(this, true))
			g_game.removeCreature(this, true);
	}[/COLOR][/B]

	messageTicks += interval;
	if(messageTicks >= 1500)
	{
		messageTicks = 0;
		addMessageBuffer();
	}
}
Or, do you want players to not get kicked only if they have a skull?
 
Player.cpp
Code:
void Player::onThink(uint32_t interval)
{
        Creature::onThink(interval);
        int64_t timeNow = OTSYS_TIME();
        if(timeNow - lastPing >= 5000)
        {
                lastPing = timeNow;
                if(client)
                        client->sendPing();
                else if(g_config.getBool(ConfigManager::STOP_ATTACK_AT_EXIT))
                        setAttackedCreature(NULL);
        }
/*
        if((timeNow - lastPong) >= 60000 && !isConnecting && !pzLocked && !getTile()->hasFlag(TILESTATE_NOLOGOUT))
        {
                if(client)
                        client->logout(true, true);
                else if(g_creatureEvents->playerLogout(this, false))
                        g_game.removeCreature(this, true);
        }
*/
        messageTicks += interval;
        if(messageTicks >= 1500)
        {
                messageTicks = 0;
                addMessageBuffer();
        }
}

what's wrong ?
 
Back
Top