--[[
available clients to whitelist:
CLIENTOS_LINUX
CLIENTOS_WINDOWS
CLIENTOS_FLASH
CLIENTOS_OTCLIENT_LINUX
CLIENTOS_OTCLIENT_WINDOWS
CLIENTOS_OTCLIENT_MAC
]]
-- config
local whitelist = {CLIENTOS_OTCLIENTV8_MAC, CLIENTOS_OTCLIENTV8_WINDOWS, CLIENTOS_OTCLIENTV8_LINUX}
local msg = "This game client is not supported on the server."
-- end config
-- do not touch
local tibiaClient = {CLIENTOS_WINDOWS, CLIENTOS_LINUX}
local function forceLogout(cid)
local player = Player(cid)
if player then
local tile = player:getTile()
if not (tile:hasFlag(TILESTATE_NOLOGOUT) or (player:hasCondition(CONDITION_INFIGHT) and not tile:hasFlag(TILESTATE_PROTECTIONZONE))) then
player:remove()
end
end
end
function onLogin(player)
player:registerEvent("clientControl")
return true
end
function onThink(player, interval)
local clientType = player:getClient().os
if not isInArray(whitelist, clientType) then
if isInArray(tibiaClient, clientType) then
-- tibia client
local m = ModalWindow()
m:setTitle("Error")
m:setMessage(msg)
m:addButton(1, "ok")
m:sendToPlayer(player)
else
-- ot client
local m = NetworkMessage()
m:addByte(0x14)
m:addString(msg)
m:sendToPlayer(player)
end
addEvent(forceLogout, 100, player:getId())
end
return true
end