Server:Packet.readUInt32 Server function
Jump to navigation
Jump to search
This function was added in version: 0.0.3.0 |
Get number from packet. [4 bytes]
Syntax
int Packet.readUInt32()
Returns
- number in range 0-4294967295;
Example
Server
const PLAYERS_AMOUNT_PACKET = 1002,
function sendPlayersAmount(id)
{
local packet = Packet();
packet.writeUInt16(PLAYERS_AMOUNT_PACKET);
packet.writeUInt32(getPlayersCount());
packet.send(id);
}
Client
const PLAYERS_AMOUNT_PACKET = 1002,
local function onPacket(packet)
{
switch(packet.readUInt16())
{
case PLAYERS_AMOUNT_PACKET:
{
chat.newMessage(format("Players in game: %d", packet.readUInt32));
}
break;
}
}
addEventHandler("onPacket", onPacket);
Related functions
- Packet.send
- Packet.sendToAll
- Packet.reset
- Packet.writeBool
- Packet.writeChar
- Packet.writeInt8
- Packet.writeUInt8
- Packet.writeInt16
- Packet.writeUInt16
- Packet.writeInt32
- Packet.writeUInt32
- Packet.writeFloat
- Packet.writeString
- Packet.readBool
- Packet.readChar
- Packet.readInt8
- Packet.readUInt8
- Packet.readInt16
- Packet.readUInt16
- Packet.readInt32
- Packet.readUInt32
- Packet.readFloat
- Packet.readString