commit
4ce7e24391
@ -0,0 +1,55 @@ |
||||
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 |
Loading…
Reference in new issue