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

OTClient GameExtendedOpcode otv8 tfs 1.5

bpm91

Intermediate OT User
Joined
May 23, 2019
Messages
931
Solutions
7
Reaction score
127
Location
Brazil
YouTube
caruniawikibr
I would like to know if anyone knows how I can make my tfs accept this function, in my terminal client it says that it is not making contact with tfs. could anyone help?
 
You have to do a "ping pong" with packet.
The Otclient needs to send a packet to the server, and then the server needs to send a reply packet to the Otclient.
Post automatically merged:

This is a script example made for Otclient to send and receive a packet from the server.
This packet will receive the value of a storage:
Lua:
-- init(): When starts the game
function init()
    connect(g_game, {
        onGameStart = playerLogin,
        onGameEnd = playerLogout,
    })
    ProtocolGame.registerExtendedOpcode(55, storageValueFromServer)

    return true
end

-- terminate(): When ends the game
function terminate()
    disconnect(g_game, {
        onGameStart = playerLogin,
        onGameEnd = playerLogout,
    })
    ProtocolGame.unregisterExtendedOpcode(55, true)

    return true
end

-- playerLogin(): When player's login
function playerLogin()
    update()

    return true
end

-- playerLogout(): When player's logout
function playerLogout()

    return true
end

function update()
    local player = g_game.getLocalPlayer()
    if player then
        local protocolGame = g_game.getProtocolGame()
        if protocolGame then
            protocolGame:sendExtendedOpcode(55, '')
        end

        scheduleEvent(update, 250)
    end

    return true
end

function storageValueFromServer(protocol, opcode, packet)
    print("The storage value is " .. packet)

    return true
end

And this is the server script, which will send a response packet containing the storage value to Otclient:
Lua:
function onExtendedOpcode(player, opcode, buffer)
    if opcode == 55 then
        local storageValue = player:getStorageValue(ATTR_STAMINA_STORAGE_ID)
        player:sendExtendedOpcode(EAT_OPCODE, tostring(storageValue))
    end
    return true
end
OpCode has to be the same as for Otclient. I used number 55 in this case.
 
Last edited:
Back
Top