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

sending OpCode to server

Dubler

PHP, LUA, C++
Joined
Aug 3, 2009
Messages
268
Reaction score
11
Location
Poland
I wrote simple button function:
Code:
function buySet()
	local message = table.serialize({currentOutfit,outfit.addons})
	print("sent: ".. message) -- works great
	ProtocolGame.sendExtendedOpcode(0x4,message)  -- just 4 doesn't work too
	destroy()
end
and here's the error:

sent: {[1] = 1, [2] = 2}
ERROR: protected lua call failed: LUA ERROR:
C++ call failed: LUA ERROR: attempt to cast a 'string' lua value to 'unsigned char'
stack traceback:
[C]: ?
[C]: in function 'sendExtendedOpcode'
/opTest/opTest.lua:30: in function 'buySet'
...opTest/opTest.otui:23: [@onClick]:2: in function <...alOutfitShop/opTest.otui:23: [@onClick]:1>
stack traceback:
[C]: ?
[C]: in function 'sendExtendedOpcode'
/opTest/opTest.lua:30: in function 'buySet'
...opTest/opTest.otui:23: [@onClick]:2: in function <...alOutfitShop/opTest.otui:23: [@onClick]:1>
wtf? in source there are uint8_t and string, there's no unsigned char
 
Try changing:
Lua:
ProtocolGame.sendExtendedOpcode(0x4, message)

with:
Lua:
local protocol = g_game.getProtocolGame()
if protocol then
    protocol:sendExtendedOpcode(0x4, message)
end
 
Back
Top