void CGameEvents::PlayerDeathListener::FireGameEvent(SDK::IGameEvent* game_event)
{
if (!game_event)
return;
auto local_player = Interfaces::ClientEntityList->GetClientEntity(Interfaces::Engine->GetLocalPlayer());
if (!local_player)
return;
auto entity = Interfaces::ClientEntityList->GetClientEntity(Interfaces::Engine->GetPlayerForUserID(game_event->GetInt("userid")));
if (!entity)
return;
auto entity_attacker = Interfaces::ClientEntityList->GetClientEntity(Interfaces::Engine->GetPlayerForUserID(game_event->GetInt("attacker")));
if (!entity_attacker)
return;
if (entity->GetTeam() == local_player->GetTeam())
return;
SDK::player_info_t player_info;
if (!Interfaces::Engine->GetPlayerInfo(entity->GetIndex(), &player_info))
return;
if (SETTINGS::settings.headshotonly && entity_attacker == local_player)
{
if (!game_event->GetBool("headshot"))
game_event->SetInt("headshot", 1);
}
}