tiag0_bn
Well-Known Member
- Joined
- Dec 8, 2011
- Messages
- 181
- Reaction score
- 50
hello, i need help to fix opcode in otx2
i pay 10usd or 50,00
Hello community, I'm having problems calling the opcode... could anyone help me?
otcv8
i pay 10usd or 50,00
Hello community, I'm having problems calling the opcode... could anyone help me?
Server Side
Extended Opcodes (Server Side)
Extended opcodes is a system to allow adding new opcodes to game protocol using just lua scripts in both client and server sides, thus making easy to implement new client/server side features independently of the game cor made in C++. Just one opcode is supported at the moment, the 0x01 which is...otland.net
lua script
<event type="extendedopcode" name="ExtendedOpcode" event="script" value="opcodes.lua"/>```
local COINS_OPCODE = 70
function onExtendedOpcode(player, opcode, buffer)
if opcode == COINS_OPCODE then
local accountPoints = getAccountPoints(cid)
doSendPlayerExtendedOpcode(cid, COINS_OPCODE, tostring(accountPoints))
else
-- other opcodes can be ignored, and the server will just work fine...
end
end
function getAccountPoints(accountId)
local res = db.getResult("SELECTpremium_points
FROMaccounts
WHEREid
= " .. accountId .. ";")
local points = 0
if res:getID() ~= -1 then
points = res:getDataInt("premium_points")
res:free()
end
return points
end
login
registerCreatureEvent(cid, "ExtendedOpcode")
otcv8
function coinsBalance(protocol, opcode, buffer)
local balanceLabel = storeWindow:getChildById('balanceInfo'):getChildById('coinBalance')
balanceLabel:setText(formatNumbers(buffer))
end
COINS_OPCODE = 70