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

CreatureEvent [TFS 1.3] block unofficial clients

zbizu

Legendary OT User
Joined
Nov 22, 2010
Messages
3,323
Solutions
26
Reaction score
2,690
Location
Poland
This script allows you to prevent players from playing clients that aren't whitelisted by the script
preview:
G2qtkg1.png


creaturescripts.xml:
XML:
    <event type="login" name="clientControlLogin" script="client_control.lua" />
    <event type="think" name="clientControl" interval="5000" script="client_control.lua" />

creaturescripts/scripts/client_control.lua:
Lua:
--[[
    available clients to whitelist:
    CLIENTOS_LINUX
    CLIENTOS_WINDOWS
    CLIENTOS_FLASH
    CLIENTOS_OTCLIENT_LINUX
    CLIENTOS_OTCLIENT_WINDOWS
    CLIENTOS_OTCLIENT_MAC
]]

-- config
local whitelist = {CLIENTOS_WINDOWS, CLIENTOS_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
 
Thanks! for my flash client.. uussefull! 👏 dont need to code the sources! 🔥

Lua:
local whitelist = {CLIENTOS_FLASH}
 
Thanks for the contribution.
I'm bookmarking this for further reference.
 
when i add in whitelist CLIENTOS_OTCLIENTV8_WINDOWS or linux or mac it still kicks me from it, it is already added in my source files
 
I tried it on my server which is based on tfs 1.2 but it doesn't seem to work. When I set: local whitelist = {CLIENTOS_WINDOWS}, in whitelist, I can still log in normally using OtclientV8. What if I resolve to "CLIENTOS_OTCLIENT_WINDOWS"

is:


"
Sasuke has logged in.

Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/client_control.lua:eek:nThink
data/creaturescripts/scripts/client_control.lua:41: attempt to call global 'ModalWindow' (a nil value)
stack traceback:
[C]: in function 'ModalWindow'
data/creaturescripts/scripts/client_control.lua:41: in function <data/creaturescripts/scripts/client_control.lua:36>
"
 
This script allows you to prevent players from playing clients that aren't whitelisted by the script
preview:
G2qtkg1.png


creaturescripts.xml:
XML:
    <event type="login" name="clientControlLogin" script="client_control.lua" />
    <event type="think" name="clientControl" interval="5000" script="client_control.lua" />

creaturescripts/scripts/client_control.lua:
Lua:
--[[
    available clients to whitelist:
    CLIENTOS_LINUX
    CLIENTOS_WINDOWS
    CLIENTOS_FLASH
    CLIENTOS_OTCLIENT_LINUX
    CLIENTOS_OTCLIENT_WINDOWS
    CLIENTOS_OTCLIENT_MAC
]]

-- config
local whitelist = {CLIENTOS_WINDOWS, CLIENTOS_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

Can anyone do this revscriptsys?
 
Revscript way:

data/scripts/blockClient.lua
Lua:
--[[
    available clients to whitelist:
    CLIENTOS_LINUX
    CLIENTOS_WINDOWS
    CLIENTOS_FLASH
    CLIENTOS_OTCLIENT_LINUX
    CLIENTOS_OTCLIENT_WINDOWS
    CLIENTOS_OTCLIENT_MAC
]]

-- config
local msg = "This game client is not supported on the server."
local allowedClients = {CLIENTOS_WINDOWS, CLIENTOS_LINUX}

local creatureEvent = CreatureEvent("clientControlOnLogin")

function creatureEvent.onLogin(player)
    player:registerEvent("clientControlOnThink")
    return true
end

creatureEvent:register()

creatureEvent = CreatureEvent("clientControlOnThink")

function creatureEvent.onThink(player, interval)
    local clientType = player:getClient().os
    local allowedClient = allowedClients[clientType]
    if not allowedClient then
        if table.contains({CLIENTOS_WINDOWS, CLIENTOS_LINUX}, clientType) then
            -- tibia client
            local m = ModalWindow()
            m:setTitle("Error")
            m:setMessage(msg)
            m:addButton(1, "ok")
            m:sendToPlayer(player)
            addEvent(function (pid)
                local player = Player(pid)
                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, 100, player:getId())
        else
            -- ot client
            local m = NetworkMessage()
            m:addByte(0x14)
            m:addString(msg)
            m:sendToPlayer(player)
        end
    end
    return true
end

creatureEvent:register()

Only clients that are on the list of allowedClients are the ones you can enter the game with him
Notes: for some strange reason OTCv8 indicates that the system is CLIENTOS_WINDOWS instead of CLIENTOS_OTCLIENT_WINDOWS on windows, so keep this in mind
 
Revscript way:

data/scripts/blockClient.lua
Lua:
--[[
    available clients to whitelist:
    CLIENTOS_LINUX
    CLIENTOS_WINDOWS
    CLIENTOS_FLASH
    CLIENTOS_OTCLIENT_LINUX
    CLIENTOS_OTCLIENT_WINDOWS
    CLIENTOS_OTCLIENT_MAC
]]

-- config
local msg = "This game client is not supported on the server."
local allowedClients = {CLIENTOS_WINDOWS, CLIENTOS_LINUX}

local creatureEvent = CreatureEvent("clientControlOnLogin")

function creatureEvent.onLogin(player)
    player:registerEvent("clientControlOnThink")
    return true
end

creatureEvent:register()

creatureEvent = CreatureEvent("clientControlOnThink")

function creatureEvent.onThink(player, interval)
    local clientType = player:getClient().os
    local allowedClient = allowedClients[clientType]
    if not allowedClient then
        if table.contains({CLIENTOS_WINDOWS, CLIENTOS_LINUX}, clientType) then
            -- tibia client
            local m = ModalWindow()
            m:setTitle("Error")
            m:setMessage(msg)
            m:addButton(1, "ok")
            m:sendToPlayer(player)
            addEvent(function (pid)
                local player = Player(pid)
                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, 100, player:getId())
        else
            -- ot client
            local m = NetworkMessage()
            m:addByte(0x14)
            m:addString(msg)
            m:sendToPlayer(player)
        end
    end
    return true
end

creatureEvent:register()

Only clients that are on the list of allowedClients are the ones you can enter the game with him
Notes: for some strange reason OTCv8 indicates that the system is CLIENTOS_WINDOWS instead of CLIENTOS_OTCLIENT_WINDOWS on windows, so keep this in mind
Which client should I put on the list so that they can only use client 12.61?
 
Back
Top