DECLARE_HOOK(APrimalStructure_TakeDamage, float, APrimalStructure*, float, FDamageEvent*, AController*, AActor*);
(edited)void SuicideCMD(AShooterPlayerController* player, FString* message, int mode)
{
if (!player || !player->PlayerStateField() || !player->GetPlayerCharacter() || player->GetPlayerCharacter()->IsDead()) return;
if (!ArkApi::GetApiUtils().IsRidingDino(player)) player->Suicide();
}
(edited)void SuicideCMD(AShooterPlayerController* player, FString* message, int mode)
{
if (!player || !player->PlayerStateField() || !player->GetPlayerCharacter() || player->GetPlayerCharacter()->IsDead()) return;
if (!ArkApi::GetApiUtils().IsRidingDino(player)) player->GetPlayerCharacter()->Suicide();
}
(edited)if (_this && EventInstigator && !EventInstigator->IsLocalController() && EventInstigator->IsA(AShooterPlayerController::StaticClass()))
{
AShooterPlayerController* AttackerShooterController = static_cast<AShooterPlayerController*>(EventInstigator);
if (AttackerShooterController && AttackerShooterController->PlayerStateField() && AttackerShooterController->GetPlayerCharacter() && AttackerShooterController->GetPlayerCharacter()->CurrentWeaponField() && AttackerShooterController->GetPlayerCharacter()->CurrentWeaponField()->AssociatedPrimalItemField())
{
FString WeaponName;
AttackerShooterController->GetPlayerCharacter()->CurrentWeaponField()->AssociatedPrimalItemField()->GetItemName(&WeaponName, false, true, nullptr);
if (WeaponName.Contains(L"Flamethrower")) return 0;
}
}
AShooterPlayerController* AttackerShooterController = static_cast<AShooterPlayerController*>(EventInstigator);
if (AttackerShooterController && AttackerShooterController->PlayerStateField() && AttackerShooterController->GetPlayerCharacter() && AttackerShooterController->GetPlayerCharacter()->CurrentWeaponField() && AttackerShooterController->GetPlayerCharacter()->CurrentWeaponField()->AssociatedPrimalItemField())
{
FString WeaponName;
AttackerShooterController->GetPlayerCharacter()->CurrentWeaponField()->AssociatedPrimalItemField()->GetItemName(&WeaponName, false, true, nullptr);
if (WeaponName.Contains(L"Flamethrower")) return 0;
}
(edited) if (AttackerShooterController && AttackerShooterController->PlayerStateField() && AttackerShooterController->GetPlayerCharacter() && AttackerShooterController->GetPlayerCharacter()->CurrentWeaponField() && AttackerShooterController->GetPlayerCharacter()->CurrentWeaponField()->AssociatedPrimalItemField())
{
FString WeaponName;
AttackerShooterController->GetPlayerCharacter()->CurrentWeaponField()->AssociatedPrimalItemField()->GetItemName(&WeaponName, false, true, nullptr);
if (WeaponName.Contains(L"Flamethrower")) return 0;
}
void MyCommand(AShooterPlayerController* AttackerShooterController, FString* message, int mode)
{
if (AttackerShooterController && AttackerShooterController->PlayerStateField() && AttackerShooterController->GetPlayerCharacter() && AttackerShooterController->GetPlayerCharacter()->CurrentWeaponField() && AttackerShooterController->GetPlayerCharacter()->CurrentWeaponField()->AssociatedPrimalItemField())
{
FString WeaponName;
AttackerShooterController->GetPlayerCharacter()->CurrentWeaponField()->AssociatedPrimalItemField()->GetItemName(&WeaponName, false, true, nullptr);
Log::GetLog()->warn("Weapon Name: {}", WeaponName.ToString());
}
}
(edited)ArkApi::GetCommands().AddChatCommand("/test", &MyCommand);
if (!AttackerShooterController || !AttackerShooterController->PlayerStateField() || !AttackerShooterController->GetPlayerCharacter() || AttackerShooterController->GetPlayerCharacter()->IsSitting(true)) return;
void SuicideCMD(AShooterPlayerController* AttackerShooterController, FString* message, int mode)
{
if (!AttackerShooterController || !AttackerShooterController->PlayerStateField() || !AttackerShooterController->GetPlayerCharacter() || AttackerShooterController->GetPlayerCharacter()->IsDead()) return;
if (!ArkApi::GetApiUtils().IsRidingDino(AttackerShooterController)) AttackerShooterController->GetPlayerCharacter()->Suicide();
if (!AttackerShooterController || !AttackerShooterController->PlayerStateField() || !AttackerShooterController->GetPlayerCharacter() || !AttackerShooterController->GetPlayerCharacter()->IsConscious()) return;
if (!AttackerShooterController || !AttackerShooterController->PlayerStateField() || !AttackerShooterController->GetPlayerCharacter() || AttackerShooterController->GetPlayerCharacter()->IsSitting(false)) return;
if (AttackerShooterController && AttackerShooterController->PlayerStateField() && AttackerShooterController->GetPlayerCharacter() && AttackerShooterController->GetPlayerCharacter()->CurrentWeaponField() && AttackerShooterController->GetPlayerCharacter()->CurrentWeaponField()->AssociatedPrimalItemField())
{
FString WeaponName;
AttackerShooterController->GetPlayerCharacter()->CurrentWeaponField()->AssociatedPrimalItemField()->GetItemName(&WeaponName, false, true, nullptr);
if (WeaponName.Contains(L"Flamethrower")) return;
Log::GetLog()->warn("Weapon Name: {}", WeaponName.ToString());
}
}
void SuicideCMD(AShooterPlayerController* AttackerShooterController, FString* message, int mode)
{
if (!AttackerShooterController || !AttackerShooterController->PlayerStateField() || !AttackerShooterController->GetPlayerCharacter() || AttackerShooterController->GetPlayerCharacter()->IsDead()) return;
if (!ArkApi::GetApiUtils().IsRidingDino(AttackerShooterController)) AttackerShooterController->GetPlayerCharacter()->Suicide();
if (!AttackerShooterController || !AttackerShooterController->PlayerStateField() || !AttackerShooterController->GetPlayerCharacter() || !AttackerShooterController->GetPlayerCharacter()->IsConscious()) return;
if (!AttackerShooterController || !AttackerShooterController->PlayerStateField() || !AttackerShooterController->GetPlayerCharacter() || AttackerShooterController->GetPlayerCharacter()->IsSitting(false)) return;
if (AttackerShooterController && AttackerShooterController->PlayerStateField() && AttackerShooterController->GetPlayerCharacter() && AttackerShooterController->GetPlayerCharacter()->CurrentWeaponField() && AttackerShooterController->GetPlayerCharacter()->CurrentWeaponField()->AssociatedPrimalItemField())
{
FString WeaponName;
AttackerShooterController->GetPlayerCharacter()->CurrentWeaponField()->AssociatedPrimalItemField()->GetItemName(&WeaponName, false, true, nullptr);
if (WeaponName.Contains(L"Flamethrower")) return;
Log::GetLog()->warn("Weapon Name: {}", WeaponName.ToString());
}
}
if (_this && EventInstigator && EventInstigator->IsA(AShooterPlayerController::StaticClass()))
{
AShooterPlayerController* AttackerShooterController = static_cast<AShooterPlayerController*>(EventInstigator);
if (AttackerShooterController && AttackerShooterController->PlayerStateField() && AttackerShooterController->GetPlayerCharacter() && AttackerShooterController->GetPlayerCharacter()->CurrentWeaponField() && AttackerShooterController->GetPlayerCharacter()->CurrentWeaponField()->AssociatedPrimalItemField())
{
FString WeaponName;
AttackerShooterController->GetPlayerCharacter()->CurrentWeaponField()->AssociatedPrimalItemField()->GetItemName(&WeaponName, false, true, nullptr);
if (WeaponName.Contains(L"Flamethrower")) return 0;
}
}
void SuicideCMD(AShooterPlayerController* AttackerShooterController, FString* message, int mode)
{
if (!AttackerShooterController || !AttackerShooterController->PlayerStateField() || !AttackerShooterController->GetPlayerCharacter() || AttackerShooterController->GetPlayerCharacter()->IsDead() || !AttackerShooterController->GetPlayerCharacter()->IsConscious() || AttackerShooterController->GetPlayerCharacter()->IsSitting(false)) return;
if (!ArkApi::GetApiUtils().IsRidingDino(AttackerShooterController)) AttackerShooterController->GetPlayerCharacter()->Suicide();
if (AttackerShooterController && AttackerShooterController->PlayerStateField() && AttackerShooterController->GetPlayerCharacter() && AttackerShooterController->GetPlayerCharacter()->CurrentWeaponField() && AttackerShooterController->GetPlayerCharacter()->CurrentWeaponField()->AssociatedPrimalItemField())
{
FString WeaponName;
AttackerShooterController->GetPlayerCharacter()->CurrentWeaponField()->AssociatedPrimalItemField()->GetItemName(&WeaponName, false, true, nullptr);
if (WeaponName.Contains(L"Handcuffs")) return;
}
}
dino->UpdateImprintingDetails_Implementation(FString *ImprinterName, steam_id);
FString ImprinterName = "some name";
dino->UpdateImprintingDetails_Implementation(&ImprinterName , steam_id);
void SetImprintToPlayer(RCONClientConnection* rcon_connection, RCONPacket* rcon_packet, UWorld*)
{
FString msg = rcon_packet->Body;
TArray<FString> parsed;
msg.ParseIntoArray(parsed, L" ", true);
if (parsed.IsValidIndex(4))
{
int dino_id1;
int dino_id2;
uint64 steam_id;
FString playerName;
try
{
dino_id1 = std::stoi(*parsed[1]);
dino_id2 = std::stoi(*parsed[2]);
steam_id = std::stoull(*parsed[3]);
playerName = parsed[4];
}
catch (const std::exception&)
{
SendRconReply(rcon_connection, rcon_packet->Id, "Request has failed");
Log::GetLog()->info("error.1");
return;
}
APrimalDinoCharacter* dino = APrimalDinoCharacter::FindDinoWithID(ArkApi::GetApiUtils().GetWorld(), dino_id1,
dino_id2);
if (!dino)
{
SendRconReply(rcon_connection, rcon_packet->Id, "Can't find dino");
Log::GetLog()->info("error.2");
return;
}
AShooterPlayerController* shooter_pc = ArkApi::GetApiUtils().FindPlayerFromSteamId(steam_id);
if (!shooter_pc)
{
SendRconReply(rcon_connection, rcon_packet->Id, "Can't find player from the given steam id");
Log::GetLog()->info("error.3");
return;
}
shooter_pc->GetPlayerCharacterName(&playerName);
Log::GetLog()->info("error.4");
dino->UpdateImprintingDetails(&playerName, shooter_pc->LinkedPlayerIDField());
SendRconReply(rcon_connection, rcon_packet->Id, "Successfully changed Imprint on dino");
Log::GetLog()->info("error.5");
}
else
{
SendRconReply(rcon_connection, rcon_packet->Id, "Not enough arguments");
}
}
{
int dino_id1;
int dino_id2;
uint64 steam_id;
- FString playerName;
try
{
void DestroyStructuresForTeam(RCONClientConnection* rcon_connection, RCONPacket* rcon_packet, UWorld*)
{
FString msg = rcon_packet->Body;
TArray<FString> parsed;
msg.ParseIntoArray(parsed, L" ", true);
if (parsed.IsValidIndex(1))
{
uint64 team_id;
try
{
team_id = std::stoi(*parsed[1]);
}
catch (const std::exception&)
{
SendRconReply(rcon_connection, rcon_packet->Id, "Request has failed");
return;
}
if (team_id < 999999999)
{
SendRconReply(rcon_connection, rcon_packet->Id, "You have enter the wrong TeamID");
return;
}
UWorld* world = ArkApi::GetApiUtils().GetWorld();
if (!world)
{
SendRconReply(rcon_connection, rcon_packet->Id, "Something must have gone terribly wrong?");
return;
}
TArray<AActor*>* FoundActors = new TArray<AActor*>();
UGameplayStatics::GetAllActorsOfClass(world, APrimalStructure::GetPrivateStaticClass(), FoundActors);
std::stringstream ss;
int num = 0;
for (uint32_t i = 0; i == FoundActors->Num(); i++)
{
AActor* actor = (*FoundActors)[i];
APrimalStructure* structure = static_cast<APrimalStructure*>(actor);
const int structure_team = structure->TargetingTeamField();
if (structure_team == team_id)
{
structure->Destroy(false, true);
num++;
}
}
ss << "Destroyed " << num << " structures belonging to team " << team_id;
delete FoundActors;
ArkApi::Tools::ConvertToWideStr(ss.str());
SendRconReply(rcon_connection, rcon_packet->Id, "Successfully Destroyed team structures!");
}
else
{
SendRconReply(rcon_connection, rcon_packet->Id, "Not enough arguments");
}
}
(edited) TArray<AActor*> AllStructures;
UGameplayStatics::GetAllActorsOfClass(reinterpret_cast<UObject*>(ArkApi::GetApiUtils().GetWorld()), APrimalStructure::GetPrivateStaticClass(), &AllStructures);
for (AActor* StructureActor : AllStructures)
{
if (StructureActor)
{
APrimalStructure* Structure = static_cast<APrimalStructure*>(StructureActor);
Structure->Suicide();
}
}
uint64 tribe_id = tribe_id_input;
TArray<AActor*> AllStructures;
UGameplayStatics::GetAllActorsOfClass(reinterpret_cast<UObject*>(ArkApi::GetApiUtils().GetWorld()), APrimalStructure::GetPrivateStaticClass(), &AllStructures);
TArray<APrimalStructure*> FoundStructures;
for (AActor* StructActor : AllStructures)
{
if (!StructActor || StructActor->TargetingTeamField() != tribe_id || !StructActor->IsA(APrimalStructure::GetPrivateStaticClass())) continue;
FoundStructures.Add(static_cast<APrimalStructure*>(StructActor));
}
for (APrimalStructure* st : FoundStructures)
{
//do something with found tribe structures
}
(edited)TArray<AActor*> AllStructures;
UGameplayStatics::GetAllActorsOfClass(reinterpret_cast<UObject*>(ArkApi::GetApiUtils().GetWorld()), APrimalStructure::GetPrivateStaticClass(), &AllStructures);
for (AActor* StructureActor : AllStructures)
{
if (StructureActor && StructureActor->TargetingTeamField() == team_id)
{
APrimalStructure* Structure = static_cast<APrimalStructure*>(StructureActor);
Structure->Suicide();
}
}
(edited)needs to be
(edited)Log::GetLog()->warn(someVar1);
too to check if your variables are correct too, unless there's an easier wayfor
loop will probably* give you better performance tooinline void ChatCommand(AShooterPlayerController* player, FString* message, int mode)
{
TArray<FString> parsed;
message->ParseIntoArray(parsed, L" ", true);
if (parsed.IsValidIndex(1))
{
FString input = parsed[1];
auto value = input.ToString();
if (value.compare("info") == 0)
{
Info(player, message, mode);
}
else if (value.compare("status") == 0)
{
Status(player, message, mode);
}
else if (value.compare("disable") == 0)
{
Disable(player, message, mode);
}
else
{
ArkApi::GetApiUtils().SendNotification(player, NewPlayerProtection::MessageColor, NewPlayerProtection::MessageTextSize, NewPlayerProtection::MessageDisplayDelay, nullptr,
*NewPlayerProtection::NPPInvalidCommand);
}
}
else
{
ArkApi::GetApiUtils().SendNotification(player, NewPlayerProtection::MessageColor, NewPlayerProtection::MessageTextSize, NewPlayerProtection::MessageDisplayDelay, nullptr,
*NewPlayerProtection::NPPInvalidCommand);
}
}
uint64 team_id;
try
{
team_id = std::stoi(*parsed[1]);
}
TO
uint64 team_id;
try
{
team_id = std::stoi(*parsed[0]);
}
It didn't work.ShooterGameServer.exe!UObjectSerializer::SerializeObject() (0x00007ff70e3f8283) + 41 bytes [f:\build\trunk\projects\shootergame\source\shootergame\private\objectserializer.cpp:60]
ShooterGameServer.exe!AShooterGameMode::SaveTribeData() (0x00007ff70e718e24) + 0 bytes [f:\build\trunk\projects\shootergame\source\shootergame\private\shootergamemode.cpp:3139]
ShooterGameServer.exe!AShooterGameMode::AddToTribeLog() (0x00007ff70e7367e0) + 28 bytes [f:\build\trunk\projects\shootergame\source\shootergame\private\shootergamemode.cpp:6671]
ShooterGameServer.exe!APrimalDinoCharacter::TryMultiUse() (0x00007ff70e4d2d00) + 0 bytes [f:\build\trunk\projects\shootergame\source\shootergame\private\primaldinocharacter.cpp:8717]
ShooterGameServer.exe!AShooterPlayerController::ServerMultiUse_Implementation() (0x00007ff70e7ad015) + 18 bytes [f:\build\trunk\projects\shootergame\source\shootergame\private\shooterplayercontroller.cpp:5635]
ShooterGameServer.exe!AShooterPlayerController::execServerMultiUse() (0x00007ff70ed9b345) + 325 bytes [f:\build\trunk\projects\shootergame\source\shootergame\classes\shooterplayercontroller.h:113]
std::ifstream file(ArkApi::Tools::GetCurrentDir() + "/ArkApi/Plugins/NewPlayerProtection/config.json");
FString NewPlayerDoingDamageMessage = FString(ArkApi::Tools::Utf8Decode(NewPlayerProtection::config["General"]["NewPlayerDoingDamageMessage"]).c_str());
(edited)Data = PermColours["Permission"];
Permission = ArkApi::Tools::Utf8Decode(Data).c_str();
Data = PermColours["Tag"];
Tag = ArkApi::Tools::Utf8Decode(Data).c_str();
Data = PermColours["ImagePath"];
ImagePath = ArkApi::Tools::Utf8Decode(Data).c_str();
(edited) int PlayerUpdateIntervalInMins;
bool AllowNewPlayersToDamageEnemyStructures;
bool AllowPlayersToDisableOwnedTribeProtection;
FString NPPCommandPrefix;
FString NewPlayerDoingDamageMessage;
FString NewPlayerStructureTakingDamageMessage;
FString NewPlayerStructureTakingDamageFromUnknownTribemateMessage;
FString NPPInvalidCommand;
FString NewPlayerProtectionDisableSuccess;
FString NotANewPlayerMessage;
FString NotTribeAdminMessage;
FString NPPRemainingMessage;
FString AdminNoTribeExistsMessage;
FString AdminTribeProtectionRemoved;
FString AdminTribeNotUnderProtection;
FString AdminResetTribeProtectionSuccess;
FString AdminResetTribeProtectionLvlFailure;
FString NPPInfoMessage;
int MessageIntervalInSecs;
float MessageTextSize;
float MessageDisplayDelay;
FLinearColor MessageColor;
int MaxLevel;
int HoursOfProtection;
(edited)inline void InitChatCommands()
{
FString cmd1 = NewPlayerProtection::NPPCommandPrefix;
cmd1 = cmd1.Append("npp");
ArkApi::GetCommands().AddChatCommand(cmd1, &ChatCommand);
}
std::string data = NewPlayerProtection::config["General"]["NewPlayerDoingDamageMessage"];
NewPlayerProtection::NewPlayerDoingDamageMessage = ArkApi::Tools::Utf8Decode(data).c_str();
"NewPlayerDoingDamageMessage": "ÕÕÕÕÕÕÕÕÕÕÕÕ"
FString NewPlayerDoingDamageMessage;
std::string data = NewPlayerProtection::config["General"]["NewPlayerDoingDamageMessage"];
NewPlayerProtection::NewPlayerDoingDamageMessage = ArkApi::Tools::Utf8Decode(data).c_str();
ArkApi::GetApiUtils().SendNotification(player, NewPlayerProtection::MessageColor, NewPlayerProtection::MessageTextSize, NewPlayerProtection::MessageDisplayDelay, nullptr, *NewPlayerProtection::NewPlayerDoingDamageMessage);
nlohmann::json config;
std::ifstream file(ArkApi::Tools::GetCurrentDir() + "/ArkApi/Plugins/NewPlayerProtection/config.json");
if (!file.is_open())
{
return;
}
file >> NewPlayerProtection::config;
file.close();
(edited)IDatabase* database;
auto connection_config = std::make_shared<mysql::connection_config>();
connection_config->host = config.value("MysqlHost", "");
connection_config->user = config.value("MysqlUser", "");
connection_config->password = config.value("MysqlPass", "");
connection_config->database = config.value("MysqlDB", "");
connection_config->port = port;
connection_config->debug = false;
connection_config->auto_reconnect = true;
database = new MySql(connection_config);
or sql lite:
database = new SqlLite(config.value("DbPathOverride", ""));
(edited)The WAL journaling mode uses a write-ahead log instead of a rollback journal to implement transactions. The WAL journaling mode is persistent; after being set it stays in effect across multiple database connections and after closing and reopening the database.
There are advantages and disadvantages to using WAL instead of a rollback journal. Advantages include:
WAL is significantly faster in most scenarios.
WAL provides more concurrency as readers do not block writers and a writer does not block readers. Reading and writing can proceed concurrently.
Disk I/O operations tends to be more sequential using WAL.
WAL uses many fewer fsync() operations and is thus less vulnerable to problems on systems where the fsync() system call is broken.
//check for enemy structures nearby
UWorld* world = ArkApi::GetApiUtils().GetWorld();
TArray<AActor*> new_actors;
TArray<AActor*> actors_ignore;
TArray<TEnumAsByte<enum EObjectTypeQuery>> types;
UKismetSystemLibrary::SphereOverlapActors_NEW(world, _this->RootComponentField()->RelativeLocationField(),
static_cast<float>((DinoPassiveProtection::MinimumEnemyStructureDistanceInFoundations * 300)), &types,
APrimalStructure::GetPrivateStaticClass(), &actors_ignore,
&new_actors);
for (const auto& actor : new_actors)
{
APrimalStructure* structure = static_cast<APrimalStructure*>(actor);
//Log::GetLog()->warn(FVector::Distance(_this->RootComponentField()->RelativeLocationField(), actor->RootComponentField()->RelativeLocationField()));
if (structure->TargetingTeamField() != _this->TargetingTeamField())
{
isNotNearEnemyStructures = false;
break;
}
else
{
isNotNearEnemyStructures = true;
}
}
(edited)UWorld* world = ArkApi::GetApiUtils().GetWorld();
TArray<AActor*> new_actors;
TArray<AActor*> actors_ignore;
TArray<TEnumAsByte<enum EObjectTypeQuery>> types;
UKismetSystemLibrary::SphereOverlapActors_NEW(world, ArkApi::IApiUtils::GetPosition(player_controller),
static_cast<float>(radius), &types,
APrimalStructure::GetPrivateStaticClass(), &actors_ignore,
&new_actors);
for (const auto& actor : new_actors)
{
APrimalStructure* structure = static_cast<APrimalStructure*>(actor);
if (structure->TargetingTeamField() != player_controller->TargetingTeamField())
return true;
}
return false;
(edited)FString damagedStructureDescription;
_this->GetHumanReadableName(&damagedStructureDescription);
You can then use StartsWith or Contains on it to see if it's a corrupted dino.
That's how I did it.mute <Mins> <Hours> <CharacterName> - Mute a Character for a certain amount of minutes and hours
ipban <Mins> <Hours> <CharacterName> - IP Ban a Character for a certain amount of minutes and hours and also kicks them from the server
unmute <CharacterName> - UnMute a Character
ipunban <CharacterName> - IP UnBan a Character
clearall - UnMute &IP UnBan Everybody
mreload - Reload Config
Features:
Mute Steam id or ip from global chat
FString PostUrl = "127.0.0.1/test.php";
FString type = "POST";
FString Content = "name=test";
if (ArkApi::Requests::Get().CreateRequest(PostUrl, type, &HttpPostReturnFunc, Content, true))
Log::GetLog()->info("Request success");
else
Log::GetLog()->info("Request fail");
FString PostUrl = "127.0.0.1/test.php";
to
FString PostUrl = "http://127.0.0.1/test.php";
makes it work if (DamageCauser)
{
FString descr;
DamageCauser->GetHumanReadableName(&descr);
Log::GetLog()->info(descr.ToString());
if (descr.Contains(L"Turret"))
{
return 0;
}
}
void Load()
{
std::cout << "Loaded a plugin";
}
void Unload()
{
std::cout << "Unloaded the plugin";
}
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
Load();
break;
case DLL_PROCESS_DETACH:
Unload();
break;
}
return TRUE;
}
like thisArkApi::GetCommands().AddChatCommand("/newcommand", &Function);
Iceworm_Queen_Character_BP_C
from an AController. GetFullName
returns the name of the AI controllerAShooterGameMode.Killed
to monitor boss kills, counting them for a player and saving the last kill time to display a timer of next respawn on my website.FString NPCClassString;
FNPCSpawnLimit
, I can't find the connection of AController to itAPrimalDinoCharacter* dino = static_cast<APrimalDinoCharacter*>(KilledPlayer->CharacterField());
(edited)if (KilledPlayer->CharacterField() is APrimalDinoCharacter) {
ACharacter* character = EventInstigator->CharacterField();
ArkApi::GetApiUtils().GetIPAddress(player);
if (EventInstigator && EventInstigator->IsA(APlayerController::StaticClass()))
(edited)if (EventInstigator && EventInstigator->IsA(APlayerController::GetPrivateStaticClass()))
::GetPrivateStaticClass()
is causing messages to be sent to dinos now?if (EventInstigator != nullptr && EventInstigator->IsA(APlayerController::GetPrivateStaticClass()) && EventInstigator && EventInstigator->CharacterField())
->IsA(APlayerController::GetPrivateStaticClass())
is no longer enough to filter dinos from players->IsA(AShooterPlayerController::GetPrivateStaticClass())
works#include "stdafx.h"
#include "API\ARK\Ark.h"
#pragma comment(lib, "ArkApi.lib")
void TestCMD(AShooterPlayerController* shooter_controller, FString* message, int mode)
{
if (!shooter_controller->PlayerStateField()) return;
Log::GetLog()->warn("Test Chat Command Called: {}", message->ToString());
ArkApi::GetApiUtils().SendServerMessage(shooter_controller, FColorList::Pink, L"{}, you tried the test command", *ArkApi::GetApiUtils().GetCharacterName(shooter_controller));
}
void Load()
{
Log::Get().Init("Test Plugin");
ArkApi::GetCommands().AddChatCommand("/test", &TestCMD);
}
void Unload()
{
ArkApi::GetCommands().RemoveChatCommand("/test");
}
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
Load();
break;
case DLL_PROCESS_DETACH:
Unload();
break;
}
return TRUE;
}
void Load()
{
Log::Get().Init("ProjectCCC");
Log::GetLog()->debug("Testing 123, please load the project for me ;)");
ArkApi::GetApiUtils().SendServerMessageToAll(FColorList::Green, L"Test Message: {}", L"Test arg");
ArkApi::GetCommands().AddChatCommand("/test", &TestCMD);
}
UPrimalItem::CrafterCharacterNameField
For each item in each inventory.. no matter if its of a structure / player Fatal error!
VERSION: 294.108
ProjectCCC.dll!FString::ToString() (0x00007ffae47d6d4a) + 0 bytes [d:\ark-server-api-master\version\core\public\api\ue\containers\fstring.h:1612]
ProjectCCC.dll!Hook_UPrimalInventoryComponent_AddItem() (0x00007ffae47d72a4) + 29 bytes [c:\users\dfouc\source\repos\projectccc\projectccc\projectccc.cpp:58]
ShooterGameServer.exe!UPrimalInventoryComponent::GiveInitialItems() (0x00007ff750522ffb) + 64 bytes [f:\build\trunk\projects\shootergame\source\shootergame\private\primalinventorycomponent.cpp:1362]
ShooterGameServer.exe!UPrimalInventoryComponent::InitializeInventory() (0x00007ff750523e8c) + 0 bytes [f:\build\trunk\projects\shootergame\source\shootergame\private\primalinventorycomponent.cpp:1535]
ShooterGameServer.exe!APrimalStructureItemContainer::BeginPlay() (0x00007ff7505e92eb) + 0 bytes [f:\build\trunk\projects\shootergame\source\shootergame\private\primalstructureitemcontainer.cpp:330]
ShooterGameServer.exe!APrimalStructureItemContainer_SupplyCrate::BeginPlay() (0x00007ff7505fff87) + 0 bytes
Log::Get().Init("ProjectCCC");
Log::GetLog()->info("Loading the project ............");
//Load Commands
ArkApi::GetCommands().AddChatCommand("/test", &TestCMD);
//Load Hooks
//ArkApi::GetHooks().SetHook("APrimalCharacter.ServerUploadCharacter", &Hook_APrimalCharacter_ServerUploadCharacter, &APrimalCharacter_ServerUploadCharacter_original);
ArkApi::GetHooks().SetHook("UPrimalInventoryComponent.AddItem", &Hook_UPrimalInventoryComponent_AddItem, &UPrimalInventoryComponent_AddItem_original);
if (OwnerPlayer != 0)
never executes
then tried
if(OwnerPlayer->PlayerStateField())
it crashes
then
if(reinterpret_cast<AShooterPlayerController*>(OwnerPlayer->PlayerStateField()))
crashes
then
if (OwnerPlayer)
never executes (edited)