function onSendRpc(id, data, size)
if id == 25 then
bs = bitStreamInit(data, size)
bitStreamSetReadOffset(bs, 40) -- ну ачо лишний раз version и mod читать
local data = {
nickname = bitStreamReadString(bs, bitStreamReadByte(bs)),
challengeResponse = bitStreamReadDWord(bs),
joinAuthKey = bitStreamReadString(bs, bitStreamReadByte(bs)),
clientVer = bitStreamReadString(bs, bitStreamReadByte(bs)),
challengeResponse2 = bitStreamReadDWord(bs)
}
bitStreamDelete(bs)
bs = bitStreamNew()
bitStreamWriteDWord(bs, 4057) -- version
bitStreamWriteByte(bs, 1) -- mod
bitStreamWriteString(bs, data.nickname, string.len(data.nickname)) -- nickname
bitStreamWriteDWord(bs, data.challengeResponse) -- challenheResponse
bitStreamWriteString(bs, data.joinAuthKey, string.len(data.joinAuthKey)) -- authkey
bitStreamWriteString(bs, data.clientVer, string.len(data.clientVer)) -- clientVer
bitStreamWriteDWord(bs, data.challengeResponse2)
return {id, bs, bitStreamSize(bs)}
end
end