script_name("Klans Y/N Tapper")
script_authors("Kapa211")
script_moonloader(0.21)
require "lib.moonloader"
local hook = require 'lib.samp.events'
grogger = false
function main()
repeat wait(0) until isSampAvailable()
sampAddChatMessage("Klans Y/N Tapper загружен /txd", 0xc0c24e)
sampRegisterChatCommand("txd",
function()
grogger = not grogger
if grogger then sampAddChatMessage("Klans Y/N Tapper активирован", 0xc0c24e)
else sampAddChatMessage("Klans Y/N Tapper деактивирован", 0xc0c24e) end
end)
wait(-1)
end
function hook.onShowTextDraw(textdrawId, data)
if textdrawId > 3 then
if grogger then
if data.text:find("Y") then
sendKey(64)
elseif data.text:find("N") then
sendKey(128)
elseif data.text:find("H") then
sendKey(192)
end
end
end
end
function sendKey(key)
local _, myId = sampGetPlayerIdByCharHandle(PLAYER_PED)
local data = allocateMemory(68)
sampStorePlayerOnfootData(myId, data)
setStructElement(data, 36, 1, key, false)
sampSendOnfootData(data)
freeMemory(data)
end
--#SAMP RIP