- Версия MoonLoader
- .026-beta
I found this code here on the forum, I would like to know how to show the result in ImGui instead of "print" as it is in the code.
@#Northn
Lua:
local sampev = require 'lib.samp.events'
local imgui = require 'imgui'
local encoding = require 'encoding'
local wantedlist = imgui.ImBool(false)
encoding.default = 'CP1251'
u8 = encoding.UTF8
function main()
while not isSampAvailable() do wait(50) end
while not data do wait(0) end
sust = {}
lua_thread.create(function() while true do wait(0) takewd = true sampSendChat('/wanted') wait(120000) end end)
while true do wait(0)
for _, h in pairs(getAllChars()) do
_ , id = sampGetPlayerIdByCharHandle(h)
_ , m = sampGetPlayerIdByCharHandle(PLAYER_PED)
if id ~= -1 and id ~= m and doesCharExist(h) and sampIsPlayerConnected(id) then
local x, y, z = getCharCoordinates(h)
local mx, my, mz = getCharCoordinates(PLAYER_PED)
local dist = getDistanceBetweenCoords3d(mx, my, mz, x, y, z)
local color = string.format("%06X", ARGBtoRGB(sampGetPlayerColor(id)))
for _, l in pairs(sust) do
local nicksu, idsu = l:match('.+%{FFFFFF%} (%a+_%a+)%[(%d+)%].+')
local sulvl = l:match('.+Ур. Розыска:{ff0000} (%d+)')
if tonumber(id) == tonumber(idsu) then
print('k')
RESULT IN IMGUI????????????????
end
end
end
end
end
end
function sampev.onServerMessage(color, text)
if text:find('%{0088ff%}Привет, %{FFFFFF%}.+Сегодня %{ffcc66%}%S+ г.') then data = true end
end
function sampev.onShowDialog(dialogId, style, title, button1, button2, text)
if takewd ~= true and dialogId == 11436 then
sust = {}
for w in string.gmatch(text, "[^\r\n]+") do
table.insert(sust, w)
end
elseif takewd and dialogId == 11436 then
sust = {}
for w in string.gmatch(text, "[^\r\n]+") do
table.insert(sust, w)
end
takewd = false
return false
end
end
function ARGBtoRGB(color)
local a = bit.band(bit.rshift(color, 24), 0xFF)
local r = bit.band(bit.rshift(color, 16), 0xFF)
local g = bit.band(bit.rshift(color, 8), 0xFF)
local b = bit.band(color, 0xFF)
local rgb = b
rgb = bit.bor(rgb, bit.lshift(g, 8))
rgb = bit.bor(rgb, bit.lshift(r, 16))
return rgb
end
function sampev.onPlaySound()
if takewd then return false end
end
@#Northn