Что не так в моем говно коде? help, so easy

skief

Участник
Автор темы
40
15
Lua:
script_name("FightHelper")
script_author("shipilya")
script_version("25.11.2020")

local vkeys = 'vkeys'

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

    sampAddChatMessage("[PIZDILKA] pizdilka loaded. creator: shipilya",0xe97451)
    sampRegisterChatCommand("commands", cmd_commands)
while true do
wait(0)
if isKeyPressed(VK_J) then sampSendChat('/usedrugs 3')
 
Решение
  • script_name("FightHelper")
    script_author("shipilya")
    script_version("25.11.2020")

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

    sampAddChatMessage("[PIZDILKA] pizdilka loaded. creator: shipilya",0xe97451)
    sampRegisterChatCommand("commands", cmd_commands)
    while true do
    wait(0)
    if isKeyJustPressed(74) then sampSendChat('/usedrugs 3') end
    if isKeyJustPressed(66) then sampSendChat('/armour') end
    if isKeyJustPressed(77) then sampSendChat('/mask') end
    if isKeyJustPressed(81) then sampSendChat('/anims 1') end
    end
    end

  • мне надо чтобы все if iskeyjustpressed были вписаны с sampIsChatInputActive() и sampIsDialogActive(0)
Вместо sampIsChatInputActive()...

Myradov|

Известный
361
106
Lua:
script_name("FightHelper")
script_author("shipilya")
script_version("25.11.2020")

local vkeys = 'vkeys'

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

    sampAddChatMessage("[PIZDILKA] pizdilka loaded. creator: shipilya",0xe97451)
    sampRegisterChatCommand("commands", cmd_commands)
while true do
wait(0)
    if isKeyPressed(VK_J) then sampSendChat('/usedrugs 3') end
end
end
 

kizn

q(≧▽≦q)
Всефорумный модератор
2,413
2,118
Lua:
script_name("FightHelper")
script_author("shipilya")
script_version("25.11.2020")

local vkeys = 'vkeys'

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

    sampAddChatMessage("[PIZDILKA] pizdilka loaded. creator: shipilya",0xe97451)
    sampRegisterChatCommand("commands", cmd_commands)
while true do
wait(0)
if isKeyPressed(VK_J) then sampSendChat('/usedrugs 3')
где закрытие бесконечного цикла, закрытие проверки, закрытие функции?
 

skief

Участник
Автор темы
40
15
где закрытие бесконечного цикла, закрытие проверки, закрытие функции?
я поставил просто 3 end в конце, я просто дебил который ничего не умеет, потому что только вчера начал делать
Lua:
script_name("FightHelper")
script_author("shipilya")
script_version("25.11.2020")

local vkeys = 'vkeys'

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

    sampAddChatMessage("[PIZDILKA] pizdilka loaded. creator: shipilya",0xe97451)
    sampRegisterChatCommand("commands", cmd_commands)
while true do
wait(0)
    if isKeyPressed(VK_J) then sampSendChat('/usedrugs 3') end
end
end
кстати к сожалению он загрузился, но не прожимается клавиша, щас попробую библиотеку переустановить
 

Myradov|

Известный
361
106
Lua:
script_name("FightHelper")
script_author("shipilya")
script_version("25.11.2020")

local vkeys = 'vkeys'

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

    sampAddChatMessage("[PIZDILKA] pizdilka loaded. creator: shipilya",0xe97451)
    sampRegisterChatCommand("commands", cmd_commands)
while true do
wait(0)
    if isKeyJustPressed(VK_J) then sampSendChat('/usedrugs 3') end
end
end
 

skief

Участник
Автор темы
40
15
Lua:
script_name("FightHelper")
script_author("shipilya")
script_version("25.11.2020")

local vkeys = 'vkeys'

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

    sampAddChatMessage("[PIZDILKA] pizdilka loaded. creator: shipilya",0xe97451)
    sampRegisterChatCommand("commands", cmd_commands)
while true do
wait(0)
    if isKeyJustPressed(VK_J) then sampSendChat('/usedrugs 3') end
end
end
Оно загружается, но кнопка не активна
Lua:
script_name("FightHelper")
script_author("shipilya")
script_version("25.11.2020")

local vkeys = 'vkeys'

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

    sampAddChatMessage("[PIZDILKA] pizdilka loaded. creator: shipilya",0xe97451)
    sampRegisterChatCommand("commands", cmd_commands)
while true do
wait(0)
    if isKeyJustPressed(VK_J) then sampSendChat('/usedrugs 3') end
end
end
Lua:
script_name("FightHelper")
script_author("shipilya")
script_version("25.11.2020")

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

    sampAddChatMessage("[PIZDILKA] pizdilka loaded. creator: shipilya",0xe97451)
    sampRegisterChatCommand("commands", cmd_commands)
while true do
wait(0)
    if isKeyJustPressed(74) then sampSendChat('/usedrugs 3') end
end
end
Так проще, просто я не знаю как задать вторую функцию с таким же действием только другое число наркотиков.
 

bottom_text

Известный
673
323
Код:
script_name("FightHelper")
script_author("shipilya")
script_version("25.11.2020")

require "lib.moonloader"
local keys = require "vkeys"

function main()
    if not isSampfuncsLoaded() or not isSampLoaded() then return end
    while not isSampAvailable() do wait(100) end
    sampAddChatMessage("[PIZDILKA] pizdilka loaded. creator: shipilya", 0xe97451)
    sampRegisterChatCommand("commands", cmd_commands)
while true do
wait(0)
if isKeyJustPressed(VK_J) then sampSendChat('/usedrugs 3') end
end
end

Не доставил пару end, не загрузил библиотеки, Вместо IsKeyPressed нужно isKeyJustPressed. Держи исправленный.
 

skief

Участник
Автор темы
40
15
где закрытие бесконечного цикла, закрытие проверки, закрытие функции?
Код:
script_name("FightHelper")
script_author("shipilya")
script_version("25.11.2020")

require "lib.moonloader"
local keys = require "vkeys"

function main()
    if not isSampfuncsLoaded() or not isSampLoaded() then return end
    while not isSampAvailable() do wait(100) end
    sampAddChatMessage("[PIZDILKA] pizdilka loaded. creator: shipilya", 0xe97451)
    sampRegisterChatCommand("commands", cmd_commands)
while true do
wait(0)
if isKeyJustPressed(VK_J) then sampSendChat('/usedrugs 3') end
end
end

Не доставил пару end, не загрузил библиотеки, Вместо IsKeyPressed нужно isKeyJustPressed. Держи исправленный.
Я понял, что мне проще без vkeys. Он у меня не работает почему-то. Меня это немного раздражает.
 

skief

Участник
Автор темы
40
15
Код:
script_name("FightHelper")
script_author("shipilya")
script_version("25.11.2020")

require "lib.moonloader"
local keys = require "vkeys"

function main()
    if not isSampfuncsLoaded() or not isSampLoaded() then return end
    while not isSampAvailable() do wait(100) end
    sampAddChatMessage("[PIZDILKA] pizdilka loaded. creator: shipilya", 0xe97451)
    sampRegisterChatCommand("commands", cmd_commands)
while true do
wait(0)
if isKeyJustPressed(VK_J) then sampSendChat('/usedrugs 3') end
end
end

Не доставил пару end, не загрузил библиотеки, Вместо IsKeyPressed нужно isKeyJustPressed. Держи исправленный.
Слушай, а как мне добавить такую же штучку, только там чтобы 2 работали. есть usedrugs , а я хочу армор впихнуть. Как это сделать?
Ты не загрузаешь библиотеки, поэтому не работает.
ТЫ МНЕ ОТКРЫЛ ГЛАЗА
до меня дошло. я сделал это!!!
 

bottom_text

Известный
673
323
Слушай, а как мне добавить такую же штучку, только там чтобы 2 работали. есть usedrugs , а я хочу армор впихнуть. Как это сделать?

ТЫ МНЕ ОТКРЫЛ ГЛАЗА
до меня дошло. я сделал это!!!

Lua:
script_name("FightHelper")
script_author("shipilya")
script_version("25.11.2020")

require "lib.moonloader"
local keys = require "vkeys"

function main()
    if not isSampfuncsLoaded() or not isSampLoaded() then return end
    while not isSampAvailable() do wait(100) end
    sampAddChatMessage("[PIZDILKA] pizdilka loaded. creator: shipilya", 0xe97451)
    sampRegisterChatCommand("commands", cmd_commands)
while true do
wait(0)
if isKeyJustPressed(VK_J) then sampSendChat('/usedrugs 3') end
if isKeyJustPressed(Сюда вставляешь код клавиши) then sampSendChat('Здесь пишешь команду чтобы броню выдать, не знаю где ты играешь.') end
end
end
Таким образом должно две штучки быть
 

skief

Участник
Автор темы
40
15
Lua:
script_name("FightHelper")
script_author("shipilya")
script_version("25.11.2020")

require "lib.moonloader"
local keys = require "vkeys"

function main()
    if not isSampfuncsLoaded() or not isSampLoaded() then return end
    while not isSampAvailable() do wait(100) end
    sampAddChatMessage("[PIZDILKA] pizdilka loaded. creator: shipilya", 0xe97451)
    sampRegisterChatCommand("commands", cmd_commands)
while true do
wait(0)
if isKeyJustPressed(VK_J) then sampSendChat('/usedrugs 3') end
if isKeyJustPressed(Сюда вставляешь код клавиши) then sampSendChat('Здесь пишешь команду чтобы броню выдать, не знаю где ты играешь.') end
end
end
Таким образом должно две штучки быть

  • script_name("FightHelper")
    script_author("shipilya")
    script_version("25.11.2020")

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

    sampAddChatMessage("[PIZDILKA] pizdilka loaded. creator: shipilya",0xe97451)
    sampRegisterChatCommand("commands", cmd_commands)
    while true do
    wait(0)
    if isKeyJustPressed(74) then sampSendChat('/usedrugs 3') end
    if isKeyJustPressed(66) then sampSendChat('/armour') end
    if isKeyJustPressed(77) then sampSendChat('/mask') end
    if isKeyJustPressed(81) then sampSendChat('/anims 1') end
    end
    end

  • мне надо чтобы все if iskeyjustpressed были вписаны с sampIsChatInputActive() и sampIsDialogActive(0)
 

bottom_text

Известный
673
323
  • script_name("FightHelper")
    script_author("shipilya")
    script_version("25.11.2020")

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

    sampAddChatMessage("[PIZDILKA] pizdilka loaded. creator: shipilya",0xe97451)
    sampRegisterChatCommand("commands", cmd_commands)
    while true do
    wait(0)
    if isKeyJustPressed(74) then sampSendChat('/usedrugs 3') end
    if isKeyJustPressed(66) then sampSendChat('/armour') end
    if isKeyJustPressed(77) then sampSendChat('/mask') end
    if isKeyJustPressed(81) then sampSendChat('/anims 1') end
    end
    end

  • мне надо чтобы все if iskeyjustpressed были вписаны с sampIsChatInputActive() и sampIsDialogActive(0)
Вместо sampIsChatInputActive() и sampIsDialogActive() проще и удобнее использовать isCursorActive ()

Код:
script_name("FightHelper")
script_author("shipilya")
script_version("25.11.2020")

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

sampAddChatMessage("[PIZDILKA] pizdilka loaded. creator: shipilya",0xe97451)
sampRegisterChatCommand("commands", cmd_commands)
while true do
wait(0)
if isKeyJustPressed(74) and not isCursorActive() then sampSendChat('/usedrugs 3') end
if isKeyJustPressed(66) and not isCursorActive() then sampSendChat('/armour') end
if isKeyJustPressed(77) and not isCursorActive() then sampSendChat('/mask') end
if isKeyJustPressed(81) and not isCursorActive() then sampSendChat('/anims 1') end
end
end

Команда в чат отправится только когда курсор не активен и нажата клавиша.
 

skief

Участник
Автор темы
40
15
Вместо sampIsChatInputActive() и sampIsDialogActive() проще и удобнее использовать isCursorActive ()

Код:
script_name("FightHelper")
script_author("shipilya")
script_version("25.11.2020")

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

sampAddChatMessage("[PIZDILKA] pizdilka loaded. creator: shipilya",0xe97451)
sampRegisterChatCommand("commands", cmd_commands)
while true do
wait(0)
if isKeyJustPressed(74) and not isCursorActive() then sampSendChat('/usedrugs 3') end
if isKeyJustPressed(66) and not isCursorActive() then sampSendChat('/armour') end
if isKeyJustPressed(77) and not isCursorActive() then sampSendChat('/mask') end
if isKeyJustPressed(81) and not isCursorActive() then sampSendChat('/anims 1') end
end
end

Команда в чат отправится только когда курсор не активен и нажата клавиша.
ты забыл vkeys require lib.moonloader
Вместо sampIsChatInputActive() и sampIsDialogActive() проще и удобнее использовать isCursorActive ()

Код:
script_name("FightHelper")
script_author("shipilya")
script_version("25.11.2020")

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

sampAddChatMessage("[PIZDILKA] pizdilka loaded. creator: shipilya",0xe97451)
sampRegisterChatCommand("commands", cmd_commands)
while true do
wait(0)
if isKeyJustPressed(74) and not isCursorActive() then sampSendChat('/usedrugs 3') end
if isKeyJustPressed(66) and not isCursorActive() then sampSendChat('/armour') end
if isKeyJustPressed(77) and not isCursorActive() then sampSendChat('/mask') end
if isKeyJustPressed(81) and not isCursorActive() then sampSendChat('/anims 1') end
end
end

Команда в чат отправится только когда курсор не активен и нажата клавиша.
сделай с ним, я переписываю у меня че то не реагируют клавиши
Вопрос решен. Кому надо мое говно исскуство для аризоны держите.
 

Вложения

  • pizdilka.lua
    1 KB · Просмотры: 3
Последнее редактирование: