Yes, you can use extended opcodes to send a custom packet from the server to the client and vice-versa.
When you want to trigger this thing (whatever it is that you're triggering), you send a packet to the client; and on the client side, you make a function that receives this packet. Inside of this function, you write whatever you want the client to do when this packet is received. You can also insert data into your packet which will be received by the client, and then you can unpack this data there and use it if needed as well.
If you don't have extended opcode handling in your server, you can start by
implementing this.
Then you can use this function to send stuff to the client.
Lua:
doSendPlayerExtendedOpcode(cid, opcode, buffer)
In the client, you can register it via:
Lua:
ProtocolGame.registerExtendedOpcode(ExtendedID, functionName)
,
Where functionName is the function that will be called when this ID is received.
You also have to unregister it onGameEnd with:
Lua:
ProtocolGame.unregisterExtendedOpcode(ExtendedID, true)
And here's an example of a function that calls the openWindow function from a module called game_promotion:
Lua:
function OpenVocationWindow()
modules.game_promotion.openWindow()
end
Make sure that opcodes which you add are not conflicting with existing ones, you can find them in your server and client sources in protocol related files.