Вывод сообщения в чат [Помощь]

pep504

Известный
Автор темы
6
1
Версия MoonLoader
.027.0-preview
Помогите пожалуйста, не могу сообразить, нужно вывести сообщение в чат, когда появляется определенный ID объекта в зоне стрима. Может поможет кто?
И так же рисовать линию к определенному объекту в зоне стрима
 

Volgus_King

Активный
155
115
думай доперешь)

Lua:
local font = renderCreateFont("Arial", 7, 4)
local imgui = require 'imgui'
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8

while true do wait(0)
if isPlayerPlaying(playerHandle) and  enabled then
if checked_button_2.v then -- если вкл имгуа
for _, v in pairs(getAllObjects()) do
local asd
if sampGetObjectSampIdByHandle(v) then
asd = sampGetObjectSampIdByHandle(v)

end
if isObjectOnScreen(v) then -- скан объект
local _, x, y, z = getObjectCoordinates(v)
local x1, y1 = convert3DCoordsToScreen(x,y,z)
local model = getObjectModel(v)
local x2,y2,z2 = getCharCoordinates(PLAYER_PED)
local x10, y10 = convert3DCoordsToScreen(x2,y2,z2)
local distance = string.format("%.1f", getDistanceBetweenCoords3d(x, y, z, x2, y2, z2))

if checked_button_2.v then -- если вкл имгуа
if 866 == model and true then -- если объект такойто то
renderFontDrawText(font,  "Дистанция: "..distance, x1, y1, -1)
if checked_button_3.v then -- если вкл имгуа
renderDrawLine(x10, y10, x1, y1, 1.0, -1) -- чертит линию
printStringNow('AKTIVIROVAN NAHyi by Volgus', 1000) -- вывод текста на экран
end
end
end
end
end
end
 

pep504

Известный
Автор темы
6
1
[ML] (error) FISH.lua: D:\ãýòûà\moonloader\FISH.lua:45: 'end' expected (to close 'if' at line 17) near '<eof>' во пишет :(((
думай доперешь)

Lua:
local font = renderCreateFont("Arial", 7, 4)
local imgui = require 'imgui'
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8

while true do wait(0)
if isPlayerPlaying(playerHandle) and  enabled then
if checked_button_2.v then -- если вкл имгуа
for _, v in pairs(getAllObjects()) do
local asd
if sampGetObjectSampIdByHandle(v) then
asd = sampGetObjectSampIdByHandle(v)

end
if isObjectOnScreen(v) then -- скан объект
local _, x, y, z = getObjectCoordinates(v)
local x1, y1 = convert3DCoordsToScreen(x,y,z)
local model = getObjectModel(v)
local x2,y2,z2 = getCharCoordinates(PLAYER_PED)
local x10, y10 = convert3DCoordsToScreen(x2,y2,z2)
local distance = string.format("%.1f", getDistanceBetweenCoords3d(x, y, z, x2, y2, z2))

if checked_button_2.v then -- если вкл имгуа
if 866 == model and true then -- если объект такойто то
renderFontDrawText(font,  "Дистанция: "..distance, x1, y1, -1)
if checked_button_3.v then -- если вкл имгуа
renderDrawLine(x10, y10, x1, y1, 1.0, -1) -- чертит линию
printStringNow('AKTIVIROVAN NAHyi by Volgus', 1000) -- вывод текста на экран
end
end
end
end
end
end
 
U

user390868

Гость
думай доперешь)

Lua:
local font = renderCreateFont("Arial", 7, 4)
local imgui = require 'imgui'
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8

while true do wait(0)
if isPlayerPlaying(playerHandle) and  enabled then
if checked_button_2.v then -- если вкл имгуа
for _, v in pairs(getAllObjects()) do
local asd
if sampGetObjectSampIdByHandle(v) then
asd = sampGetObjectSampIdByHandle(v)

end
if isObjectOnScreen(v) then -- скан объект
local _, x, y, z = getObjectCoordinates(v)
local x1, y1 = convert3DCoordsToScreen(x,y,z)
local model = getObjectModel(v)
local x2,y2,z2 = getCharCoordinates(PLAYER_PED)
local x10, y10 = convert3DCoordsToScreen(x2,y2,z2)
local distance = string.format("%.1f", getDistanceBetweenCoords3d(x, y, z, x2, y2, z2))

if checked_button_2.v then -- если вкл имгуа
if 866 == model and true then -- если объект такойто то
renderFontDrawText(font,  "Дистанция: "..distance, x1, y1, -1)
if checked_button_3.v then -- если вкл имгуа
renderDrawLine(x10, y10, x1, y1, 1.0, -1) -- чертит линию
printStringNow('AKTIVIROVAN NAHyi by Volgus', 1000) -- вывод текста на экран
end
end
end
end
end
end
без обид. но это ужасно. не могу смотреть на такой код. табуляция напрочь отсутствует
 

pep504

Известный
Автор темы
6
1
без обид. но это ужасно. не могу смотреть на такой код. табуляция напрочь отсутствует
Ну дак помоги сам)
=_= Нууу в 45 строке end не хватает. линия 17 не закрыта =_=
Не сплю третьи сутки уже, сорян 🤣
думай доперешь)

Lua:
local font = renderCreateFont("Arial", 7, 4)
local imgui = require 'imgui'
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8

while true do wait(0)
if isPlayerPlaying(playerHandle) and  enabled then
if checked_button_2.v then -- если вкл имгуа
for _, v in pairs(getAllObjects()) do
local asd
if sampGetObjectSampIdByHandle(v) then
asd = sampGetObjectSampIdByHandle(v)

end
if isObjectOnScreen(v) then -- скан объект
local _, x, y, z = getObjectCoordinates(v)
local x1, y1 = convert3DCoordsToScreen(x,y,z)
local model = getObjectModel(v)
local x2,y2,z2 = getCharCoordinates(PLAYER_PED)
local x10, y10 = convert3DCoordsToScreen(x2,y2,z2)
local distance = string.format("%.1f", getDistanceBetweenCoords3d(x, y, z, x2, y2, z2))

if checked_button_2.v then -- если вкл имгуа
if 866 == model and true then -- если объект такойто то
renderFontDrawText(font,  "Дистанция: "..distance, x1, y1, -1)
if checked_button_3.v then -- если вкл имгуа
renderDrawLine(x10, y10, x1, y1, 1.0, -1) -- чертит линию
printStringNow('AKTIVIROVAN NAHyi by Volgus', 1000) -- вывод текста на экран
end
end
end
end
end
end
Почему-то он не находит этот объект. Вроде всё вбил правильно и т.д, не чертит линию и не пишет в чат. В данном случае объект 1599.
 
Последнее редактирование:

neverlane

t.me/neverlane00
Друг
998
1,133
Ну дак помоги сам)

Не сплю третьи сутки уже, сорян 🤣

Почему-то он не находит этот объект. Вроде всё вбил правильно и т.д, не чертит линию и не пишет в чат. В данном случае объект 1599.
как я поянл, тебе надо вх на рыбы для квестов на арз (но не точно)
вх на рыбки который я делал, там можешь посмотреть как рендерить линию к объекту: https://www.blast.hk/threads/62933/post-554402
ну и кину еще как оповестить в чат если создался определенный объект
Lua:
local samp = require('samp.events') -- подключаем samp.lua

function samp.onCreateObject(objectId,data) -- хук на создание объекта
    if data.modelId == 1599 then -- если id модели объекта == 1599
        sampAddChatMessage('епаресете, где-то появилась рыбка')
    end
end
 
  • Нравится
Реакции: Fott