local encoding = require 'encoding'
local key = require 'vkeys'
local hook = require 'lib.samp.events'
local memory = require 'memory'
local ffi = require 'ffi'
encoding.default = 'CP1251'
u8 = encoding.UTF8
local activ = false
function main()
if not isSampfuncsLoaded() or not isSampLoaded() then return end
while not isSampAvailable() do wait(100) end
sampRegisterChatCommand("asd", function ()
activ = not activ
printStringNow(activ and '~g~binder activated' or '~r~binder deactivated', 2000)
end)
while true do
wait(0)
if activ then
if wasKeyPressed(key.VK_NUMPAD2) then
sampSendChat("/udc")
end
if(wasKeyPressed(key.VK_NUMPAD1)) then
sampSetChatInputText("/usemeds ")
sampSetChatInputEnabled(true)
end
if(wasKeyPressed(key.VK_XBUTTON1)) then
screen()
end
end
end
end
function hook.onServerMessage(color, text)
if text:find("вызывает медика") then
lua_thread.create(function()
wait(100)
sampSendChat("/accept medic")
end)
end
end
function hook.onCreateObject(id, data)
if id == 1276 then
setMarker(1, data.position.x, data.position.y, data.position.z, 20, 0xFFFFFFFF)
end
end
function screen()
local rwcam = ffi.cast("void* *", 0xB6F97C)
local TakeScreenshot = ffi.cast("void(__cdecl*)(void *, const char*)", 0x5D0820) -- TakeScreenshot()
local p = "moonloader\\screens\\" .. os.date("%d.%m.%Y %H.%M.%S.png")
TakeScreenshot(rwcam, p)
end
function setMarker(type, x, y, z, radius, color)
checkpoint = addBlipForCoord(x, y, z)
marker = createCheckpoint(type, x, y, z, 1, 1, 1, radius)
changeBlipColour(checkpoint, color)
end