function main()
sampRegisterChatCommand('spawnplayer', function(arg) -- заспавнить игрока
if sampIsPlayerConnected(arg) then
local x, y, z = getCharCoordinates(PLAYER_PED)
local angle = getCharHeading(PLAYER_PED)
local bs = raknetNewBitStream()
raknetBitStreamWriteInt16(bs, arg)
raknetBitStreamWriteInt8(bs, 1)
raknetBitStreamWriteInt32(bs, 20)
raknetBitStreamWriteFloat(bs, x)
raknetBitStreamWriteFloat(bs, y)
raknetBitStreamWriteFloat(bs, z)
raknetBitStreamWriteFloat(bs, angle)
raknetBitStreamWriteInt32(bs, 0xFFFFFFFF)
raknetBitStreamWriteInt8(bs, 20)
raknetEmulRpcReceiveBitStream(32, bs)
raknetDeleteBitStream(bs)
else
sampAddChatMessage('Даун, игрока нет', -1)
end
end)
sampRegisterChatCommand('connectp', function(arg) -- подключить игрока с ником
id, name = string.match(arg, '(.+) (.+)') -- аргументы - ид и имя
bs = raknetNewBitStream()
raknetBitStreamWriteInt16(bs, id)
raknetBitStreamWriteInt32(bs, 0)
raknetBitStreamWriteInt8(bs, 0)
raknetBitStreamWriteInt8(bs, #name)
raknetBitStreamWriteString(bs, name)
raknetEmulRpcReceiveBitStream(137, bs)
raknetDeleteBitStream(bs)
sampAddChatMessage('Connect', -1)
bs = raknetNewBitStream()
raknetBitStreamWriteInt16(bs, id)
raknetBitStreamWriteInt32(bs, 0)
raknetBitStreamWriteInt32(bs, 50)
raknetEmulRpcReceiveBitStream(155, bs)
raknetDeleteBitStream(bs)
end)
wait(-1)
end