The pointer is where you write data that is actually going to be sent, im not sure what you were trying to do but there is nothing before the length and type, they are the start of the packet.
NET_MSG is the packet you send/receive which consists of header and the data it contains. Header contains the size of packet and also the type of the packet. This means that the first two bytes are the size and the next two bytes are the type of the message (packet).
First of all, scratch all those conversions to uint:
PHP Code:
P.WriteInt32((uint)(Weather_Intensity));
You're already passing the param Weather_Intensity as uint, no need to cast it to uint again. Oh and why are you doing (ushort)1016, it can already be counted as ushort since the value 1016 isn't magically going to change the type.
When creating a new instance of COPacket you can start writing the size/type and data to it immetiadly since it contains self incrementing counter/indexer. (WriteInt16 increases it by 2 and WriteInt32 by 4 and so on.)
public static COPacket Weather(byte Type, uint Intensity, uint Direction, uint Appearance)
{ byte[] Packet = new byte[28];
COPacket P = new COPacket(Packet); P.WriteInt16((ushort)(Packet.Length - 8));
P.WriteInt16(1016);
P.WriteInt16(Type);
P.WriteInt32(Intensity);
P.WriteInt32(Direction);
P.WriteInt32(Appearance);
return P;
}
[/code]
You gotta add 8 bytes for "TQServer" string. When the client receives a packet it verifies it's 8 last bytes, and if it's not TQServer the client will dc its self. Anyway, you don't need to add TQServer string when you build the packet(the string will be added when client.Send(COPacket) is accessed), but you need to give 8 bytes for the string in buffer.
Sorry, wrong conversion The packet type is 0x3f8 in hexadecimal, but it's 1016 in decimal, not 1017. And you need the TQServer at the end for new client.