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

Lua Im looking for good principles or good way to work with ExtendedOpcode

OTAmator

Member
Joined
May 4, 2016
Messages
60
Reaction score
8
Hi, im thinking if there is any better way of sending op codes. I will show u examples of my code. I would appreciate any advice and tips.

atm im doing something like this on server side:
Lua:
if json_data.action == "action1" then
     -- some code
elseif json_data.action == "action2" then
     -- some code
elseif json_data.action == "action3" then
     -- some code
end

On client side doing this way:
Code:
local data = {
    action = "action1",
    taskId = taskId
}
protocolGame:sendExtendedOpcode(15, json.encode(data))

In addition if im using for example action1 in few places. Some times im sending opcodes twice in one if statement for example im sendOpCode for action1 and action2. Im wondering if i should always force it to one ExtentedOpcode.
 
Back
Top