Forums WoW Modding Support Archives Azerothcore Discord Archives [DiscordArchive] When the server sends a packet to the client and I use Eluna's WorldPacket method, how can I retriev

[DiscordArchive] When the server sends a packet to the client and I use Eluna's WorldPacket method, how can I retriev

[DiscordArchive] When the server sends a packet to the client and I use Eluna's WorldPacket method, how can I retriev

rektbyfaith
Administrator
0
11-29-2023, 03:29 PM
#1
Archived author: mateo • Posted: 2023-11-29T15:29:19.325000+00:00
Original source

When the server sends a packet to the client and I use Eluna's WorldPacket method, how can I retrieve the data inside?
rektbyfaith
11-29-2023, 03:29 PM #1

Archived author: mateo • Posted: 2023-11-29T15:29:19.325000+00:00
Original source

When the server sends a packet to the client and I use Eluna's WorldPacket method, how can I retrieve the data inside?

rektbyfaith
Administrator
0
11-29-2023, 03:29 PM
#2
Archived author: mateo • Posted: 2023-11-29T15:29:54.803000+00:00
Original source

```lua
local function HandlePacket(event, packet, player)
local opcode = packet:GetOpcode()
local size = packet:GetSize()

local data = packet:GetData()

print("Received packet - opcode: " .. opcode .. ", size: " .. size)

local playerName = packet:ReadString()


local playerLevel = packet:ReadUInt8()


local playerHealth = packet:ReadFloat()

--Can we obtain a structure?
local customData = packet:ReadStruct(MyCustomStruct)

local responsePacket = WorldPacket(CUSTOM_OPCODE)
responsePacket:WriteString("Hello, " .. playerName)
player:SendPacket(responsePacket)
end

RegisterPacketEvent(0x019F, 7, HandlePacket)
```
rektbyfaith
11-29-2023, 03:29 PM #2

Archived author: mateo • Posted: 2023-11-29T15:29:54.803000+00:00
Original source

```lua
local function HandlePacket(event, packet, player)
local opcode = packet:GetOpcode()
local size = packet:GetSize()

local data = packet:GetData()

print("Received packet - opcode: " .. opcode .. ", size: " .. size)

local playerName = packet:ReadString()


local playerLevel = packet:ReadUInt8()


local playerHealth = packet:ReadFloat()

--Can we obtain a structure?
local customData = packet:ReadStruct(MyCustomStruct)

local responsePacket = WorldPacket(CUSTOM_OPCODE)
responsePacket:WriteString("Hello, " .. playerName)
player:SendPacket(responsePacket)
end

RegisterPacketEvent(0x019F, 7, HandlePacket)
```

Recently Browsing
 1 Guest(s)
Recently Browsing
 1 Guest(s)