Помогите сделать активацию скрипта на команду и задержку между кликами YNS.

Thief Hither.

Участник
Автор темы
47
10
Вообще не шарю как это сделать, помогите.
Данный скрипт: https://www.blast.hk/threads/57892/#post-516367
Код скрипта:

Код:
local SampEvents = require 'lib.samp.events'
local GameKeys = require 'game.keys'
local last = 0
local curr = 0

function getSlot(a)
    return (a - 150) / 24 + 1
end

function getYellowSlot(a)
    return (a - 170) / 24 + 1
end

function PressY()
    setGameKeyState(GameKeys.player.CONVERSATIONYES, -1)
    setGameKeyState(0, -1)
end

function PressN()
    setGameKeyState(GameKeys.player.CONVERSATIONNO, -1)
    setGameKeyState(0, -1)
end

function Move()
    if slot == 0 or curr == 0 then
        return
    end
    if slot > curr then
        setGameKeyState(GameKeys.player.CONVERSATIONNO, -1)
        setGameKeyState(0, -1)
        curr = 0
    end
    if curr > slot then
        setGameKeyState(GameKeys.player.CONVERSATIONYES, -1)
        setGameKeyState(0, -1)
        curr = 0
    end
    if slot == curr then
        setGameKeyState(GameKeys.player.SPRINT, -1)
        setGameKeyState(0, -1)
        slot = 0
    end

end

function SampEvents.onShowTextDraw(id, data)
    if data.position.x == 247 and (data.position.y - 150) % 24 == 0 and data.modelId == 19265 then
        slot = getSlot(data.position.y)
        Move()
    end
    if data.letterColor == -16711681 and data.position.x == 215.5 and (data.position.y - 170) % 24 == 0 then
        curr = getYellowSlot(data.position.y)
        Move()
    end
    if data.text == '~r~Y' then
        PressY()
    end
    if data.text == '~g~Y' then
        PressY()
    end
    if data.text == '~r~N' then
        PressN()
    end
    if data.text == '~g~N' then
        PressN()
    end
    return {id, data}
end
 

Izvinisb

Известный
Проверенный
964
598
Автоматическая
Активация: /cmd
Lua:
local SampEvents = require 'lib.samp.events'
local GameKeys = require 'game.keys'
local last = 0
local curr = 0

function main()
    repeat wait(0) until isSampAvailable()
    sampRegisterChatCommand('cmd', function() state = not state
        sampAddChatMessage(state and 'On' or 'Off', -1)
    end)
    wait(-1)
end

function getSlot(a)
    return (a - 150) / 24 + 1
end

function getYellowSlot(a)
    return (a - 170) / 24 + 1
end

function PressY()
    setGameKeyState(GameKeys.player.CONVERSATIONYES, -1)
    setGameKeyState(0, -1)
end

function PressN()
    setGameKeyState(GameKeys.player.CONVERSATIONNO, -1)
    setGameKeyState(0, -1)
end

function Move()
    if slot == 0 or curr == 0 then
        return
    end
    if slot > curr then
        setGameKeyState(GameKeys.player.CONVERSATIONNO, -1)
        setGameKeyState(0, -1)
        curr = 0
    end
    if curr > slot then
        setGameKeyState(GameKeys.player.CONVERSATIONYES, -1)
        setGameKeyState(0, -1)
        curr = 0
    end
    if slot == curr then
        setGameKeyState(GameKeys.player.SPRINT, -1)
        setGameKeyState(0, -1)
        slot = 0
    end

end

function SampEvents.onShowTextDraw(id, data)
    if state then
        if data.position.x == 247 and (data.position.y - 150) % 24 == 0 and data.modelId == 19265 then
            slot = getSlot(data.position.y)
            Move()
        end
        if data.letterColor == -16711681 and data.position.x == 215.5 and (data.position.y - 170) % 24 == 0 then
            curr = getYellowSlot(data.position.y)
            Move()
        end
        if data.text == '~r~Y' then
            PressY()
        end
        if data.text == '~g~Y' then
            PressY()
        end
        if data.text == '~r~N' then
            PressN()
        end
        if data.text == '~g~N' then
            PressN()
        end
        return {id, data}
    end
end
 
  • Нравится
Реакции: Zaep

Thief Hither.

Участник
Автор темы
47
10
Активация: /cmd
Lua:
local SampEvents = require 'lib.samp.events'
local GameKeys = require 'game.keys'
local last = 0
local curr = 0

function main()
    repeat wait(0) until isSampAvailable()
    sampRegisterChatCommand('cmd', function() state = not state
        sampAddChatMessage(state and 'On' or 'Off', -1)
    end)
    wait(-1)
end

function getSlot(a)
    return (a - 150) / 24 + 1
end

function getYellowSlot(a)
    return (a - 170) / 24 + 1
end

function PressY()
    setGameKeyState(GameKeys.player.CONVERSATIONYES, -1)
    setGameKeyState(0, -1)
end

function PressN()
    setGameKeyState(GameKeys.player.CONVERSATIONNO, -1)
    setGameKeyState(0, -1)
end

function Move()
    if slot == 0 or curr == 0 then
        return
    end
    if slot > curr then
        setGameKeyState(GameKeys.player.CONVERSATIONNO, -1)
        setGameKeyState(0, -1)
        curr = 0
    end
    if curr > slot then
        setGameKeyState(GameKeys.player.CONVERSATIONYES, -1)
        setGameKeyState(0, -1)
        curr = 0
    end
    if slot == curr then
        setGameKeyState(GameKeys.player.SPRINT, -1)
        setGameKeyState(0, -1)
        slot = 0
    end

end

function SampEvents.onShowTextDraw(id, data)
    if state then
        if data.position.x == 247 and (data.position.y - 150) % 24 == 0 and data.modelId == 19265 then
            slot = getSlot(data.position.y)
            Move()
        end
        if data.letterColor == -16711681 and data.position.x == 215.5 and (data.position.y - 170) % 24 == 0 then
            curr = getYellowSlot(data.position.y)
            Move()
        end
        if data.text == '~r~Y' then
            PressY()
        end
        if data.text == '~g~Y' then
            PressY()
        end
        if data.text == '~r~N' then
            PressN()
        end
        if data.text == '~g~N' then
            PressN()
        end
        return {id, data}
    end
end
"после проверки в функции Move() ставишь wait(нужная задержка), а в YN просто также поставь задержку в методы PressY и PressN." - данное сообщение мне написал разработчик скрипта, надеюсь оно вам поможет в написании задержки.