Alert of attacked tribe

Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Public Service Announcement

    Hey Guest, I’ve got some exciting news to share! 🎉

    Starting this December, I’ll be moving the entire GameServersHub website away from WordPress and rebuilding it in Next.js! This upgrade will bring incredibly faster speeds, smoother performance, and a modern user experience that sets the stage for everything coming next.

    In 2026, GameServersHub will be entering a new era. I’ll be revamping the entire platform from the ground up and launching a brand-new, fully modernized marketplace. It’ll feature a cleaner design, improved functionality, and better tools for both creators and server owners.

    On top of that, development has already started on the GameServerListing project at https://gsl-six.vercel.app/, which is expected to launch in early Q1 2026. This new system will make discovering and managing servers easier than ever before.


    👉 Stay in the loop!
    Join our Discord for behind-the-scenes updates, early previews, and community discussions.

    » Click here to join our Discord! «

    ~ MrOwlSky

sky1145960810

Well-known member
Joined
Oct 30, 2019
Messages
17
C++:
bool Hook_APrimalStructure_Die(APrimalStructure* _this, float KillingDamage, FDamageEvent* DamageEvent, AController* Killer, AActor* DamageCauser)
{
    int structureTeamId = _this->TargetingTeamField();
    if (structureTeamId != 0) // tribe
    {
        if (Killer && Killer->IsA(APlayerController::StaticClass())) {
            AShooterPlayerController* player = (AShooterPlayerController*)Killer;
            int killerTeamId = player->TargetingTeamField();

            ArkApi::GetApiUtils().SendChatMessage(player, "TestPlugin", *FString("[Structure Death] StructureTeamId: " + std::to_string(structureTeamId)));
            ArkApi::GetApiUtils().SendChatMessage(player, "TestPlugin", *FString("[Structure Death] KillerTeamId: " + std::to_string(killerTeamId)));
        }
    }
}

Learn from the code of 0x21, I want to know How can I send a chat message to the building owner
 
C++:
int GetTribeId(AShooterPlayerController* playerController)
{
    int tribeId = 0;

    auto playerState = reinterpret_cast<AShooterPlayerState*>(playerController->PlayerStateField());
    if (playerState)
    {
        tribeId = playerState->MyTribeDataField()->TribeIDField();
    }

    return tribeId;
}
bool Hook_APrimalStructure_Die(APrimalStructure* _this, float KillingDamage, FDamageEvent* DamageEvent, AController* Killer, AActor* DamageCauser)
{
    int structureTeamId = _this->TargetingTeamField();
    if (structureTeamId != 0) // tribe
    {
        if (Killer && Killer->IsA(AShooterPlayerController::StaticClass())) {
            AShooterPlayerController* player = (AShooterPlayerController*)Killer;
            int killerTeamId = player->TargetingTeamField();

            ArkApi::GetApiUtils().SendChatMessage(player, "TestPlugin", "[Structure Death] StructureTeamId: {}", structureTeamId);
            ArkApi::GetApiUtils().SendChatMessage(player, "TestPlugin", "[Structure Death] KillerTeamId: {}", killerTeamId);

            auto world = ArkApi::GetApiUtils().GetWorld();
            if (world) {
                auto playerControllers = world->PlayerControllerListField();
                for (auto playerController : playerControllers)
                {
                    AShooterPlayerController* aShooterPC = static_cast<AShooterPlayerController*>(playerController.Get());
                    if (aShooterPC) {
                        auto tribeId = GetTribeId(aShooterPC);
                        if (tribeId == structureTeamId) {
                            ArkApi::GetApiUtils().SendChatMessage(aShooterPC, "TestPlugin", "Your structure has been destroyed by a player.");
                        }
                    }
                }
            }
        }
    }
}
 
Last edited:
Small error that I corrected in the last SendChatMessage().

C++:
int GetTribeId(AShooterPlayerController* playerController)
{
    int tribeId = 0;

    auto playerState = reinterpret_cast<AShooterPlayerState*>(playerController->PlayerStateField());
    if (playerState)
    {
        tribeId = playerState->MyTribeDataField()->TribeIDField();
    }

    return tribeId;
}
bool Hook_APrimalStructure_Die(APrimalStructure* _this, float KillingDamage, FDamageEvent* DamageEvent, AController* Killer, AActor* DamageCauser)
{
    int structureTeamId = _this->TargetingTeamField();
    if (structureTeamId != 0) // tribe
    {
        if (Killer && Killer->IsA(AShooterPlayerController::StaticClass())) {
            AShooterPlayerController* player = (AShooterPlayerController*)Killer;
            int killerTeamId = player->TargetingTeamField();

            ArkApi::GetApiUtils().SendChatMessage(player, "TestPlugin", "[Structure Death] StructureTeamId: {}", structureTeamId);
            ArkApi::GetApiUtils().SendChatMessage(player, "TestPlugin", "[Structure Death] KillerTeamId: {}", killerTeamId);

            auto world = ArkApi::GetApiUtils().GetWorld();
            if (world) {
                auto playerControllers = world->PlayerControllerListField();
                for (auto playerController : playerControllers)
                {
                    AShooterPlayerController* aShooterPC = static_cast<AShooterPlayerController*>(playerController.Get());
                    if (aShooterPC) {
                        auto tribeId = GetTribeId(aShooterPC);
                        if (tribeId == structureTeamId) {
                            ArkApi::GetApiUtils().SendChatMessage(aShooterPC, "TestPlugin", "Your structure has been destroyed by a player.");
                        }
                    }
                }
            }
        }
    }
}
 
Back
Top