SHARE
TWEET

Untitled

a guest May 22nd, 2019 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <API/ARK/Ark.h>
  2. #include "Suicide.h"
  3. #include <Permissions.h>
  4. #pragma comment(lib, "Permissions.lib")
  5. #pragma comment(lib, "ArkApi.lib")
  6.  
  7.  
  8. void SuicideCMD(AShooterPlayerController* AttackerShooterController, FString* message, int mode)
  9. {
  10.     if (AttackerShooterController || AttackerShooterController->PlayerStateField() || AttackerShooterController->GetPlayerCharacter())
  11.     {
  12.         if (!PickedUPSuicide && AttackerShooterController->GetPlayerCharacter()->CharacterIsCarriedAsPassenger())
  13.         {
  14.             ArkApi::GetApiUtils().SendChatMessage(AttackerShooterController, *GetText("Sender"), *GetText("MsgPickedUP"));
  15.             return;
  16.         }
  17.         uint64 steamId = ArkApi::GetApiUtils().GetSteamIdFromController(AttackerShooterController);
  18.         if (RequiresPermission && Permissions::IsPlayerHasPermission(steamId,"Suicide"))
  19.         {
  20.             ArkApi::GetApiUtils().SendChatMessage(AttackerShooterController, *GetText("Sender"), *GetText("MsgNoPermission"));
  21.             return;
  22.         }
  23.         if (AttackerShooterController->GetPlayerCharacter()->IsDead())
  24.         {
  25.             ArkApi::GetApiUtils().SendChatMessage(AttackerShooterController, *GetText("Sender"), *GetText("MsgAlreadyDead"));
  26.             return;
  27.         }
  28.         if (!KOSuicide && !AttackerShooterController->GetPlayerCharacter()->IsConscious())
  29.         {
  30.             ArkApi::GetApiUtils().SendChatMessage(AttackerShooterController, *GetText("Sender"), *GetText("MsgUnconscious"));
  31.             return;
  32.         }
  33.         if (AttackerShooterController->GetPlayerCharacter()->IsSitting(false))
  34.         {
  35.             ArkApi::GetApiUtils().SendChatMessage(AttackerShooterController, *GetText("Sender"), *GetText("MsgSitting"));
  36.             return;
  37.         }
  38.         if (AttackerShooterController && AttackerShooterController->PlayerStateField() && AttackerShooterController->GetPlayerCharacter() && AttackerShooterController->GetPlayerCharacter()->CurrentWeaponField() && AttackerShooterController->GetPlayerCharacter()->CurrentWeaponField()->AssociatedPrimalItemField())
  39.         {
  40.             FString WeaponName;
  41.             AttackerShooterController->GetPlayerCharacter()->CurrentWeaponField()->AssociatedPrimalItemField()->GetItemName(&WeaponName, false, true, nullptr);
  42.             if (!HandCuffSuicide && WeaponName.Contains(L"Handcuffs"))
  43.             {
  44.                 ArkApi::GetApiUtils().SendChatMessage(AttackerShooterController, *GetText("Sender"), *GetText("MsgHandcuffs"));
  45.                 return;
  46.             }
  47.         }
  48.         if (!ArkApi::GetApiUtils().IsRidingDino(AttackerShooterController))
  49.         {
  50.             AttackerShooterController->GetPlayerCharacter()->Suicide();
  51.         }
  52.         else
  53.             ArkApi::GetApiUtils().SendChatMessage(AttackerShooterController, *GetText("Sender"), *GetText("MsgOnDino"));
  54.     }
  55. }
  56.  
  57.  
  58. void Load()
  59. {
  60.     Log::Get().Init("Suicide");
  61.     try
  62.     {
  63.         ReadConfig();
  64.     }
  65.     catch (const std::exception& error)
  66.     {
  67.         Log::GetLog()->error(error.what());
  68.         throw;
  69.     }
  70.     try
  71.     {
  72.         ArkApi::GetCommands().AddChatCommand("/suicide", &SuicideCMD);
  73.         ArkApi::GetCommands().AddConsoleCommand("Suicide.Reload", &ReloadConfig);
  74.         ArkApi::GetCommands().AddRconCommand("Suicide.Reload", &ReloadConfigRcon);
  75.     }
  76.     catch (const std::exception& error)
  77.     {
  78.         Log::GetLog()->error(error.what());
  79.         throw;
  80.     }
  81. }
  82.  
  83. void Unload()
  84. {
  85.     ArkApi::GetCommands().RemoveConsoleCommand("Suicide.Reload");
  86.     ArkApi::GetCommands().RemoveRconCommand("Suicide.Reload");
  87.     ArkApi::GetCommands().RemoveChatCommand(*GetText("SuicideCMD"));
  88. }
  89.  
  90. BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
  91. {
  92.     switch (ul_reason_for_call)
  93.     {
  94.     case DLL_PROCESS_ATTACH:
  95.         Load();
  96.         break;
  97.     case DLL_PROCESS_DETACH:
  98.         Unload();
  99.         break;
  100.     }
  101.     return TRUE;
  102. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top