local prefix = "{FFFF00}[CTO] {FFFFFF}"
local act = false
local states = {
ban = false,
bun = false,
gun = false,
zun = false,
kun = false
}
function main()
while not isSampAvailable() do wait(0) end
sampRegisterChatCommand('cto', function()
act = not act
sampAddChatMessage(prefix .. (act and "Включен" or "Выключен"), -1)
end)
while true do
wait(0)
if act then
local actionMap = {bun = 1, gun = 2, zun = 3, kun = 4}
for key, value in pairs(states) do
if value and actionMap[key] then
sendClick("@22, action" .. key:sub(1, 1):upper() .. key:sub(2) .. ", " .. actionMap[key])
wait(150)
end
end
end
end
end
function onReceivePacket(id, bs)
if act and id == 220 then
raknetBitStreamIgnoreBits(bs, 8)
if raknetBitStreamReadInt8(bs) == 17 then
raknetBitStreamIgnoreBits(bs, 32)
local str = raknetBitStreamReadString(bs, raknetBitStreamReadInt32(bs))
states.ban = str:find("vue%.set") and str:find('serviceStationChangeOil')
states.bun = str:find("vue%.set") and str:find("serviceStationTireFittingView") and str:find("%[0,0,0,0%]")
states.gun = str:find("vue%.set") and str:find("serviceStationTireFittingView") and str:find("%[1,0,0,0%]")
states.zun = str:find("vue%.set") and str:find("serviceStationTireFittingView") and str:find("%[1,1,0,0%]")
states.kun = str:find("vue%.set") and str:find("serviceStationTireFittingView") and str:find("%[1,1,1,0%]")
if str:find('vue%.call') and str:find("progressBar/updateData") then
sendClick("@24, pressKey")
end
end
end
end
function sendClick(str)
local bs = raknetNewBitStream()
raknetBitStreamWriteInt8(bs, 220) -- packet id
raknetBitStreamWriteInt8(bs, 18) -- packet type
raknetBitStreamWriteInt8(bs, #str) -- str len
raknetBitStreamWriteInt8(0)
raknetBitStreamWriteInt8(0)
raknetBitStreamWriteInt8(0)
raknetBitStreamWriteString(bs, str)
raknetBitStreamWriteInt32(bs, 0)
raknetBitStreamWriteInt8(0)
raknetBitStreamWriteInt8(0)
raknetSendBitStreamEx(bs, 2, 9, 6)
raknetDeleteBitStream(bs)
end