как добавить вкл/выкл скрипта?

VgrxTxch

Известный
Автор темы
1,156
327
Версия MoonLoader
.026-beta
я в луа полный ноль, нашёл код скрипта, который отключает гэнг зоны банд, но при входе в игру он по умолчанию включён, редко бывают случаи, когда нужного его отключить, но у меня никак не получалось это сделать (и если удалить этот скрипт, перезагрузить все их через CTRL + R, то всё равно гэнг зоны не появляются). и хотел бы узнать, как это можно сделать?

код скрипта:
function onReceiveRpc(id, bitStream)
    if id == 121 then return false end -- RPC_ScrGangZoneFlash
    if id == 85 then return false end -- RPC_ScrGangZoneStopFlash
    if id == 108 then return false end -- RPC_ScrGangZoneCreate
    if id == 120 then return false end -- RPC_ScrGangZoneDestroy
end

function main()
    while not isSampAvailable() do wait(0) end
    wait(-1)
end
 

chapo

tg/inst: @moujeek
Всефорумный модератор
9,097
12,126
Lua:
local active = false

function main()
    while not isSampAvailable() do wait(0) end
    sampRegisterChatCommand('offgang', function()
        active = not active
        sampAddChatMessage(active and 'on' or 'off', -1)
    end)
    wait(-1)
end

function onReceiveRpc(id, bitStream)
    if id == 121 then return false end -- RPC_ScrGangZoneFlash
    if id == 85 then return false end -- RPC_ScrGangZoneStopFlash
    if id == 108 then return false end -- RPC_ScrGangZoneCreate
    if id == 120 then return false end -- RPC_ScrGangZoneDestroy
end
 

VgrxTxch

Известный
Автор темы
1,156
327
Lua:
local active = false

function main()
    while not isSampAvailable() do wait(0) end
    sampRegisterChatCommand('offgang', function()
        active = not active
        sampAddChatMessage(active and 'on' or 'off', -1)
    end)
    wait(-1)
end

function onReceiveRpc(id, bitStream)
    if id == 121 then return false end -- RPC_ScrGangZoneFlash
    if id == 85 then return false end -- RPC_ScrGangZoneStopFlash
    if id == 108 then return false end -- RPC_ScrGangZoneCreate
    if id == 120 then return false end -- RPC_ScrGangZoneDestroy
end
не работает =(
 

Shepard

Активный
457
88
Lua:
local active = false

function main()
    while not isSampAvailable() do wait(0) end
    sampRegisterChatCommand('offgang', function()
        active = not active
        sampAddChatMessage(active and 'on' or 'off', -1)
    end)
    wait(-1)
end

function onReceiveRpc(id, bitStream)
    if id == 121 then return false end -- RPC_ScrGangZoneFlash
    if id == 85 then return false end -- RPC_ScrGangZoneStopFlash
    if id == 108 then return false end -- RPC_ScrGangZoneCreate
    if id == 120 then return false end -- RPC_ScrGangZoneDestroy
end
Lua:
local active = false

function main()
    while not isSampAvailable() do wait(0) end
    sampRegisterChatCommand('offgang', function()
        active = not active
        sampAddChatMessage(active and 'on' or 'off', -1)
    end)
    wait(-1)
end

function onReceiveRpc(id, bitStream)
    if active then
        if id == 121 then return false end -- RPC_ScrGangZoneFlash
        if id == 85 then return false end -- RPC_ScrGangZoneStopFlash
        if id == 108 then return false end -- RPC_ScrGangZoneCreate
        if id == 120 then return false end -- RPC_ScrGangZoneDestroy
    end
end
 

VgrxTxch

Известный
Автор темы
1,156
327
Lua:
local active = false

function main()
    while not isSampAvailable() do wait(0) end
    sampRegisterChatCommand('offgang', function()
        active = not active
        sampAddChatMessage(active and 'on' or 'off', -1)
    end)
    wait(-1)
end

function onReceiveRpc(id, bitStream)
    if active then
        if id == 121 then return false end -- RPC_ScrGangZoneFlash
        if id == 85 then return false end -- RPC_ScrGangZoneStopFlash
        if id == 108 then return false end -- RPC_ScrGangZoneCreate
        if id == 120 then return false end -- RPC_ScrGangZoneDestroy
    end
end
а так скрипт вообще не работает
 

Shepard

Активный
457
88
а так скрипт вообще не работает
Lua:
function main()
    while not isSampAvailable() do wait(0) end
    sampRegisterChatCommand('offgang', function()
        active = not active
        sampAddChatMessage(active and 'on' or 'off', -1)
    end)
    wait(-1)
end

function onReceiveRpc(id, bitStream)
    if id == 121 and active then return false end -- RPC_ScrGangZoneFlash
    if id == 85 and active then return false end -- RPC_ScrGangZoneStopFlash
    if id == 108 and active then return false end -- RPC_ScrGangZoneCreate
    if id == 120 and active then return false end -- RPC_ScrGangZoneDestroy
end
Или же так попробуй
 

chapo

tg/inst: @moujeek
Всефорумный модератор
9,097
12,126
Lua:
function main()
    while not isSampAvailable() do wait(0) end
    sampRegisterChatCommand('offgang', function()
        active = not active
        sampAddChatMessage(active and 'on' or 'off', -1)
    end)
    wait(-1)
end

function onReceiveRpc(id, bitStream)
    if id == 121 and active then return false end -- RPC_ScrGangZoneFlash
    if id == 85 and active then return false end -- RPC_ScrGangZoneStopFlash
    if id == 108 and active then return false end -- RPC_ScrGangZoneCreate
    if id == 120 and active then return false end -- RPC_ScrGangZoneDestroy
end
Или же так попробуй
может скажем ему что по умолчанию скрипт оффнут?
 

VgrxTxch

Известный
Автор темы
1,156
327
Lua:
function main()
    while not isSampAvailable() do wait(0) end
    sampRegisterChatCommand('offgang', function()
        active = not active
        sampAddChatMessage(active and 'on' or 'off', -1)
    end)
    wait(-1)
end

function onReceiveRpc(id, bitStream)
    if id == 121 and active then return false end -- RPC_ScrGangZoneFlash
    if id == 85 and active then return false end -- RPC_ScrGangZoneStopFlash
    if id == 108 and active then return false end -- RPC_ScrGangZoneCreate
    if id == 120 and active then return false end -- RPC_ScrGangZoneDestroy
end
Или же так попробуй
при входе в игру зоны не удалены, пишу /offgang, ничего не меняется