LUA скрипт [gs] better load luas / load on startup

  • Автор темы Автор темы amiiiil
  • Дата начала Дата начала
Read Only
Read Only
Статус
Оффлайн
Регистрация
2 Май 2022
Сообщения
460
Реакции
68
Код:
Expand Collapse Copy
local ffi = require 'ffi'
local clipboard = require 'gamesense/clipboard'
local base64 = require "gamesense/base64"
local vector = require "vector"
local http = require 'gamesense/http'

local path, csgo_files do
    local fsdll = "filesystem_stdio.dll"
    local fs = "VFileSystem017"
    
    local int_ptr = ffi.typeof("int[1]")
    local char_buffer = ffi.typeof("char[?]")
    
    local function sig_bind(module, interface, signature, typestring)
        local iface = client.create_interface(module, interface) or error("invalid interface", 2)
        local instance = client.find_signature(module, signature) or error("invalid signature", 2)
        local success, typeof = pcall(ffi.typeof, typestring)
    
        if not success then
            error(typeof, 2)
        end
    
        local fnptr = ffi.cast(typeof, instance) or error("invalid typecast", 2)
    
        return function(...)
            return fnptr(iface, ...)
        end
    end

    local add_to_searchpath = vtable_bind("filesystem_stdio.dll", "VFileSystem017", 11, "void(__thiscall*)(void*, const char*, const char*, int)");
    local find_next = sig_bind(fsdll, fs, "\x55\x8B\xEC\x83\xEC\x0C\x53\x8B\xD9\x8B\x0D\xCC\xCC\xCC\xCC", "const char*(__thiscall*)(void*, int)")
    local find_is_directory = sig_bind(fsdll, fs, "\x55\x8B\xEC\x0F\xB7\x45\x08", "bool(__thiscall*)(void*, int)")
    local find_close = sig_bind(fsdll, fs, "\x55\x8B\xEC\x53\x8B\x5D\x08\x85", "void(__thiscall*)(void*, int)")
    local find_first = sig_bind(fsdll, fs, "\x55\x8B\xEC\x6A\x00\xFF\x75\x10\xFF\x75\x0C\xFF\x75\x08\xE8\xCC\xCC\xCC\xCC\x5D", "const char*(__thiscall*)(void*, const char*, const char*, int*)")
    local get_current_directory = sig_bind(fsdll, fs, "\x55\x8B\xEC\x56\x8B\x75\x08\x56\xFF\x75\x0C", "bool(__thiscall*)(void*, char*, int)")

    local csgo_folder = char_buffer(128)
    get_current_directory(csgo_folder, ffi.sizeof(csgo_folder))

    csgo_folder = ffi.string(csgo_folder)
    add_to_searchpath(csgo_folder, "", 0)

    local function get_lua_files()
        local found_files = {}
        local fileHandle = int_ptr()
        local fileName = find_first("*", "", fileHandle)
    
        while fileName ~= nil do
            local conv = ffi.string(fileName)
    
            if not find_is_directory(fileHandle[0]) and conv:find('.lua') then
                table.insert(found_files, conv)
            end
    
            fileName = find_next(fileHandle[0])
        end
        find_close(fileHandle[0])
        return found_files
    end

    path = csgo_folder
    csgo_files = get_lua_files()
end

local menu_c = ui.reference("misc", "settings", "menu color")
local menu = {ui.get(menu_c)}
local hexed_menu = string.format( '%02x%02x%02x%02x', menu[1], menu[2], menu[3], menu[4] )

local reload_active_scripts = ui.new_button("lua", "b", "Reload active scripts", client.reload_active_scripts)
local list_menu = ui.new_listbox("lua", "b", " ", {})

local db = {
    status = {},
    names = {},
    loaded = database.read("shh") or { }
}

local last_click_index = -1
local last_click_time = 0

local lua = {};

function lua.update_list()
    for _, name in ipairs(csgo_files) do
        db.status[name] = false

        table.insert(db.names, name)

        ui.update(list_menu, db.names)
    end
end

lua.update_list()

function lua.custom_load(item)
    local lua_path = path .. "/" .. item

    if readfile(lua_path) ~= nil then
        local source = load(readfile(lua_path))

        db.loaded[item] = true
        db.status[item] = true

        database.write("shh", db.loaded)

        for i, name in ipairs(db.names) do
            if name:match(item) then
                db.names[i] = "\a" .. hexed_menu .. name


                ui.update(list_menu, db.names)
                break;
            end
        end

        source()
    end
end

function lua.custom_unload(item)
    db.loaded[item] = nil
    database.write("shh", db.loaded)
    db.status[item] = false
    client.reload_active_scripts()
end

function lua.click_load()
    local value = ui.get(list_menu) + 1

    if value == nil then
        return
    end

    local curtime = globals.curtime()

    if last_click_index == value and last_click_time + 0.5 > curtime then
        local item = ui.get(list_menu, value) + 1
        local selected = csgo_files[item]

        db.status[selected] = not (db.status[selected] or false)

        if db.status[selected] ~= nil and db.status[selected] == true then
            lua.custom_load(selected)
        else
            lua.custom_unload(selected)
        end

        last_click_index = -1
    else
        last_click_index = value
        last_click_time = curtime
    end

end

function lua.automatic_load()
    for script_name, is_loaded in pairs(db.loaded) do
        if is_loaded then
            lua.custom_load(script_name)
        end
    end
end

lua.automatic_load()

ui.set_callback(list_menu, lua.click_load)
видел что многие плакали, ибо в кряке нет load on startup, и каждый запуск все сбивается.


1. загрузите основную луа
2. в LUA табе появился лист со всеми доступными луа, загрузите вам нужные двойным кликом(запуск-autoload on startup)


*На каждом заходе в игру просто запускайте луа скрипт из пункта 1, и все готово

ОПАСНОСТЬ!!!

Не загружайте в листе луа, которую вы скачали в первом пункте, не загружайте обфусцированные файлы (они могут повлиять на ФПС, либо скрипт попросту не загрузится)
 
Последнее редактирование:
Код:
Expand Collapse Copy
local ffi = require 'ffi'
local clipboard = require 'gamesense/clipboard'
local base64 = require "gamesense/base64"
local vector = require "vector"
local http = require 'gamesense/http'

local path, csgo_files do
    local fsdll = "filesystem_stdio.dll"
    local fs = "VFileSystem017"
   
    local int_ptr = ffi.typeof("int[1]")
    local char_buffer = ffi.typeof("char[?]")
   
    local function sig_bind(module, interface, signature, typestring)
        local iface = client.create_interface(module, interface) or error("invalid interface", 2)
        local instance = client.find_signature(module, signature) or error("invalid signature", 2)
        local success, typeof = pcall(ffi.typeof, typestring)
   
        if not success then
            error(typeof, 2)
        end
   
        local fnptr = ffi.cast(typeof, instance) or error("invalid typecast", 2)
   
        return function(...)
            return fnptr(iface, ...)
        end
    end

    local add_to_searchpath = vtable_bind("filesystem_stdio.dll", "VFileSystem017", 11, "void(__thiscall*)(void*, const char*, const char*, int)");
    local find_next = sig_bind(fsdll, fs, "\x55\x8B\xEC\x83\xEC\x0C\x53\x8B\xD9\x8B\x0D\xCC\xCC\xCC\xCC", "const char*(__thiscall*)(void*, int)")
    local find_is_directory = sig_bind(fsdll, fs, "\x55\x8B\xEC\x0F\xB7\x45\x08", "bool(__thiscall*)(void*, int)")
    local find_close = sig_bind(fsdll, fs, "\x55\x8B\xEC\x53\x8B\x5D\x08\x85", "void(__thiscall*)(void*, int)")
    local find_first = sig_bind(fsdll, fs, "\x55\x8B\xEC\x6A\x00\xFF\x75\x10\xFF\x75\x0C\xFF\x75\x08\xE8\xCC\xCC\xCC\xCC\x5D", "const char*(__thiscall*)(void*, const char*, const char*, int*)")
    local get_current_directory = sig_bind(fsdll, fs, "\x55\x8B\xEC\x56\x8B\x75\x08\x56\xFF\x75\x0C", "bool(__thiscall*)(void*, char*, int)")

    local csgo_folder = char_buffer(128)
    get_current_directory(csgo_folder, ffi.sizeof(csgo_folder))

    csgo_folder = ffi.string(csgo_folder)
    add_to_searchpath(csgo_folder, "", 0)

    local function get_lua_files()
        local found_files = {}
        local fileHandle = int_ptr()
        local fileName = find_first("*", "", fileHandle)
   
        while fileName ~= nil do
            local conv = ffi.string(fileName)
   
            if not find_is_directory(fileHandle[0]) and conv:find('.lua') then
                table.insert(found_files, conv)
            end
   
            fileName = find_next(fileHandle[0])
        end
        find_close(fileHandle[0])
        return found_files
    end

    path = csgo_folder
    csgo_files = get_lua_files()
end

local menu_c = ui.reference("misc", "settings", "menu color")
local menu = {ui.get(menu_c)}
local hexed_menu = string.format( '%02x%02x%02x%02x', menu[1], menu[2], menu[3], menu[4] )

local reload_active_scripts = ui.new_button("lua", "b", "Reload active scripts", client.reload_active_scripts)
local list_menu = ui.new_listbox("lua", "b", " ", {})

local db = {
    status = {},
    names = {},
    loaded = database.read("shh") or { }
}

local last_click_index = -1
local last_click_time = 0

local lua = {};

function lua.update_list()
    for _, name in ipairs(csgo_files) do
        db.status[name] = false

        table.insert(db.names, name)

        ui.update(list_menu, db.names)
    end
end

lua.update_list()

function lua.custom_load(item)
    local lua_path = path .. "/" .. item

    if readfile(lua_path) ~= nil then
        local source = load(readfile(lua_path))

        db.loaded[item] = true
        db.status[item] = true

        database.write("shh", db.loaded)

        for i, name in ipairs(db.names) do
            if name:match(item) then
                db.names[i] = "\a" .. hexed_menu .. name


                ui.update(list_menu, db.names)
                break;
            end
        end

        source()
    end
end

function lua.custom_unload(item)
    db.loaded[item] = nil
    database.write("shh", db.loaded)
    db.status[item] = false
    client.reload_active_scripts()
end

function lua.click_load()
    local value = ui.get(list_menu) + 1

    if value == nil then
        return
    end

    local curtime = globals.curtime()

    if last_click_index == value and last_click_time + 0.5 > curtime then
        local item = ui.get(list_menu, value) + 1
        local selected = csgo_files[item]

        db.status[selected] = not (db.status[selected] or false)

        if db.status[selected] ~= nil and db.status[selected] == true then
            lua.custom_load(selected)
        else
            lua.custom_unload(selected)
        end

        last_click_index = -1
    else
        last_click_index = value
        last_click_time = curtime
    end

end

function lua.automatic_load()
    for script_name, is_loaded in pairs(db.loaded) do
        if is_loaded then
            lua.custom_load(script_name)
        end
    end
end

lua.automatic_load()

ui.set_callback(list_menu, lua.click_load)
видел что многие плакали, ибо в кряке нет load on startup, и каждый запуск все сбивается.


1. загрузите основную луа
2. в LUA табе появился лист со всеми доступными луа, загрузите вам нужные двойным кликом(запуск-autoload on startup)


*На каждом заходе в игру просто запускайте луа скрипт из пункта 1, и все готово

ОПАСНОСТЬ!!!

Не загружайте в листе луа, которую вы скачали в первом пункте, не загружайте обфусцированные файлы (они могут повлиять на ФПС, либо скрипт попросту не загрузится)
1737553147777.png
 
мышка дкликнула на твою луашку в луа табе, и теперь скрипт не запускается, хд)

знаю, что ты об этом писал и предупреждал, но вопросик ебать: как фиксится то?:tongueout:
 
script:
Expand Collapse Copy
local function check_for_exists()
    local search = ui.reference("lua", "b", "Reload active scripts")
    if search then
        return true
    else
        return false
    end
end

local status, result = xpcall(check_for_exists, function() print "error handled" end)

if status or result then
    return
end

local ffi = require 'ffi'
local clipboard = require 'gamesense/clipboard'
local base64 = require "gamesense/base64"
local vector = require "vector"
local http = require 'gamesense/http'

local function sig_bind(module, interface, signature, typestring)
    local iface = client.create_interface(module, interface) or error("invalid interface", 2)
    local instance = client.find_signature(module, signature) or error("invalid signature", 2)
    local success, typeof = pcall(ffi.typeof, typestring)

    if not success then
        error(typeof, 2)
    end

    local fnptr = ffi.cast(typeof, instance) or error("invalid typecast", 2)

    return function(...)
        return fnptr(iface, ...)
    end
end

local fsdll = "filesystem_stdio.dll"
local fs = "VFileSystem017"

local int_ptr = ffi.typeof("int[1]")
local char_buffer = ffi.typeof("char[?]")

local add_to_searchpath = vtable_bind("filesystem_stdio.dll", "VFileSystem017", 11, "void(__thiscall*)(void*, const char*, const char*, int)");
local find_next = sig_bind(fsdll, fs, "\x55\x8B\xEC\x83\xEC\x0C\x53\x8B\xD9\x8B\x0D\xCC\xCC\xCC\xCC", "const char*(__thiscall*)(void*, int)")
local find_is_directory = sig_bind(fsdll, fs, "\x55\x8B\xEC\x0F\xB7\x45\x08", "bool(__thiscall*)(void*, int)")
local find_close = sig_bind(fsdll, fs, "\x55\x8B\xEC\x53\x8B\x5D\x08\x85", "void(__thiscall*)(void*, int)")
local find_first = sig_bind(fsdll, fs, "\x55\x8B\xEC\x6A\x00\xFF\x75\x10\xFF\x75\x0C\xFF\x75\x08\xE8\xCC\xCC\xCC\xCC\x5D", "const char*(__thiscall*)(void*, const char*, const char*, int*)")
local get_current_directory = sig_bind(fsdll, fs, "\x55\x8B\xEC\x56\x8B\x75\x08\x56\xFF\x75\x0C", "bool(__thiscall*)(void*, char*, int)")

local csgo_folder = char_buffer(128)
get_current_directory(csgo_folder, ffi.sizeof(csgo_folder))

csgo_folder = ffi.string(csgo_folder)
add_to_searchpath(csgo_folder, "", 0)

local path = csgo_folder
local lua_table = {}

do
    local fileHandle = int_ptr()
    local fileName = find_first("*", "", fileHandle)

    while fileName ~= nil do
        local conv = ffi.string(fileName)

        if not find_is_directory(fileHandle[0]) and conv:find('.lua') and not conv:find("autoload") then
            table.insert(lua_table, conv)
        end

        fileName = find_next(fileHandle[0])
    end
    find_close(fileHandle[0])
end

local menu_c = ui.reference("misc", "settings", "menu color")
local menu = {ui.get(menu_c)}
local hexed_menu = string.format( '%02x%02x%02x%02x', menu[1], menu[2], menu[3], menu[4] )

local reload_active_scripts = ui.new_button("lua", "b", "Reload active scripts", client.reload_active_scripts)
local list_menu = ui.new_listbox("lua", "b", "lua list", {})

local db = {
    status = {},
    names = {},
    loaded = database.read("shh") or { }
}

local last_click_index = -1
local last_click_time = 0

local lua = {};

function lua.update_list()
    for _, name in ipairs(lua_table) do
        db.status[name] = false

        table.insert(db.names, name)

        ui.update(list_menu, db.names)
    end
end

lua.update_list()

function lua.custom_load(item)
    local lua_path = path .. "/" .. item

    if readfile(lua_path) ~= nil then
        local source = load(readfile(lua_path))

        db.loaded[item] = true
        db.status[item] = true

        database.write("shh", db.loaded)

        for i, name in ipairs(db.names) do
            if name:match(item) then
                db.names[i] = "\a" .. hexed_menu .. name


                ui.update(list_menu, db.names)
                break;
            end
        end

        source()
    end
end

function lua.custom_unload(item)
    db.loaded[item] = nil
    database.write("shh", db.loaded)
    db.status[item] = false
    client.reload_active_scripts()
end

function lua.click_load()
    local value = ui.get(list_menu) + 1

    if value == nil then
        return
    end

    local curtime = globals.curtime()

    if last_click_index == value and last_click_time + 0.5 > curtime then
        local item = ui.get(list_menu, value) + 1
        local selected = lua_table[item]

        db.status[selected] = not (db.status[selected] or false)

        if db.status[selected] ~= nil and db.status[selected] == true then
            lua.custom_load(selected)
        else
            lua.custom_unload(selected)
        end

        last_click_index = -1
    else
        last_click_index = value
        last_click_time = curtime
    end

end

function lua.automatic_load()
    for script_name, is_loaded in pairs(db.loaded) do
        if is_loaded then
            lua.custom_load(script_name)
        end
    end
end

lua.automatic_load()

ui.set_callback(list_menu, lua.click_load)

Немного доработанный скрипт, не советую переименовывать, а если уж и хочется добавить 1 в начало, главное чтобы был autoload в названии, но если вы вдруг переименовали, то есть ещё одна забавная проверка, чтоб точно не образовалась рекурсия.
 
мышка дкликнула на твою луашку в луа табе, и теперь скрипт не запускается, хд)

знаю, что ты об этом писал и предупреждал, но вопросик ебать: как фиксится то?:tongueout:
я гляну, скинь видос о чем ты, я посмотрю и исправлю
 
я гляну, скинь видос о чем ты, я посмотрю и исправлю
WatermelonCat уже исправил и допилил скрипт. Все теперь ок, и сам скрипт в списке не появляется, чтобы избежать казусов) Но ты молодец, обошел защиту скита, похвально. Поставил бы реакт, но я новокек:tonguewink:
скинь байбот этот, кстати, пожалуйста. потерял его и не могу найти
 
WatermelonCat уже исправил и допилил скрипт. Все теперь ок, и сам скрипт в списке не появляется, чтобы избежать казусов) Но ты молодец, обошел защиту скита, похвально. Поставил бы реакт, но я новокек:tonguewink:

скинь байбот этот, кстати, пожалуйста. потерял его и не могу найти
поставил за тебя реакт
 
Ребят помогите плиз как сделать чтоб луашки грузились сразу, а то не понимаю как чё делать
 
это что [gamesense] [string "slot0 = require("ffi")..."]:36: bad argument #2 to 'cast' (value expected)
 
Код:
Expand Collapse Copy
local ffi = require 'ffi'
local clipboard = require 'gamesense/clipboard'
local base64 = require "gamesense/base64"
local vector = require "vector"
local http = require 'gamesense/http'

local path, csgo_files do
    local fsdll = "filesystem_stdio.dll"
    local fs = "VFileSystem017"
   
    local int_ptr = ffi.typeof("int[1]")
    local char_buffer = ffi.typeof("char[?]")
   
    local function sig_bind(module, interface, signature, typestring)
        local iface = client.create_interface(module, interface) or error("invalid interface", 2)
        local instance = client.find_signature(module, signature) or error("invalid signature", 2)
        local success, typeof = pcall(ffi.typeof, typestring)
   
        if not success then
            error(typeof, 2)
        end
   
        local fnptr = ffi.cast(typeof, instance) or error("invalid typecast", 2)
   
        return function(...)
            return fnptr(iface, ...)
        end
    end

    local add_to_searchpath = vtable_bind("filesystem_stdio.dll", "VFileSystem017", 11, "void(__thiscall*)(void*, const char*, const char*, int)");
    local find_next = sig_bind(fsdll, fs, "\x55\x8B\xEC\x83\xEC\x0C\x53\x8B\xD9\x8B\x0D\xCC\xCC\xCC\xCC", "const char*(__thiscall*)(void*, int)")
    local find_is_directory = sig_bind(fsdll, fs, "\x55\x8B\xEC\x0F\xB7\x45\x08", "bool(__thiscall*)(void*, int)")
    local find_close = sig_bind(fsdll, fs, "\x55\x8B\xEC\x53\x8B\x5D\x08\x85", "void(__thiscall*)(void*, int)")
    local find_first = sig_bind(fsdll, fs, "\x55\x8B\xEC\x6A\x00\xFF\x75\x10\xFF\x75\x0C\xFF\x75\x08\xE8\xCC\xCC\xCC\xCC\x5D", "const char*(__thiscall*)(void*, const char*, const char*, int*)")
    local get_current_directory = sig_bind(fsdll, fs, "\x55\x8B\xEC\x56\x8B\x75\x08\x56\xFF\x75\x0C", "bool(__thiscall*)(void*, char*, int)")

    local csgo_folder = char_buffer(128)
    get_current_directory(csgo_folder, ffi.sizeof(csgo_folder))

    csgo_folder = ffi.string(csgo_folder)
    add_to_searchpath(csgo_folder, "", 0)

    local function get_lua_files()
        local found_files = {}
        local fileHandle = int_ptr()
        local fileName = find_first("*", "", fileHandle)
   
        while fileName ~= nil do
            local conv = ffi.string(fileName)
   
            if not find_is_directory(fileHandle[0]) and conv:find('.lua') then
                table.insert(found_files, conv)
            end
   
            fileName = find_next(fileHandle[0])
        end
        find_close(fileHandle[0])
        return found_files
    end

    path = csgo_folder
    csgo_files = get_lua_files()
end

local menu_c = ui.reference("misc", "settings", "menu color")
local menu = {ui.get(menu_c)}
local hexed_menu = string.format( '%02x%02x%02x%02x', menu[1], menu[2], menu[3], menu[4] )

local reload_active_scripts = ui.new_button("lua", "b", "Reload active scripts", client.reload_active_scripts)
local list_menu = ui.new_listbox("lua", "b", " ", {})

local db = {
    status = {},
    names = {},
    loaded = database.read("shh") or { }
}

local last_click_index = -1
local last_click_time = 0

local lua = {};

function lua.update_list()
    for _, name in ipairs(csgo_files) do
        db.status[name] = false

        table.insert(db.names, name)

        ui.update(list_menu, db.names)
    end
end

lua.update_list()

function lua.custom_load(item)
    local lua_path = path .. "/" .. item

    if readfile(lua_path) ~= nil then
        local source = load(readfile(lua_path))

        db.loaded[item] = true
        db.status[item] = true

        database.write("shh", db.loaded)

        for i, name in ipairs(db.names) do
            if name:match(item) then
                db.names[i] = "\a" .. hexed_menu .. name


                ui.update(list_menu, db.names)
                break;
            end
        end

        source()
    end
end

function lua.custom_unload(item)
    db.loaded[item] = nil
    database.write("shh", db.loaded)
    db.status[item] = false
    client.reload_active_scripts()
end

function lua.click_load()
    local value = ui.get(list_menu) + 1

    if value == nil then
        return
    end

    local curtime = globals.curtime()

    if last_click_index == value and last_click_time + 0.5 > curtime then
        local item = ui.get(list_menu, value) + 1
        local selected = csgo_files[item]

        db.status[selected] = not (db.status[selected] or false)

        if db.status[selected] ~= nil and db.status[selected] == true then
            lua.custom_load(selected)
        else
            lua.custom_unload(selected)
        end

        last_click_index = -1
    else
        last_click_index = value
        last_click_time = curtime
    end

end

function lua.automatic_load()
    for script_name, is_loaded in pairs(db.loaded) do
        if is_loaded then
            lua.custom_load(script_name)
        end
    end
end

lua.automatic_load()

ui.set_callback(list_menu, lua.click_load)
видел что многие плакали, ибо в кряке нет load on startup, и каждый запуск все сбивается.


1. загрузите основную луа
2. в LUA табе появился лист со всеми доступными луа, загрузите вам нужные двойным кликом(запуск-autoload on startup)


*На каждом заходе в игру просто запускайте луа скрипт из пункта 1, и все готово

ОПАСНОСТЬ!!!

Не загружайте в листе луа, которую вы скачали в первом пункте, не загружайте обфусцированные файлы (они могут повлиять на ФПС, либо скрипт попросту не загрузится)
I don't know why you all don't patch the crack instead of making such garbage
 
Назад
Сверху Снизу