require 'lib.moonloader'
local ffi = require("ffi")
ffi.cdef[[
short GetKeyState(int nVirtKey);
bool GetKeyboardLayoutNameA(char* pwszKLID);
int GetLocaleInfoA(int Locale, int LCType, char* lpLCData, int cchData);
]]
local BuffSize = 32
local KeyboardLayoutName = ffi.new("char[?]", BuffSize)
local LocalInfo = ffi.new("char[?]", BuffSize)
function main()
while not isSampAvailable() do wait(0) end
while true do
wait(0)
local success = ffi.C.GetKeyboardLayoutNameA(KeyboardLayoutName)
local errorCode = ffi.C.GetLocaleInfoA(tonumber(ffi.string(KeyboardLayoutName), 16), 0x00000002, LocalInfo, BuffSize)
local localName = ffi.string(LocalInfo)
if wasKeyPressed(VK_T) and localName:find('США') and not sampIsChatInputActive() and #sampGetChatInputText() == 0 then
sampSetChatInputEnabled(true)
sampSetChatInputText('/')
end
end
end