- 551
- 442
- Версия SA-MP
-
- Другая
Мне в ракботе нужно было найти альтернативу команды getAllVehicles(), и понял что надо использовать onRecvRpc 164, но я получаю данные о авто только при появлении самого этого авто, а я хочу в любой момент получить массив данных о всех авто, как такое реализовать?
Lua:
function onRecvRpc(id, data, size)
if id == 164 then
bs = bitStreamInit(data, size)
data = {}
data.vehId = bitStreamReadWord(bs) -- [UINT16]
data.modelId = bitStreamReadDWord(bs) -- [UINT32]
data.position = {x = bitStreamReadFloat(bs), y = bitStreamReadFloat(bs), z = bitStreamReadFloat(bs)}-- [FLOAT]
data.angle = bitStreamReadFloat(bs) -- [FLOAT]
data.color1 = bitStreamReadByte(bs) -- [UINT8]
data.color2 = bitStreamReadByte(bs) -- [UINT8]
data.health = bitStreamReadFloat(bs) -- [FLOAT]
data.interior = bitStreamReadByte(bs) -- [UINT8]
data.doorDamageStatus = bitStreamReadDWord(bs) -- [UINT32]
data.panelDamageStatus = bitStreamReadDWord(bs) -- [UINT32]
data.lightDamageStatus = bitStreamReadByte(bs) -- [UINT8]
data.tireDamageStatus = bitStreamReadByte(bs) -- [UINT8]
data.addsiren = bitStreamReadByte(bs) -- [UINT8]
data.modslot0 = bitStreamReadByte(bs) -- [UINT8]
data.modslot1 = bitStreamReadByte(bs) -- [UINT8]
data.modslot2 = bitStreamReadByte(bs) -- [UINT8]
data.modslot3 = bitStreamReadByte(bs) -- [UINT8]
data.modslot4 = bitStreamReadByte(bs) -- [UINT8]
data.modslot5 = bitStreamReadByte(bs) -- [UINT8]
data.modslot6 = bitStreamReadByte(bs) -- [UINT8]
data.modslot7 = bitStreamReadByte(bs) -- [UINT8]
data.modslot8 = bitStreamReadByte(bs) -- [UINT8]
data.modslot9 = bitStreamReadByte(bs) -- [UINT8]
data.modslot10 = bitStreamReadByte(bs) -- [UINT8]
data.modslot11 = bitStreamReadByte(bs) -- [UINT8]
data.modslot12 = bitStreamReadByte(bs) -- [UINT8]
data.modslot13 = bitStreamReadByte(bs) -- [UINT8]
data.paintJob = bitStreamReadByte(bs) -- [UINT8]
data.bodyColor1 = bitStreamReadDWord(bs) -- [UINT32]
data.bodyColor2 = bitStreamReadDWord(bs) -- [UINT32]
onVehicleStreamIn(data)
end
end