Почему-то скриптик не работает, что делать?

uc_Rf_221.2

Новичок
Автор темы
23
3
Короче, скрипт создан как сбив на луа, но не работает. Что делать? Помогите

LUA:
local vkeys = require 'vkeys'

function main()
    repeat wait(0) until isSampAvailable()
    while true do wait(0)

        if isKeyJustPressed(VK_V) then
            local hp = getCharHealth(PLAYER_PED)
            if hp < 10 then
                sampSendChat('/us 15')
            end
            if hp < 20 then
                sampSendChat('/us 14')
            end
            if hp < 30 then
                sampSendChat('/us 13')
            end
            if hp < 40 then
                sampSendChat('/us 12')
        end
        if hp < 50 then
            sampSendChat('/us 11')
        if hp < 60 then
            sampSendChat('/us 10')
        end
        if hp < 70 then
            sampSendChat('/us 9')
        end
        if hp < 80 then
            sampSendChat('/us 8')
        end
        if hp < 90 then
            sampSendChat('/us 7')
        end
        if hp < 100 then
            sampSendChat('/us 6')
        end
        if hp < 110 then
            sampSendChat('/us 5')
        end
        if hp < 120 then
            sampSendChat('/us 4')
        end
        if hp < 130 then
            sampSendChat('/us 3')
        end
        if hp < 140 then
            sampSendChat('/us 2')
        end
        if hp < 150 then
            sampSendChat('/us 1')
        end
    end
end
 

qdIbp

Автор темы
Проверенный
1,387
1,142
Lua:
require("lib.moonloader")

function main()
    repeat wait(0) until isSampAvailable()
    
    while true do wait(0)
        local hp = getCharHealth(PLAYER_PED)
        if isKeyJustPressed(VK_V) then       
            if hp < 10 then
                sampSendChat('/us 15')
            elseif hp < 20 then
                sampSendChat('/us 14')
            elseif hp < 30 then
                sampSendChat('/us 13')
            elseif hp < 40 then
                sampSendChat('/us 12')
            end
        end
        if hp < 50 then
            sampSendChat('/us 11')
        else hp < 60 then
            sampSendChat('/us 10')
        elseif hp < 70 then
            sampSendChat('/us 9')
        elseif hp < 80 then
            sampSendChat('/us 8')
        elseif hp < 90 then
            sampSendChat('/us 7')
        elseif hp < 100 then
            sampSendChat('/us 6')
        elseif hp < 110 then
            sampSendChat('/us 5')
        elseif hp < 120 then
            sampSendChat('/us 4')
        elseif hp < 130 then
            sampSendChat('/us 3')
        elseif hp < 140 then
            sampSendChat('/us 2')
        elseif hp < 150 then
            sampSendChat('/us 1')
        end
    end
end
Хотя лучше как-нибудь через массив делать или математическое выражение, потому что, ну это лютый дрочь
 
  • Вау
Реакции: cord

uc_Rf_221.2

Новичок
Автор темы
23
3
Lua:
require("lib.moonloader")

function main()
    repeat wait(0) until isSampAvailable()
   
    while true do wait(0)
        local hp = getCharHealth(PLAYER_PED)
        if isKeyJustPressed(VK_V) then      
            if hp < 10 then
                sampSendChat('/us 15')
            elseif hp < 20 then
                sampSendChat('/us 14')
            elseif hp < 30 then
                sampSendChat('/us 13')
            elseif hp < 40 then
                sampSendChat('/us 12')
            end
        end
        if hp < 50 then
            sampSendChat('/us 11')
        else hp < 60 then
            sampSendChat('/us 10')
        elseif hp < 70 then
            sampSendChat('/us 9')
        elseif hp < 80 then
            sampSendChat('/us 8')
        elseif hp < 90 then
            sampSendChat('/us 7')
        elseif hp < 100 then
            sampSendChat('/us 6')
        elseif hp < 110 then
            sampSendChat('/us 5')
        elseif hp < 120 then
            sampSendChat('/us 4')
        elseif hp < 130 then
            sampSendChat('/us 3')
        elseif hp < 140 then
            sampSendChat('/us 2')
        elseif hp < 150 then
            sampSendChat('/us 1')
        end
    end
end
Хотя лучше как-нибудь через массив делать или математическое выражение, потому что, ну это лютый дрочь
не робит
 
  • Эм
Реакции: qdIbp