require 'lib.moonloader'
local ffi = require 'ffi'
local se = require 'samp.events'
state = false
function main()
repeat wait(0) until isSampAvailable()
sampRegisterChatCommand("trd", function()
state = not state
sampAddChatMessage("Переключено, текущее значение - " .. (state and "вкл" or "выкл"), 0xFFFFFFFF)
end)
end
function se.onShowDialog(id, style, title, button1, button2, text)
if state and text:find("10 секунд") and title:find("Торговля") then ShowMessage(text:gsub("{......}", ""), "["..sampGetCurrentServerName().."] "..title:gsub("{......}", ""), 0x40) end
end
function ShowMessage(text, title, style)
ffi.cdef [[
int MessageBoxA(
void* hWnd,
const char* lpText,
const char* lpCaption,
unsigned int uType
);
]]
local hwnd = ffi.cast('void*', readMemory(0x00C8CF88, 4, false))
ffi.C.MessageBoxA(hwnd, text, title, style and (style + 0x50000) or 0x50000)
end