<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
0.0.0.0
you will create a vulnerability on the server, hence players will abuse.This is not otx 8.6, it is made by recent tfs 1x.. I only see the functions..
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
function Player.isConnected(self)
return self:getIp() > 0
end
Usage:
Code:
if(player:isConnected()) then
print("Hes Connected!")
else
print("Hes Gone :(")
end
<event type="think" name="Idle" event="script" value="idle.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
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
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
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
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