Информация MoonLoader - обсуждение

James Hawk

Известный
919
217
Юзаю прорисовку lua рендера. В логе флудит - RegisterCommand Error: Command "haphud" already exists
Почему флудит? Подскажите. В других скриптах такой команды точно нет
Lua:
local active=0

function main()
if not isSampLoaded() or not isSampfuncsLoaded() then return end
while not isSampAvailable() do wait(100) end

while true do wait(0)
        while not isPlayerPlaying(PLAYER_HANDLE) do wait(0) end
        sampRegisterChatCommand("haphud", cmd_draw)
        if active==1 then
        ...
        end
end
end

function cmd_draw()
    if active==1 then
        active=0
    else
        active=1
    end
end
 
Последнее редактирование:

AnWu

Guardian of Order
Всефорумный модератор
4,699
5,220
Юзаю прорисовку lua рендера. В логе флудит - RegisterCommand Error: Command "haphud" already exists
Почему флудит? Подскажите
Lua:
local active=0

function main()
if not isSampLoaded() or not isSampfuncsLoaded() then return end
while not isSampAvailable() do wait(100) end

while true do wait(0)
        while not isPlayerPlaying(PLAYER_HANDLE) do wait(0) end
        sampRegisterChatCommand("haphud", cmd_draw)
        if active==1 then
        ...
        end
end
end

function cmd_draw()
    if active==1 then
        active=0
    else
        active=1
    end
end
А нахера ты в цикле регаешь команду то? Кто научил?
 

James Hawk

Известный
919
217
У всех работает, а ты особенный такой. Лог скинь
В логе флуд прекратился, но по вводу команды ничего не происходит
Код:
[22:02:48.925404] (script)    ML-AutoReboot: Loading 'D:\Games\GTA SA New One\moonloader\hp-armour hud.lua'...
[22:02:48.926404] (system)    Loading script 'D:\Games\GTA SA New One\moonloader\hp-armour hud.lua'...
[22:02:48.926404] (debug)    New script: 23E6AF6C
[22:02:48.930402] (system)    Numeric HP/AP on player: Loaded successfully.
[22:02:48.936402] (debug)    Add thread 32823F0D to SCM-thread queue
[22:02:48.936402] (system)    Numeric HP/AP on player: Script terminated. (23E6AF6C)
[22:02:48.936402] (debug)    Remove thread 32823F0D from SCM-thread queue
 

AnWu

Guardian of Order
Всефорумный модератор
4,699
5,220
В логе флуд прекратился, но по вводу команды ничего не происходит
Код:
[22:02:48.925404] (script)    ML-AutoReboot: Loading 'D:\Games\GTA SA New One\moonloader\hp-armour hud.lua'...
[22:02:48.926404] (system)    Loading script 'D:\Games\GTA SA New One\moonloader\hp-armour hud.lua'...
[22:02:48.926404] (debug)    New script: 23E6AF6C
[22:02:48.930402] (system)    Numeric HP/AP on player: Loaded successfully.
[22:02:48.936402] (debug)    Add thread 32823F0D to SCM-thread queue
[22:02:48.936402] (system)    Numeric HP/AP on player: Script terminated. (23E6AF6C)
[22:02:48.936402] (debug)    Remove thread 32823F0D from SCM-thread queue
и код полностью
 

James Hawk

Известный
919
217
и код полностью
Lua:
local active=0

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end
   
    while not isPlayerPlaying(PLAYER_HANDLE) do
            wait(0)
    end
            sampRegisterChatCommand("haphud", cmd_draw)
            if active==1 then
                    useRenderCommands(true)
                    setTextCentre(true)
                    setTextScale(0.5, 0.5)
                    setTextColour(255, 20, 0, 255)
                    setTextEdge(1, 0, 0, 0, 255)
                    displayTextWithNumber(320.0, 280.0, 'NUMBER', getCharHealth(PLAYER_PED))
                    if getCharArmour(PLAYER_PED) > 0 then
                        setTextCentre(true)
                        setTextScale(0.5, 0.5)
                        setTextColour(0, 50, 255, 255)
                        setTextEdge(1, 0, 0, 0, 255)
                        displayTextWithNumber(320.0, 270.0, 'NUMBER', getCharArmour(PLAYER_PED))
                    end
            end
   
    -- while true do wait(0)
           
    -- end
end

function cmd_draw()
    if active==1 then
        active=0
    else
        active=1
    end
end
 

AnWu

Guardian of Order
Всефорумный модератор
4,699
5,220
Lua:
local active=0

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end
  
    while not isPlayerPlaying(PLAYER_HANDLE) do
            wait(0)
    end
            sampRegisterChatCommand("haphud", cmd_draw)
            if active==1 then
                    useRenderCommands(true)
                    setTextCentre(true)
                    setTextScale(0.5, 0.5)
                    setTextColour(255, 20, 0, 255)
                    setTextEdge(1, 0, 0, 0, 255)
                    displayTextWithNumber(320.0, 280.0, 'NUMBER', getCharHealth(PLAYER_PED))
                    if getCharArmour(PLAYER_PED) > 0 then
                        setTextCentre(true)
                        setTextScale(0.5, 0.5)
                        setTextColour(0, 50, 255, 255)
                        setTextEdge(1, 0, 0, 0, 255)
                        displayTextWithNumber(320.0, 270.0, 'NUMBER', getCharArmour(PLAYER_PED))
                    end
            end
  
    -- while true do wait(0)
          
    -- end
end

function cmd_draw()
    if active==1 then
        active=0
    else
        active=1
    end
end
Закрой тему, и читай https://blast.hk/threads/22707/
 
  • Нравится
Реакции: #Northn

Azller Lollison

я узбек
Друг
1,343
2,271
В логе флуд прекратился, но по вводу команды ничего не происходит
Код:
[22:02:48.925404] (script)    ML-AutoReboot: Loading 'D:\Games\GTA SA New One\moonloader\hp-armour hud.lua'...
[22:02:48.926404] (system)    Loading script 'D:\Games\GTA SA New One\moonloader\hp-armour hud.lua'...
[22:02:48.926404] (debug)    New script: 23E6AF6C
[22:02:48.930402] (system)    Numeric HP/AP on player: Loaded successfully.
[22:02:48.936402] (debug)    Add thread 32823F0D to SCM-thread queue
[22:02:48.936402] (system)    Numeric HP/AP on player: Script terminated. (23E6AF6C)
[22:02:48.936402] (debug)    Remove thread 32823F0D from SCM-thread queue
Lua:
function main()
    while not isSampAvailable() do wait(0) end -- проверяем что самп загрузился
    sampRegisterChatCommand("haphud", --[[функцию можно указывать и так]]function() --регаем команду
        active = not active;
        sampAddChatMessage(active and "Activated" or "Deactivated", -1); --Выводим состояние переменной
    end)
    while true do wait(0)
        if active then
            --put you code there
        end
    end
end