local json = require('cjson')
function main()
repeat wait(0) until isSampAvailable()
addEventHandler('onReceivePacket', function(id, bs)
if id == 220 then
raknetBitStreamIgnoreBits(bs, 8)
if raknetBitStreamReadInt8(bs) == 17 then
raknetBitStreamIgnoreBits(bs, 32)
local length = raknetBitStreamReadInt16(bs)
local encoded = raknetBitStreamReadInt8(bs)
if length > 0 then
local text = (encoded ~= 0) and raknetBitStreamDecodeString(bs, length + encoded) or raknetBitStreamReadString(bs, length)
local event, body = text:match('window%.executeEvent%(\'(.+)\',%s*`%[(.+)%]`%);')
if event == 'event.documents.inititalizeData' then
local data = json.decode(body)
local document_type = data['type']
if document_type == 1 then
local nick = data['name']
local sex = data['sex']
local birthday = data['birthday']
local level = data['level']
elseif document_type == 2 then
local licenses = data['info']
for k, v in pairs(licenses) do
local license = v['license']
local date_text = v['date_text']
local available = v['available']
end
elseif document_type == 4 then
local nick = data['name']
local zavisimost = data['zavisimost']
end
end
end
end
end
end)
end