require "lib.moonloader"
local SampEvents = require 'lib.samp.events'
local GameKeys = require 'game.keys'
local last = 0
local curr = 0
local times = 2000
function main()
if not isSampLoaded() or not isSampfuncsLoaded() then return end
while not isSampAvailable() do wait(100) end
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)
lua_thread.create(function()
if data.position.x == 247 and (data.position.y - 150) % 24 == 0 and data.modelId == 19265 then
slot = getSlot(data.position.y)
wait(300)
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)
wait(300)
Move()
end
if data.text == '~r~Y' then
wait(times)
PressY()
end
if data.text == '~g~Y' then
wait(times)
PressY()
end
if data.text == '~r~N' then
wait(times)
PressN()
end
if data.text == '~g~N' then
wait(times)
PressN()
end
end)
end