Не хукается текст GameText'a

Dmitriy Makarov

25.05.2021
Автор темы
Проверенный
2,505
1,134
Версия MoonLoader
.026-beta
Не хукается этот текст
sa-mp-001.png

Не хукается именно текст. Стиль и время хукается
Код:
Lua:
function sampev.onDisplayGameText(style, time, text)
    sampAddChatMessage(text, -1)
    sampAddChatMessage(time, -1)
    sampAddChatMessage(style, -1)
end
Чатлог:
Код:
[19:38:18]                       -- Text (Пустая строка)
[19:38:18] 3000                  -- Time
[19:38:18] 3                     -- Style
 
  • Нравится
Реакции: copypaste_scripter
Решение
INCOMING_RPCS[RPC.DISPLAYGAMETEXT] = {'onDisplayGameText', {style = 'int32'}, {time = 'int32'}, {text = 'string8'}}
onShowTextDraw:
--- onShowTextDraw
function handler.on_show_textdraw_reader(bs)
    local read = BitStreamIO.bs_read
    local data = {}
    local textdrawId = read.int16(bs)
    data.flags = read.int8(bs)
    data.letterWidth = read.float(bs)
    data.letterHeight = read.float(bs)
    data.letterColor = read.int32(bs)
    data.lineWidth = read.float(bs)
    data.lineHeight = read.float(bs)
    data.boxColor = read.int32(bs)
    data.shadow = read.int8(bs)
    data.outline = read.int8(bs)
    data.backgroundColor = read.int32(bs)
    data.style = read.int8(bs)
    data.selectable = read.int8(bs)...

Dmitriy Makarov

25.05.2021
Автор темы
Проверенный
2,505
1,134
Уверен что это gameText? По моему это Textdraw.
С текстдравом такое в чатлоге
Код:
[19:46:00] _
[19:46:00] _
[19:46:00]
[19:46:00] PROGRESS
[19:46:00] New Textdraw
[19:46:12] _
[19:46:12] _
[19:46:12] _
[19:46:13] _
[19:46:13] _
[19:46:13] _
Lua:
function sampev.onShowTextDraw(id, data)
    sampAddChatMessage(data.text, -1)
end
Он хукнул это
sa-mp-000.png
 

k0shaK

Известный
147
112
Не хукается этот текст
Посмотреть вложение 50901
Не хукается именно текст. Стиль и время хукается
Код:
Lua:
function sampev.onDisplayGameText(style, time, text)
    sampAddChatMessage(text, -1)
    sampAddChatMessage(time, -1)
    sampAddChatMessage(style, -1)
end
Чатлог:
Код:
[19:38:18]                       -- Text (Пустая строка)
[19:38:18] 3000                  -- Time
[19:38:18] 3                     -- Style
Проверь, правильно ли ты прописал параметры. Когда я летом писал бота на рыбалку, у меня все работало
 

Dmitriy Makarov

25.05.2021
Автор темы
Проверенный
2,505
1,134
Проверь, правильно ли ты прописал параметры. Когда я летом писал бота на рыбалку, у меня все работало
INCOMING_RPCS[RPC.DISPLAYGAMETEXT] = {'onDisplayGameText', {style = 'int32'}, {time = 'int32'}, {text = 'string8'}}
onShowTextDraw:
--- onShowTextDraw
function handler.on_show_textdraw_reader(bs)
    local read = BitStreamIO.bs_read
    local data = {}
    local textdrawId = read.int16(bs)
    data.flags = read.int8(bs)
    data.letterWidth = read.float(bs)
    data.letterHeight = read.float(bs)
    data.letterColor = read.int32(bs)
    data.lineWidth = read.float(bs)
    data.lineHeight = read.float(bs)
    data.boxColor = read.int32(bs)
    data.shadow = read.int8(bs)
    data.outline = read.int8(bs)
    data.backgroundColor = read.int32(bs)
    data.style = read.int8(bs)
    data.selectable = read.int8(bs)
    data.position = read.vector2d(bs)
    data.modelId = read.int16(bs)
    data.rotation = read.vector3d(bs)
    data.zoom = read.float(bs)
    data.color = read.int32(bs)
    data.text = read.string16(bs)
    return {textdrawId, data}
end

function handler.on_show_textdraw_writer(bs, data)
    local write = BitStreamIO.bs_write
    local textdrawId = data[1]
    local data = data[2]
    write.int16(bs, textdrawId)
    write.int8(bs, data.flags)
    write.float(bs, data.letterWidth)
    write.float(bs, data.letterHeight)
    write.int32(bs, data.letterColor)
    write.float(bs, data.lineWidth)
    write.float(bs, data.lineHeight)
    write.int32(bs, data.boxColor)
    write.int8(bs, data.shadow)
    write.int8(bs, data.outline)
    write.int32(bs, data.backgroundColor)
    write.int8(bs, data.selectable)
    write.vector2d(bs, data.position)
    write.int16(bs, data.modelId)
    write.vector3d(bs, data.rotation)
    write.float(bs, data.zoom)
    write.int32(bs, data.color)
    write.string16(bs, data.text)
end

local function read_object_material(bs)
    local read = BitStreamIO.bs_read
    local data = {}
    data.materialId = read.int8(bs)
    data.modelId = read.int16(bs)
    data.libraryName = read.string8(bs)
    data.textureName = read.string8(bs)
    data.color = read.int32(bs)
    return data
end

local function write_object_material(bs, data)
    local write = BitStreamIO.bs_write
    write.int8(bs, 1)
    write.int8(bs, data.materialId)
    write.int16(bs, data.modelId)
    write.string8(bs, data.libraryName)
    write.string8(bs, data.textureName)
    write.int32(bs, data.color)
end

local function read_object_material_text(bs)
    local read = BitStreamIO.bs_read
    local data = {}
    data.materialId = read.int8(bs)
    data.materialSize = read.int8(bs)
    data.fontName = read.string8(bs)
    data.fontSize = read.int8(bs)
    data.bold = read.int8(bs)
    data.fontColor = read.int32(bs)
    data.backGroundColor = read.int32(bs)
    data.align = read.int8(bs)
    data.text = read.encodedString2048(bs)
    return data
end

local function write_object_material_text(bs, data)
    local write = BitStreamIO.bs_write
    write.int8(bs, 2)
    write.int8(bs, data.materialId)
    write.int8(bs, data.materialSize)
    write.string8(bs, data.fontName)
    write.int8(bs, data.fontSize)
    write.int8(bs, data.bold)
    write.int32(bs, data.fontColor)
    write.int32(bs, data.backGroundColor)
    write.int8(bs, data.align)
    write.encodedString2048(bs, data.text)
end
 
  • Нравится
Реакции: влад динозавр

k0shaK

Известный
147
112
INCOMING_RPCS[RPC.DISPLAYGAMETEXT] = {'onDisplayGameText', {style = 'int32'}, {time = 'int32'}, {text = 'string8'}}
onShowTextDraw:
--- onShowTextDraw
function handler.on_show_textdraw_reader(bs)
    local read = BitStreamIO.bs_read
    local data = {}
    local textdrawId = read.int16(bs)
    data.flags = read.int8(bs)
    data.letterWidth = read.float(bs)
    data.letterHeight = read.float(bs)
    data.letterColor = read.int32(bs)
    data.lineWidth = read.float(bs)
    data.lineHeight = read.float(bs)
    data.boxColor = read.int32(bs)
    data.shadow = read.int8(bs)
    data.outline = read.int8(bs)
    data.backgroundColor = read.int32(bs)
    data.style = read.int8(bs)
    data.selectable = read.int8(bs)
    data.position = read.vector2d(bs)
    data.modelId = read.int16(bs)
    data.rotation = read.vector3d(bs)
    data.zoom = read.float(bs)
    data.color = read.int32(bs)
    data.text = read.string16(bs)
    return {textdrawId, data}
end

function handler.on_show_textdraw_writer(bs, data)
    local write = BitStreamIO.bs_write
    local textdrawId = data[1]
    local data = data[2]
    write.int16(bs, textdrawId)
    write.int8(bs, data.flags)
    write.float(bs, data.letterWidth)
    write.float(bs, data.letterHeight)
    write.int32(bs, data.letterColor)
    write.float(bs, data.lineWidth)
    write.float(bs, data.lineHeight)
    write.int32(bs, data.boxColor)
    write.int8(bs, data.shadow)
    write.int8(bs, data.outline)
    write.int32(bs, data.backgroundColor)
    write.int8(bs, data.selectable)
    write.vector2d(bs, data.position)
    write.int16(bs, data.modelId)
    write.vector3d(bs, data.rotation)
    write.float(bs, data.zoom)
    write.int32(bs, data.color)
    write.string16(bs, data.text)
end

local function read_object_material(bs)
    local read = BitStreamIO.bs_read
    local data = {}
    data.materialId = read.int8(bs)
    data.modelId = read.int16(bs)
    data.libraryName = read.string8(bs)
    data.textureName = read.string8(bs)
    data.color = read.int32(bs)
    return data
end

local function write_object_material(bs, data)
    local write = BitStreamIO.bs_write
    write.int8(bs, 1)
    write.int8(bs, data.materialId)
    write.int16(bs, data.modelId)
    write.string8(bs, data.libraryName)
    write.string8(bs, data.textureName)
    write.int32(bs, data.color)
end

local function read_object_material_text(bs)
    local read = BitStreamIO.bs_read
    local data = {}
    data.materialId = read.int8(bs)
    data.materialSize = read.int8(bs)
    data.fontName = read.string8(bs)
    data.fontSize = read.int8(bs)
    data.bold = read.int8(bs)
    data.fontColor = read.int32(bs)
    data.backGroundColor = read.int32(bs)
    data.align = read.int8(bs)
    data.text = read.encodedString2048(bs)
    return data
end

local function write_object_material_text(bs, data)
    local write = BitStreamIO.bs_write
    write.int8(bs, 2)
    write.int8(bs, data.materialId)
    write.int8(bs, data.materialSize)
    write.string8(bs, data.fontName)
    write.int8(bs, data.fontSize)
    write.int8(bs, data.bold)
    write.int32(bs, data.fontColor)
    write.int32(bs, data.backGroundColor)
    write.int8(bs, data.align)
    write.encodedString2048(bs, data.text)
end
Попробуй через принт, авось поможет пэвэазпж
 

Dmitriy Makarov

25.05.2021
Автор темы
Проверенный
2,505
1,134
Попробуй через принт, авось поможет пэвэазпж
Не хочет)
Код:
[ML] (script) testscript.lua: Style: 3
[ML] (script) testscript.lua: Time: 3000
[ML] (script) testscript.lua: Text:
Он хукает только тайм и стайл, но не текст..
Есть еще onTextDrawSetString, попробуй его
Не, он не хукнул
Он хукнул скорее всего это
sa-mp-000.png

Так как он мне вывел 1 раз ID
Код:
[21:57:42] ID: 2066
 

KepchiK

Народный луа скриптер
Друг
118
674
INCOMING_RPCS[RPC.DISPLAYGAMETEXT] = {'onDisplayGameText', {style = 'int32'}, {time = 'int32'}, {text = 'string8'}}
onShowTextDraw:
--- onShowTextDraw
function handler.on_show_textdraw_reader(bs)
    local read = BitStreamIO.bs_read
    local data = {}
    local textdrawId = read.int16(bs)
    data.flags = read.int8(bs)
    data.letterWidth = read.float(bs)
    data.letterHeight = read.float(bs)
    data.letterColor = read.int32(bs)
    data.lineWidth = read.float(bs)
    data.lineHeight = read.float(bs)
    data.boxColor = read.int32(bs)
    data.shadow = read.int8(bs)
    data.outline = read.int8(bs)
    data.backgroundColor = read.int32(bs)
    data.style = read.int8(bs)
    data.selectable = read.int8(bs)
    data.position = read.vector2d(bs)
    data.modelId = read.int16(bs)
    data.rotation = read.vector3d(bs)
    data.zoom = read.float(bs)
    data.color = read.int32(bs)
    data.text = read.string16(bs)
    return {textdrawId, data}
end

function handler.on_show_textdraw_writer(bs, data)
    local write = BitStreamIO.bs_write
    local textdrawId = data[1]
    local data = data[2]
    write.int16(bs, textdrawId)
    write.int8(bs, data.flags)
    write.float(bs, data.letterWidth)
    write.float(bs, data.letterHeight)
    write.int32(bs, data.letterColor)
    write.float(bs, data.lineWidth)
    write.float(bs, data.lineHeight)
    write.int32(bs, data.boxColor)
    write.int8(bs, data.shadow)
    write.int8(bs, data.outline)
    write.int32(bs, data.backgroundColor)
    write.int8(bs, data.selectable)
    write.vector2d(bs, data.position)
    write.int16(bs, data.modelId)
    write.vector3d(bs, data.rotation)
    write.float(bs, data.zoom)
    write.int32(bs, data.color)
    write.string16(bs, data.text)
end

local function read_object_material(bs)
    local read = BitStreamIO.bs_read
    local data = {}
    data.materialId = read.int8(bs)
    data.modelId = read.int16(bs)
    data.libraryName = read.string8(bs)
    data.textureName = read.string8(bs)
    data.color = read.int32(bs)
    return data
end

local function write_object_material(bs, data)
    local write = BitStreamIO.bs_write
    write.int8(bs, 1)
    write.int8(bs, data.materialId)
    write.int16(bs, data.modelId)
    write.string8(bs, data.libraryName)
    write.string8(bs, data.textureName)
    write.int32(bs, data.color)
end

local function read_object_material_text(bs)
    local read = BitStreamIO.bs_read
    local data = {}
    data.materialId = read.int8(bs)
    data.materialSize = read.int8(bs)
    data.fontName = read.string8(bs)
    data.fontSize = read.int8(bs)
    data.bold = read.int8(bs)
    data.fontColor = read.int32(bs)
    data.backGroundColor = read.int32(bs)
    data.align = read.int8(bs)
    data.text = read.encodedString2048(bs)
    return data
end

local function write_object_material_text(bs, data)
    local write = BitStreamIO.bs_write
    write.int8(bs, 2)
    write.int8(bs, data.materialId)
    write.int8(bs, data.materialSize)
    write.string8(bs, data.fontName)
    write.int8(bs, data.fontSize)
    write.int8(bs, data.bold)
    write.int32(bs, data.fontColor)
    write.int32(bs, data.backGroundColor)
    write.int8(bs, data.align)
    write.encodedString2048(bs, data.text)
end
фига себе у тебя старая версия самп луа ведь эту ошибку пофиксили ещё в 2017
качай последнюю версию и все будет ок
 

copypaste_scripter

Известный
1,295
249
фига себе у тебя старая версия самп луа ведь эту ошибку пофиксили ещё в 2017
качай последнюю версию и все будет ок
можно ещё просто ту линию в events.lua в папке moonloader/lib/samp/ 8 заменить на 32 и будет збс, я так сделал