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

ExtendedOpcode TFS 1.3

tuxico

Member
Joined
Aug 2, 2010
Messages
52
Solutions
1
Reaction score
7
Extended Opcodes are running on TFS 1.3?
Give me examples of how to use, both trying and nothing ...

Client Files

teste.lua
Lua:
function init()
ProtocolGame.registerExtendedOpcode(98, teste)
function terminate()
ProtocolGame.unregisterExtendedOpcode(98)

function teste(protocol, opcode, buffer)
print(buffer)
end

Server Files
Lua:
function onExtendedOpcode(player, opcode, buffer)
   if opcode == OPCODE_LANGUAGE then
       -- otclient language
       if buffer == 'en' or buffer == 'pt' then
           -- example, setting player language, because otclient is multi-language...
           -- player:setStorageValue(SOME_STORAGE_ID, SOME_VALUE)
       end
   else
       -- other opcodes can be ignored, and the server will just work fine...
   end
  
   if opcode == 98 then
       if buffer == 9999 then
           player:sendExtendedOpcode(98, 9999)
       end
   end
end
Talkaction
Lua:
function onSay(player, words, param)
       player:sendExtendedOpcode(player, 98, 9999)
       return print("Opcode Enviado")
end
 
Back
Top