This commit is contained in:
Huoji's
2023-10-03 04:07:50 +08:00
parent f08e0b90fa
commit 8f3005e9b2
50 changed files with 11966 additions and 107 deletions

View File

@@ -4,9 +4,10 @@ namespace events {
auto OnPlayerDeathEvent(IGameEvent* event) -> void {
UnkGameEventStruct_t userIdNameParams{"userid"};
UnkGameEventStruct_t attackerNameParams{"attacker"};
UnkGameEventStruct_t headshotNameParams{ 0 };
UnkGameEventStruct_t headshotNameParams{0};
static const auto headShotStr = "headshot";
headshotNameParams.m_Unk = Offset::FnServerHashFunction(headShotStr, sizeof headShotStr, SERVER_HASH_FUCNTION_KEY);
headshotNameParams.m_Unk = Offset::FnServerHashFunction(
headShotStr, sizeof headShotStr, SERVER_HASH_FUCNTION_KEY);
headshotNameParams.m_Key = headShotStr;
const auto victimPawn = reinterpret_cast<CCSPlayerPawn*>(
event->GetPlayerPawn(&userIdNameParams));
@@ -25,10 +26,9 @@ auto OnPlayerDeathEvent(IGameEvent* event) -> void {
if (victim == nullptr || attacker == nullptr) {
return;
}
const auto victimIndex = victim->GetRefEHandle().m_Index;
const auto attackerIndex = attacker->GetRefEHandle().m_Index;
LOG("is head shot: %d \n", isHeadShot);
ScriptCallBacks::luaCall_onPlayerDeath(victimIndex, attackerIndex);
const auto victimIndex = victim->GetRefEHandle().GetEntryIndex();
const auto attackerIndex = attacker->GetRefEHandle().GetEntryIndex();
ScriptCallBacks::luaCall_onPlayerDeath(victimIndex, attackerIndex, isHeadShot);
// printf("player[%p] %s kill[%p] %llu\n", attacker,
// &attacker->m_iszPlayerName(), victim, &victim->m_steamID());
}