local imgui = require 'mimgui'
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8
local renderWindow = imgui.new.bool(true)
imgui.OnInitialize(function()
imgui.GetIO().IniFilename = nil
end)
local autofam = imgui.new.bool()
local newFrame = imgui.OnFrame(
function() return renderWindow[0] end,
function(player)
local resX, resY = getScreenResolution()
local sizeX, sizeY = 300, 300
imgui.SetNextWindowPos(imgui.ImVec2(resX / 2, resY / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
imgui.SetNextWindowSize(imgui.ImVec2(sizeX, sizeY), imgui.Cond.FirstUseEver)
if imgui.Begin('Main Window', renderWindow) then
imgui.Checkbox(" Auto Invite",autofam)
imgui.End()
end
end
)
local timer = os.clock()
function main()
while not isSampAvailable() do wait(0) end
sampRegisterChatCommand('zxc', function()
renderWindow[0] = not renderWindow[0]
end)
while true do
wait(0)
if autofam[0] then
lua_thread.create(function()
local mx, my, mz = getCharCoordinates(playerPed)
for id = 0,1000 do
local _, handle = sampGetCharHandleBySampPlayerId(id)
if _ then
local x, y, z = getCharCoordinates(handle)
if getDistanceBetweenCoords3d(x,y,z,mx,my,mz) <= 10 then
if os.clock() - timer > 0.5 then -- задержка между отправкой
sampSendChat('/invite '..id,-1)
timer = os.clock()
end
end
end
end
end)
end
end