Изменение названия скриншота

YarikVL

Известный
Проверенный
4,795
1,814
Н

Ну изменили же в игре как то с sa-mp на rampage
Lua:
script_author('chapo and edit by YarikVL')
local ffi = require('ffi')
local hook = require("hooks")
local Count = { Full = 0, Respond = 0 }
local Address = { r1 = 0x64010, r3 = 0x679F0  }

function get_samp_version()
    if samp_base == nil or samp_base == 0 then
        samp_base = getModuleHandle("samp.dll")
    end

    if samp_base ~= 0 then
        local e_lfanew = ffi.cast("long*", samp_base + 60)[0]
        local nt_header = samp_base + e_lfanew
        local entry_point_addr = ffi.cast("unsigned int*", nt_header + 40)[0]
        if entry_point_addr == 0x31DF13 then
            return "r1"
        elseif entry_point_addr == 0xCC4D0 then
            return "r3"
        end
    end

    return "unknown"
end

function main()
    local samp = get_samp_version()
    if Address[samp] then
        sampChatHook = hook.jmp.new("void(__thiscall *)(uintptr_t this, uint32_t type, const char* text, const char* prefix, uint32_t color, uint32_t pcolor)", sampChatHook, getModuleHandle('samp.dll') + Address[samp])
    else
        sampAddChatMessage('[ConnectionRepeatCounter]: Error, use SA:MP R1 or R3', -1)
        error('dolbaeb, unsupported SAMP version')
    end
    wait(-1)
end

function sampChatHook(this, type, text, prefix, color, pcolor)
    local text = ffi.string(text)
    if text:find('^ScreenshotTaken') then
        Count.Full = Count.Full + 1
        return sampChatHook(this, type, ffi.cast('char*', "ScreenshotTaken %- sa%-mp"..tostring(Count.Full).."%.png"), prefix, color, pcolor) 
    end
    sampChatHook(this, type, text, prefix, color, pcolor)
end
Посмотри с этим скриптом. Только для его работы нужно файл отсюда: https://www.blast.hk/threads/55743/ поставить в папку lib.
Я не уверен что будет работать, потому что какой-то другой твой скрипт ( возможно asi ) скорее всего переименовывает локально названия твоих скринов в rampage.
 
  • Bug
  • Эм
Реакции: Corenale, ARMOR и kjor32

ARMOR

kjor32 is legend
Модератор
4,851
6,128
Lua:
script_author('chapo and edit by YarikVL')
local ffi = require('ffi')
local hook = require("hooks")
local Count = { Full = 0, Respond = 0 }
local Address = { r1 = 0x64010, r3 = 0x679F0  }

function get_samp_version()
    if samp_base == nil or samp_base == 0 then
        samp_base = getModuleHandle("samp.dll")
    end

    if samp_base ~= 0 then
        local e_lfanew = ffi.cast("long*", samp_base + 60)[0]
        local nt_header = samp_base + e_lfanew
        local entry_point_addr = ffi.cast("unsigned int*", nt_header + 40)[0]
        if entry_point_addr == 0x31DF13 then
            return "r1"
        elseif entry_point_addr == 0xCC4D0 then
            return "r3"
        end
    end

    return "unknown"
end

function main()
    local samp = get_samp_version()
    if Address[samp] then
        sampChatHook = hook.jmp.new("void(__thiscall *)(uintptr_t this, uint32_t type, const char* text, const char* prefix, uint32_t color, uint32_t pcolor)", sampChatHook, getModuleHandle('samp.dll') + Address[samp])
    else
        sampAddChatMessage('[ConnectionRepeatCounter]: Error, use SA:MP R1 or R3', -1)
        error('dolbaeb, unsupported SAMP version')
    end
    wait(-1)
end

function sampChatHook(this, type, text, prefix, color, pcolor)
    local text = ffi.string(text)
    if text:find('^ScreenshotTaken') then
        Count.Full = Count.Full + 1
        return sampChatHook(this, type, ffi.cast('char*', "ScreenshotTaken %- sa%-mp"..tostring(Count.Full).."%.png"), prefix, color, pcolor)
    end
    sampChatHook(this, type, text, prefix, color, pcolor)
end
Посмотри с этим скриптом. Только для его работы нужно файл отсюда: https://www.blast.hk/threads/55743/ поставить в папку lib.
Я не уверен что будет работать, потому что какой-то другой твой скрипт ( возможно asi ) скорее всего переименовывает локально названия твоих скринов в rampage.
Хуйня скрипт кста. Нахуй ставить jmp хук на сам CChat::AddMessage? Если можно хукнуть вызов функции которая и отправляет сообщение о скрине в чат и не нужно будет делать уебищных проверок на то есть ли в аргументе функции слово ScreenshotTaken

Вот код:
Lua:
script_author("Копирайты в таких маленьких скриптах делают только долбоебы")
local hook = require 'hooks'
local memory = require 'memory'
local ffi = require 'ffi'
local samp_base = nil

local addr = {
    [0x31DF13] = 0x710DD, -- R1
    [0xCC4D0] = 0x74FCD, -- R3
}

function main()
    if samp_base == nil then
        samp_base = getModuleHandle("samp.dll")
        if samp_base ~= 0 then
            local nt_header = samp_base + ffi.cast("long*", samp_base + 60)[0]
            local entry_point_addr = ffi.cast("unsigned int*", nt_header + 40)[0]
            if addr[entry_point_addr] ~= nil then
                screenHook = hook.call.new("void(__cdecl*)(void* CChat, const char* Format, int ArgList)", screenHook, samp_base + addr[entry_point_addr])
            end
        end
    end
end

function screenHook(this_, text, arg1)
    screenHook(this_, ffi.cast("const char* ", "СДЕЛАН СКРИНШОТ"), arg1) -- В аргументе arg1 хранится номер скриншота. Если заменить текст на такой "Сделан скриншот номер: %d" то ты получишь текст с номером сделаного скриншота.
end

1680702184723.png


123.jpg
 
Последнее редактирование:
  • Нравится
Реакции: kjor32