You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cannabis-keys/cannabis-keys.lua

55 lines
1.1 KiB

script_author('cannabis-keys')
script_author('rubin')
sampev = require 'lib.samp.events'
txd_keys = {
{ "LD_BEAT:up", 38, -1 },
{ "LD_BEAT:down", 40, -1 },
{ "LD_BEAT:left", 37, -1 },
{ "LD_BEAT:right", 39, -1 }
}
function main()
if not isSampLoaded() or not isSampfuncsLoaded() then return end
while not isSampAvailable() do wait(100) end
while true do
wait(0)
for i = 1, #txd_keys do
if txd_keys[i][2] ~= -1 and wasKeyPressed(txd_keys[i][2]) then
sampSendClickTextdraw(txd_keys[i][3])
end
end
end
end
function sampev.onShowTextDraw(id, data)
if data.text:find("LD_BEAT") then
for i = 1, #txd_keys do
if data.text:find(txd_keys[i][1]) then
txd_keys[i][3] = id
end
end
end
end
function sampev.onTextDrawHide(id)
for i = 1, #txd_keys do
if id == txd_keys[i][3] then
txd_keys[i][3] = -1
end
end
end
function sampev.onTextDrawSetString(id, text)
if text:find("LD_BEAT") then
for i = 1, #txd_keys do
if id == txd_keys[i][3] then
if text:find(txd_keys[i][1]) then
txd_keys[i][3] = id
else
txd_keys[i][3] = -1
end
end
end
end
end