otval shpindelya
-
Автор темы
- #1
41f46fcc82ed34bc24f239242d5c91a790f87931d910d2498c05def0db83e39f
луашка
луашка
Код:
local ffi = require("ffi")
ffi.cdef[[
void* GetProcAddress(void* hModule, const char* lpProcName);
void* GetModuleHandleA(const char* lpModuleName);
typedef struct {
uint8_t r;
uint8_t g;
uint8_t b;
uint8_t a;
} color_struct_t;
typedef void (*console_color_print)(const color_struct_t&, const char*, ...);
]]
local ffi_helpers = {
color_print_fn = ffi.cast("console_color_print", ffi.C.GetProcAddress(ffi.C.GetModuleHandleA("tier0.dll"), "?ConColorMsg@@YAXABVColor@@PBDZZ")),
color_print = function(self, text, color)
local col = ffi.new("color_struct_t")
col.r = color:r()
col.g = color:g()
col.b = color:b()
col.a = color:a()
self.color_print_fn(col, text)
end
}
local function coloredPrint(color, text)
ffi_helpers.color_print(ffi_helpers, text, color)
end
local function hitlog(shot_info)
local result = shot_info.result
local i = shot_info.target_index
local targetname = engine.get_player_info(i).name
if menu.get_bool("misc.logs") then
if result == "Resolver" then
coloredPrint(color.new(255, 255, 0), "[ MISS ] ")
client.log("Missed shot due to resolver")
coloredPrint(color.new(255, 255, 0), "[ FIRED ] ")
coloredPrint(color.new(255, 255, 255), "Fired at " .. targetname .. " in the " .. shot_info.client_hitbox .. " for " .. shot_info.client_damage .. " damage hitchance " .. shot_info.hitchance .. " safepoint " .. tostring(shot_info.safe) .. "\n")
end
if result == "None" then
coloredPrint(color.new(255, 255, 0), "[ MISS ] ")
client.log("Missed shot due to unknown")
coloredPrint(color.new(255, 255, 0), "[ FIRED ] ")
coloredPrint(color.new(255, 255, 255), "Fired at " .. targetname .. " in the " .. shot_info.client_hitbox .. " for " .. shot_info.client_damage .. " damage hitchance " .. shot_info.hitchance .. " safepoint " .. tostring(shot_info.safe) .. "\n")
end
if result == "Spread" then
coloredPrint(color.new(255, 255, 0), "[ FIRED ] ")
coloredPrint(color.new(255, 255, 255), "Fired at " .. targetname .. " in the " .. shot_info.client_hitbox .. " for " .. shot_info.client_damage .. " damage hitchance " .. shot_info.hitchance .. " safepoint " .. tostring(shot_info.safe) .. "\n")
end
if result == "Hit" then
coloredPrint(color.new(0, 255, 0), "[ FIRED ] ")
coloredPrint(color.new(255, 255, 255), "Fired at " .. targetname .. " in the " .. shot_info.client_hitbox .. " for " .. shot_info.client_damage .. " damage hitchance " .. shot_info.hitchance .. " safepoint " .. tostring(shot_info.safe) .. "\n")
end
end
end
client.add_callback("on_shot", hitlog)