Files
csgo2_tiny_server_plugin_sy…/csgo2/events.cpp

28 lines
1.0 KiB
C++
Raw Normal View History

2023-10-01 02:28:13 +08:00
#include "events.h"
2023-10-01 02:28:13 +08:00
namespace events {
2023-10-02 05:03:37 +08:00
auto OnPlayerDeathEvent(IGameEvent* event) -> void {
UnkGameEventStruct_t userIdNameParams{"userid"};
UnkGameEventStruct_t attackerNameParams{"attacker"};
2023-10-01 02:28:13 +08:00
2023-10-02 05:03:37 +08:00
const auto victim = reinterpret_cast<CCSPlayerPawn*>(
event->GetPlayerPawn(&userIdNameParams));
const auto attacker = reinterpret_cast<CCSPlayerPawn*>(
event->GetPlayerPawn(&attackerNameParams));
2023-10-01 04:57:41 +08:00
2023-10-02 17:31:02 +08:00
//printf("player[%p] %s kill[%p] %llu\n", attacker, &attacker->m_iszPlayerName(), victim, &victim->m_steamID());
}
auto OnPlayerChat(CCSPlayerController* player, std::string message) -> bool {
auto [procesChatSuccess, chatType, chatCtx] = SdkTools::ProcessChatString(message);
if (procesChatSuccess == false) {
return false;
}
2023-10-01 02:28:13 +08:00
2023-10-02 17:31:02 +08:00
LOG("player %s say[%d]: %s steamid: %llu\n", &player->m_iszPlayerName(), chatType ,chatCtx.c_str(), player->m_steamID());
if (chatCtx.at(0) == '/' || chatCtx.at(0) == '!') {
return true;
2023-10-01 02:28:13 +08:00
}
2023-10-02 17:31:02 +08:00
return false;
2023-10-02 05:03:37 +08:00
}
} // namespace events