Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <API/ARK/Ark.h>
- #pragma comment(lib, "ArkApi.lib")
- DECLARE_HOOK(APrimalStructure_TakeDamage, float, APrimalStructure*, float, FDamageEvent*, AController*, AActor*, AShooterPlayerController*);
- float Hook_APrimalStructure_TakeDamage(APrimalStructure* _this, float Damage, FDamageEvent* DamageEvent, AController* EventInstigator, AActor* DamageCauser)
- {
- 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;
- }
- }
- else if (EventInstigator && EventInstigator->CharacterField())
- {
- ACharacter* character = EventInstigator->CharacterField();
- if (character && character->IsA(APrimalDinoCharacter::GetPrivateStaticClass()))
- {
- APrimalDinoCharacter* dino = static_cast<APrimalDinoCharacter*>(character);
- FString descr;
- dino->GetDinoDescriptiveName(&descr);
- if (descr.Contains(L"") || descr.Contains(L"") || descr.Contains(L"") || descr.Contains(L"") || descr.Contains(L"") || descr.Contains(L""))
- return 0;
- }
- }
- APrimalStructure_TakeDamage_original(_this, Damage, DamageEvent, EventInstigator, DamageCauser);
- }
- void Load()
- {
- Log::Get().Init("NoNunnaki");
- ArkApi::GetHooks().SetHook("APrimalStructure.TakeDamage", &Hook_APrimalStructure_TakeDamage,
- &APrimalStructure_TakeDamage_original);
- }
- void Unload()
- {
- ArkApi::GetHooks().DisableHook("APrimalStructure.TakeDamage", &Hook_APrimalStructure_TakeDamage);
- }
- 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;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement