Проблема в разработке скрипта

en0t

Потрачен
Автор темы
25
9
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Версия MoonLoader
.026-beta
Помогите решить проблему, не запускаетсяс сксрипт, что может быть не так.

code:
local act = false

function main()
    repeat wait(0) until isSampAvailable()
     sampAddChatMessage(string.format("[AutoNarko]: {FFFFFF} «Успешно загружен!"), 0xFF1493 )
      sampAddChatMessage(string.format("[AutoNarko]: {FFFFFF} «Автор скрипта: [en0t]"), 0xFF1493 )
      sampAddChatMessage(string.format("[AutoNarko]: {FFFFFF} «Активациџ скрипта: /nark"), 0xFF1493 )
   sampRegisterChatCommand('nark', function()
        enable = not enable
        if enable then
            sampAddChatMessage('[AutoNarko] ON, 0xFF1493)
        else
            sampAddChatMessage('{[AutoNarko] OFF, 0xFF1493)
        end
    end)
    while true do
        wait(0)
        if act then
            local lastHP = nil
while true do
if lastHP ~= nil and getCharHealth(PLAYER_PED) ~= lastHP then
sampSendChat("/usedrugs 3")
wait(1000)
end
lastHP = getCharHealth(PLAYER_PED)
                end    
            end
        end
    end
end
 
  • Нравится
Реакции: Yuriy Code

Ninthmoon

Известный
463
127
будь внимательнее и используй что-то лучше чем блокнот
Проблемы на первый взгляд:

Lua:
local act = false

function main()
    repeat wait(0) until isSampAvailable()
     sampAddChatMessage(string.format("[AutoNarko]: {FFFFFF} «Успешно загружен!"), 0xFF1493 )
      sampAddChatMessage(string.format("[AutoNarko]: {FFFFFF} «Автор скрипта: [en0t]"), 0xFF1493 )
      sampAddChatMessage(string.format("[AutoNarko]: {FFFFFF} «Активациџ скрипта: /nark"), 0xFF1493 )
   sampRegisterChatCommand('nark', function()
        enable = not enable
        if enable then
            sampAddChatMessage('[AutoNarko] ON, 0xFF1493)
        else
            sampAddChatMessage('{[AutoNarko] OFF, 0xFF1493)
        end
    end)
    while true do
        wait(0)
        if act then
            local lastHP = nil
while true do
if lastHP ~= nil and getCharHealth(PLAYER_PED) ~= lastHP then
sampSendChat("/usedrugs 3")
wait(1000)
end
lastHP = getCharHealth(PLAYER_PED)
                end
            end
        end
    end
end
Вот рабочий вариант
Lua:
local autodrugs = false

function main()
    repeat wait(0) until isSampAvailable()
    sampAddChatMessage(string.format("[Автонарко] {FFFFFF}Активация: /adrugs"), 0xFF1493 )
    sampRegisterChatCommand('adrugs',
        function()
            autodrugs = not autodrugs
            if autodrugs then
                lastHP = getCharHealth(PLAYER_PED)
                sampAddChatMessage('Автонарко: Включён', 0xFF1493)
                elseif not autodrugs then
                sampAddChatMessage('Автонарко: Выключен', 0xFF1493)
            end
        end)
    while true do wait(0)
        if autodrugs then
            if getCharHealth(PLAYER_PED) ~= lastHP then
                sampSendChat("/usedrugs 3")
                lastHP = getCharHealth(PLAYER_PED)
            end
        end
    end
end
А вообще думаю лучше для сампа использовать пакет о получении урона и при его получении юзать нарко
 

Вложения

  • 1.png
    1.png
    42.3 KB · Просмотры: 21
Последнее редактирование: