usedrugs

Kegwineye.

Участник
Автор темы
478
20
Версия MoonLoader
.026-beta
как правильно оформить ?

Lua:
 nick = sampGetPlayerNickname(id)
    _ , ID = sampGetCharHandleBySampPlayerId(nick)
    hp = sampGetPlayerHealth(ID)

Lua:
if uds.v then
        if isKeyDown(vkeys.VK_MENU) and isKeyJustPressed(vkeys.VK_Z) then
            if hp <=80 then
                sampSendChat('/usedrugs 1')
            end
            if hp <=60 then
                sampSendChat('/usedrugs 2')
            end
            if hp<=40 then
                sampSendChat('/usedrugs 3')
            end
        end
    end
 

paulohardy

вы еще постите говно? тогда я иду к вам
Всефорумный модератор
1,961
1,311
Lua:
function main()
    repeat wait(0) until isSampAvailable()
    while true do wait(0)
        if uds.v and isKeyDown(vkeys.VK_MENU) and isKeyJustPressed(vkeys.VK_Z) then
            local hp = getCharHealth(1)
            if hp <= 80 then
                sampSendChat('/usedrugs 1')
            elseif hp <= 60 then
                sampSendChat('/usedrugs 2')
            elseif hp <= 40 then
                sampSendChat('/usedrugs 3')
            end
        end
    end
end
 

chapo

tg/inst: @moujeek
Всефорумный модератор
9,092
12,121
Нельзя ставить <=
ок, как скажешь
1643372327915.png
 

lorgon

Известный
656
273
Lua:
function main()
    repeat wait(0) until isSampAvailable()
    while true do wait(0)
        if uds.v and isKeyDown(vkeys.VK_MENU) and isKeyJustPressed(vkeys.VK_Z) then
            local hp = getCharHealth(1)
            if hp <= 80 then
                sampSendChat('/usedrugs 1')
            elseif hp <= 60 then
                sampSendChat('/usedrugs 2')
            elseif hp <= 40 then
                sampSendChat('/usedrugs 3')
            end
        end
    end
end
Это же не будет работать нормально.
Код проверки:
local hp = 30

if hp <= 80 then
  print('/usedrugs 1')
elseif hp <= 60 then
  print('/usedrugs 2')
elseif hp <= 40 then
  print('/usedrugs 3')
end

Консоль:
/usedrugs 1
А должно выводить "/usedrugs 3"
 

paulohardy

вы еще постите говно? тогда я иду к вам
Всефорумный модератор
1,961
1,311
Это же не будет работать нормально.
признаю, обосрался

Lua:
function main()
    repeat wait(0) until isSampAvailable()
    while true do wait(0)
        if uds.v and isKeyDown(vkeys.VK_MENU) and isKeyJustPressed(vkeys.VK_Z) then
            local hp = getCharHealth(1)
            sampSendChat('/usedrugs '..(hp <= 40 and '3' or hp <= 60 and '2' or hp <= 80 and '1'))
        end
    end
end
 
  • Нравится
Реакции: lorgon

Kegwineye.

Участник
Автор темы
478
20
признаю, обосрался

Lua:
function main()
    repeat wait(0) until isSampAvailable()
    while true do wait(0)
        if uds.v and isKeyDown(vkeys.VK_MENU) and isKeyJustPressed(vkeys.VK_Z) then
            local hp = getCharHealth(1)
            sampSendChat('/usedrugs '..(hp <= 40 and '3' or hp <= 60 and '2' or hp <= 80 and '1'))
        end
    end
end
ua:68: attempt to concatenate a boolean value
stack traceback:
...sktop\games\oldmanoffLOWpc\moonloader\sbiv [Ver 1.1].lua: in function <...sktop\games\oldmanoffLOWpc\moonloader\sbiv [Ver 1.1].lua:40>

attempt to concatenate a boolean value
эт короче где
*
sampSendChat('/usedrugs '..(hp <= 40 and '3' or hp <= 60 and '2' or hp <= 80 and '1'))*
 

paulohardy

вы еще постите говно? тогда я иду к вам
Всефорумный модератор
1,961
1,311
ua:68: attempt to concatenate a boolean value
stack traceback:
...sktop\games\oldmanoffLOWpc\moonloader\sbiv [Ver 1.1].lua: in function <...sktop\games\oldmanoffLOWpc\moonloader\sbiv [Ver 1.1].lua:40>

attempt to concatenate a boolean value
эт короче где
*
sampSendChat('/usedrugs '..(hp <= 40 and '3' or hp <= 60 and '2' or hp <= 80 and '1'))*
Lua:
function main()
    repeat wait(0) until isSampAvailable()
    while true do wait(0)
        if uds.v and isKeyDown(vkeys.VK_MENU) and isKeyJustPressed(vkeys.VK_Z) then
            local hp = getCharHealth(1)
            if hp <= 80 then
                sampSendChat('/usedrugs '..(hp <= 40 and '3' or hp <= 60 and '2' or hp <= 80 and '1'))
            end
        end
    end
end
 
Последнее редактирование: