效果
因为部分原因,投票显示就不放出来了~~~~
功能
打击伤害日志
被击打伤害日志
地方投票日志
安装
复制下面代码到你的CFG文件夹
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*, ...);
typedef void* (__thiscall* get_client_entity_t)(void*, int);
]]
local hit_groups = {
[0] = "身体", [1] = "头部", [2] = "胸部", [3] = "胃部", [4] = "右臂", [5] = "左臂", [6] = "右腿", [7] = "左腿", [10] = "身体",};
local wepaon_id = {
[0] = "None",[1] = "沙漠之鹰",[2] = "贝瑞塔",[3] = "FN57",[4] = "格洛克",[7] = "AK-47",[8] = "AUG",[9] = "AWP",[10] = "法玛斯",[11] = "G3SG1",[13] = "加利尔 AR",[14] = "M249",[16] = "M4A4",[17] = "MAC-10",[19] = "P90",[23] = "MP5",[24] = "UMP-45",[25] = "XM1014",[26] = "PP19-野牛",[27] = "MAG-7",[28] = "内格夫",[29] = "匪喷",[30] = "TEC-9",[31] = "电击枪",[32] = "P2000",[33] = "MP7",[34] = "MP9",[35] = "新星",[36] = "P250",[38] = "SCAR20",[39] = "SG553",[40] = "SSG08",[41] = "刀",[42] = "刀",[59] = "刀",[60] = "M4A1S",[61] = "USP",[63] = "CZ75",[64] = "R8",[69] = "刀",[74] = "刀",[75] = "刀",[76] = "刀",[78] = "刀",[503] = "刀",[505] = "刀",[506] = "刀",[507] = "刀",[508] = "刀",[509] = "刀",[512] = "刀",[514] = "刀",[515] = "刀",[516] = "刀",[517] = "刀",[518] = "刀",[519] = "刀",[520] = "刀",[521] = "刀",[522] = "刀",[523] = "刀",[524] = "刀",[525] = "刀"};
local ffi_log = ffi.cast("console_color_print", ffi.C.GetProcAddress(ffi.C.GetModuleHandleA("tier0.dll"), "?ConColorMsg@@YAXABVColor@@PBDZZ"))
local _SetTag = ffi.cast('int(__fastcall*)(const char*, const char*)', mem.FindPattern('engine.dll', '53 56 57 8B DA 8B F9 FF 15'))
local SetTag = function(v)
if v ~= last then
_SetTag(v, v)
last = v
end
end
function client.log(msg, ...)
for k, v in pairs({...}) do
msg = tostring(msg .. v)
end
ffi_log(ffi.new("color_struct_t"), msg .. "\n")
end
function client.color_log(r, g, b, msg, ...)
for k, v in pairs({...}) do
msg = tostring(msg .. v)
end
local clr = ffi.new("color_struct_t")
clr.r, clr.g, clr.b, clr.a = r, g, b, 255
ffi_log(clr, msg .. "\n")
end
local c_hud_chat =
ffi.cast("unsigned long(__thiscall*)(void*, const char*)", mem.FindPattern("client.dll", "55 8B EC 53 8B 5D 08 56 57 8B F9 33 F6 39 77 28"))(
ffi.cast("unsigned long**", ffi.cast("uintptr_t", mem.FindPattern("client.dll", "B9 ?? ?? ?? ?? E8 ?? ?? ?? ?? 8B 5D 08")) + 1)[0],
"CHudChat"
)
local ffi_print_chat = ffi.cast("void(__cdecl*)(int, int, int, const char*, ...)", ffi.cast("void***", c_hud_chat)[0][27])
function client.PrintChat(msg)
ffi_print_chat(c_hud_chat, 0, 0, " " .. msg)
end
function startswith(text, prefix)
return text:find(prefix, 1, true) == 1
end
local function on_player_hurt(Event)
if(Event:GetName() ~= "player_hurt") then return end
local local_player = entities.GetLocalPlayer()
local attacker = entities.GetByUserID(Event:GetInt('attacker'))
local victim = entities.GetByUserID(Event:GetInt('userid'))
local damage = Event:GetInt("dmg_health")
local hitbox = Event:GetInt("hitgroup")
local w_id = local_player:GetWeaponID()
local ew_id = attacker:GetWeaponID()
local hp = Event:GetInt("health")
if(attacker:GetIndex() == local_player:GetIndex()) then
client.PrintChat("[Infinity] 使用 [" ..wepaon_id[w_id].. "] 打击 " .. victim:GetName() .. " 的 [" .. hit_groups[hitbox] .. "] 伤害 [" .. damage .. "] 剩余: [" .. hp .. "]")
client.Command("echo \"\"", true)
client.Command("echo \"【HITLOG】使用" ..wepaon_id[w_id].. " 打击 " .. victim:GetName() .. " 的 " .. hit_groups[hitbox] .. " 伤害 " .. damage .. " \"", true)
client.Command("echo \"\"", true)
end
if(victim:GetIndex() == local_player:GetIndex()) then
client.PrintChat("[Infinty] " .. attacker:GetName() .. " 使用 [" ..wepaon_id[ew_id].. "] 打击 [" .. hit_groups[hitbox] .. "] 伤害[" .. damage .. "] 剩余: [" .. hp .. "]")
client.Command("echo \"\"", true)
client.Command("echo \"【HITLOG】" .. attacker:GetName() .. " 使用 " ..wepaon_id[ew_id].. " 打击 " .. hit_groups[hitbox] .. " 伤害 " .. damage .. " \"", true)
client.Command("echo \"\"", true)
end
end
callbacks.Register(
"DispatchUserMessage",
function(um)
local local_player = entities.GetLocalPlayer()
if not (gui.GetValue("misc.master") and local_player) then
return
end
local team = local_player:GetTeamNumber()
if um:GetID() == 46 then
local type = um:GetInt(3)
local type_name =
type == 0 and "踢出玩家 " or type == 1 and " 更改地图 " or type == 6 and "发起投降" or
type == 13 and "发起暂停"
client.PrintChat(
"[Infinty] 投票启动 " .. client.GetPlayerNameByIndex(um:GetInt(2)) .. " 想要 " .. type_name .. um:GetString(5)
)
end
local results = um:GetID() == 47 and "通过" or um:GetID() == 48 and "失败"
local _ = results and client.PrintChat("[Infinty] 投票结果 " .. results)
end
)
client.AllowListener("vote_cast")
callbacks.Register(
"FireGameEvent",
function(e)
local local_player = entities.GetLocalPlayer()
if not (gui.GetValue("misc.master") and on:GetValue() and local_player) then
return
end
if e:GetName() and e:GetName() == "vote_cast" then
local team = local_player:GetTeamNumber()
local option = e:GetInt("vote_option")
local results = option == 0 and "同意" or option == 1 and "拒绝" or "未知"
client.PrintChat(
"[Infinty] 投票进程 " .. client.GetPlayerNameByIndex(e:GetInt("entityid")) .. " " .. results
)
end
end
)
client.AllowListener("player_hurt")
callbacks.Register("SendStringCmd", on_cmd)
callbacks.Register("FireGameEvent", on_player_hurt)
callbacks.Register("CreateMove", on_create_move)
代码写得不是很好,请谅解哈!!!
然后加载此lua即可~
© 版权声明
THE END
暂无评论内容