增加玩家管理(没做完,需要steamid绑定名字啥的)

This commit is contained in:
Huoji's
2023-10-01 22:13:20 +08:00
parent fb67632502
commit 1bae80e38d
681 changed files with 391721 additions and 218 deletions

View File

@@ -1,6 +1,8 @@
#include "events.h"
#include "native_sdk/entity/cbaseplayercontroller.h"
#include "player.h"
#include "player_manager.h"
namespace events {
auto OnPlayerDeathEvent(IGameEvent* event) -> void {
UnkGameEventStruct_t userIdNameParams{ "userid" };
@@ -8,12 +10,11 @@ namespace events {
const auto victim = reinterpret_cast<CCSPlayerController*>(event->GetPlayerPawn(&userIdNameParams));
const auto attacker = reinterpret_cast<CCSPlayerController*>(event->GetPlayerPawn(&attackerNameParams));
auto victimName = &victim->m_iszPlayerName();
auto attackerName = &attacker->m_iszPlayerName();
//victimBasePlayer->ForceRespawn();
printf("victim %s\n", victimName);
printf("attacker %s\n", attackerName);
auto victimName = std::string(PlayerManager::GetPlayerNameByPlayerSlot(victim->GetRefEHandle().GetPlayerSlot()));
auto attackerName = std::string(PlayerManager::GetPlayerNameByPlayerSlot(attacker->GetRefEHandle().GetPlayerSlot()));
printf("player %s killed %s\n", victimName.c_str(), attackerName.c_str());
}
auto OnPlayerChat(IGameEvent* event) -> void
@@ -25,6 +26,5 @@ namespace events {
LOG("player: %s say: %s \n", chaterName, text);
}
}