- Версия MoonLoader
- Другое
Сделал ради теста, ибо мне нечего делать такую штуку
как сделать, чтобы в imgui.Button выводились все ники которые были получены, а не 1
Lua:
local imgui = require 'imgui'
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8
local menu = imgui.ImBool(false)
local sampev = require "lib.samp.events"
function main()
if not isSampLoaded() or not isSampfuncsLoaded() then return end
while not isSampAvailable() do wait(100) end
sampRegisterChatCommand("test", function(arg)
arg = tonumber(arg)
if arg == nil or arg == '' then
sampAddChatMessage('Введите дистанцию от 1 до 100!', -1)
else
if arg >= 101 then
sampAddChatMessage('Используйте от 1 до 100.', -1)
else
menu.v = not menu.v
for i = 1,1003 do
res, playerped = sampGetCharHandleBySampPlayerId(i)
if res then
x,y,z = getCharCoordinates(playerped)
xq,yq,zq = getCharCoordinates(PLAYER_PED)
dist = getDistanceBetweenCoords3d(xq,yq,zq,x,y,z)
if dist <= arg then
nick = sampGetPlayerNickname(i)
end
end
end
end
end
end)
while true do
wait(0)
imgui.Process = menu.v
end
end
function imgui.OnDrawFrame()
if menu.v then
local sw, sh = getScreenResolution()
imgui.SetNextWindowPos(imgui.ImVec2(sw / 2, sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
imgui.SetNextWindowSize(imgui.ImVec2(250, 240), imgui.Cond.FirstUseEver)
imgui.Begin('VKCoin', menu, imgui.WindowFlags.NoResize)
imgui.Button(nick)
imgui.End()
end
end