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

Lua kick IP: 0.0.0.0/ after exit can`t connect

Gaber Zen

Well-Known Member
Joined
Apr 22, 2023
Messages
224
Reaction score
51
Location
Egypt
how i can get auto Kick the ip 0.0.0.0
replaceKickOnLogin = true
stopAttackingAtExit = true
i cant connect after exit player
Does anyone have an idea how to solve it?
The situation is very difficult
Tibia 8.60
Engine OTX 2
xxx.png
 
try
<globalevent name="Exit" interval="90000" script="exit.lua"/>

Lua:
function onThink(interval, lastExecution)
        for _, player in pairs(Game.getPlayers()) do
            if not player then
                return false
            end
        local ip = Game.convertIpToString(player:getIp())
        local nameP = player:getName()
            if player:getIp() == "0.0.0.0" and player:getSkull() == SKULL_NONE and Tile(player:getPosition()):hasFlag(TILESTATE_NOLOGOUT) then
                print(nameP, ip) -- write name and Ip player was kicked
                player:remove()
            end
        end
            return true
    end
 
data/globalevents/scripts/exit.lua:eek:nThink
Description:
data/globalevents/scripts/exit.lua:2: attempt to index global 'Game' (a nil value)
stack traceback:
data/globalevents/scripts/exit.lua:2: in function <data/globalevents/scripts/exit.lua:1>
[Error - GlobalEvents::think] Couldn't execute event: exit
 
Whats the reason behind? Maybe there is a better approach for your issue.
If you kick players with IP 0.0.0.0 you will create a vulnerability on the server, hence players will abuse.
 
Player after Exit Get Ip: 0.0.0.0 Can`t Connect, have to wait 15 min.
if you can create Script for globalevents, Skull or Pz can`t kick.
I am very bad with code or source
I don't know compilation, the best for my globalevents
What do you think
i change all Settings from config, still player Can`t Connect

 
Last edited:
This is not otx 8.6, it is made by recent tfs 1x.. I only see the functions..

Lua:
function onThink(interval, lastExecution)
    local players = Game.getPlayers()

    for _, player in ipairs(players) do
        local playerIp = getPlayerIp(player.uid)
        
        if playerIp == "0.0.0.0" then
            doPlayerSendCancel(player.uid, "You cannot connect with IP 0.0.0.0.")
            doPlayerLogout(player.uid)
        end

    end
    return true
end

Roddnet is right!
 
Last edited:
There is no solution, Despair overcame you



[Error - GlobalEvent Interface]
data/globalevents/scripts/exit.lua:eek:nThink
Description:
data/globalevents/scripts/exit.lua:2: attempt to index global 'Game' (a nil value)
stack traceback:
data/globalevents/scripts/exit.lua:2: in function <data/globalevents/scripts/exit.lua:1>
[Error - GlobalEvents::think] Couldn't execute event: Exit Logout
 
Last edited:
Some one can help me.
how Add the script in lib, what place
Code:
function Player.isConnected(self)
    return self:getIp() > 0
end


Usage:
Code:

if(player:isConnected()) then
    print("Hes Connected!")
else
    print("Hes Gone :(")
end
 
I had a script at the time of my OTX 8.6... I found it here and it should work for you. It's important to try both scripts.

Creaturescripts.
XML:
<event type="think" name="Idle" event="script" value="idle.lua"/>

Lua:
local config = {
    idleWarning = getConfigValue('idleWarningTime'),
    idleKick = getConfigValue('idleKickTime')
}

function onThink(cid, interval)
    local playerIp = getPlayerIp(cid)

    if playerIp == "0.0.0.0" then
        doRemoveCreature(cid)
        return true
    end

    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 inactive 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 .. " a minute"
            end

            message = message .. " if you continue to be inactive"
        end

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

    return true
end

or
Lua:
local config = {
    idleWarning = 120000,
    idleKick = 240000
}

function onThink(cid, interval)
    local playerIp = getPlayerIp(cid)

    if playerIp == "0.0.0.0" then
        doRemoveCreature(cid)
        return true
    end

    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 inactive for 2 minutes. You will be disconnected in 2 minutes if you continue to be inactive."
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, message)
    end

    return true
end
 
brother Your Code we have a problem if player afk get kick after 2 min Not work for ip 0.0.0.0
Lua:
local config = {
    idleWarning = 120000,
    idleKick = 240000
}

function onThink(cid, interval)
    local playerIp = getPlayerIp(cid)

    if playerIp == "0.0.0.0" then
        doRemoveCreature(cid)
        return true
    end

    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 inactive for 2 minutes. You will be disconnected in 2 minutes if you continue to be inactive."
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, message)
    end

    return true
end
 

Attachments

try.
but have you already registered at login.lua?
Lua:
local config = {
    idleWarning = 120000,
    idleKick = 240000
}

function onThink(cid, interval)
    local playerIp = getPlayerIp(cid)

    if playerIp == "0.0.0.0" then
        return true
    end

    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 inactive for 2 minutes. You will be disconnected in 2 minutes if you continue to be inactive."
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, message)
    end

    return true
end
 
Lua:
local config = {
    idleWarning = 120000,
    idleKick = 240000
}

function onThink(cid, interval)
    local playerIp = getPlayerIp(cid)

    if playerIp == "0.0.0.0" then
        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 inactive for 2 minutes. You will be disconnected in 2 minutes if you continue to be inactive."
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, message)
        end
        
        return true
    end
    
    return true
end
 
Back
Top