Knight docs
EN ID
GitHub

Network Protocol

Wire format, RPC ids and compatibility notes.

Knight speaks the SA-MP 0.3.7 wire protocol, including the 0.3.DL additions. It is byte-compatible with the official client, so no client patch is needed.

Transport

Connection handshake

text
client                 server
  | OpenConnectionRequest1 -> |
  | <- OpenConnectionReply1   |
  | OpenConnectionRequest2 ->
  | <- OpenConnectionReply2   |  (cookie challenge)
  | ConnectionRequest      ->
  | <- AuthKey                |  (GPCI serial challenge)
  | AuthKey(response)      ->
  | <- ConnectionAccepted     |
  | NewIncomingConnection  ->
  | RPC_ClientJoin (25)    -> |  version, name, serial, version string
  | <- RPC_InitGame (139)     |  hostname, limits, vehicle models

Key RPCs

IdNameDirection
25ClientJoinclient → server
139InitGameserver → client
128 / 129RequestClass / RequestSpawnclient → server
52Spawnclient → server
101Chatclient → server
93ClientMessageserver → client
61 / 62ShowDialog / DialogResponseboth
153SetPlayerSkinserver → client
164 / 165WorldVehicleAdd / Removeserver → client
179ModelRequest (0.3.DL)server → client
183ModelUrl (0.3.DL redirect)server → client

Client versions

NumberClient
4057SA-MP 0.3.7
4062SA-MP 0.3.DL

Knight reads the version from ClientJoin and only sends custom-model RPCs to 0.3.DL clients. Older clients receive base models instead.

Text encoding

SA-MP strings are Windows-1252. Knight encodes gamemode UTF-8 strings to CP1252 on the wire and decodes incoming text back to UTF-8.