Guest User

Untitled

a guest
Jul 27th, 2015
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.31 KB | None | 0 0
  1. #include "script.h"
  2. #include <string>
  3.  
  4. #pragma warning(disable : 4244 4305) // Double <-> Float Conversions
  5.  
  6. void NotifyAboveMap(char* Message)
  7. {
  8.     UI::_0x202709F4C58A0424("STRING");
  9.     UI::_ADD_TEXT_COMPONENT_STRING(Message);
  10.     UI::_0x2ED7843F8F801023(0, 1);
  11. }
  12.  
  13.  
  14. void NotifyBottomCentre(char* Message)
  15. {
  16.     UI::_0xB87A37EEB7FAA67D("STRING");
  17.     UI::_ADD_TEXT_COMPONENT_STRING(Message);
  18.     UI::_0x9D77056A530643F6(2000, 1);
  19. }
  20.  
  21. Object PlayerCactus;
  22. Object NPCactus;
  23. Ped ped;
  24.  
  25. void CactusMod()
  26. {
  27.     Ped playerPed = PLAYER::PLAYER_PED_ID();
  28.     Vector3 position = ENTITY::GET_ENTITY_COORDS(playerPed, 1);
  29.  
  30.     if (PED::GET_CLOSEST_PED(position.x, position.y, position.z, 20.0f, 1, 0, &ped, 1, 1, -1))
  31.     {
  32.         ENTITY::SET_ENTITY_VISIBLE(playerPed, false);
  33.         STREAMING::REQUEST_MODEL(GAMEPLAY::GET_HASH_KEY("prop_cactus_01a"));
  34.         while (!STREAMING::HAS_MODEL_LOADED(GAMEPLAY::GET_HASH_KEY("prop_cactus_01a")))
  35.             WAIT(0);
  36.         PlayerCactus = OBJECT::CREATE_OBJECT(GAMEPLAY::GET_HASH_KEY("prop_cactus_01a"), -0.1509, 0.7198, -0.9917, 0, 0, 0);
  37.         ENTITY::ATTACH_ENTITY_TO_ENTITY(PlayerCactus, playerPed, 0, 0.1509, 0.7198, -0.9917, 0, 0, 180, 0, 1, 0, 0, 2, 1);
  38.         WEAPON::GIVE_DELAYED_WEAPON_TO_PED(playerPed, GAMEPLAY::GET_HASH_KEY("WEAPON_PISTOL"), 1000, 1);
  39.         ENTITY::SET_ENTITY_VISIBLE(ped, false);
  40.         ENTITY::FREEZE_ENTITY_POSITION(ped, true);
  41.         ENTITY::FREEZE_ENTITY_POSITION(playerPed, true);
  42.         STREAMING::REQUEST_MODEL(GAMEPLAY::GET_HASH_KEY("prop_cactus_01a"));
  43.         while (!STREAMING::HAS_MODEL_LOADED(GAMEPLAY::GET_HASH_KEY("prop_cactus_01a")))
  44.             WAIT(0);
  45.         NPCactus = OBJECT::CREATE_OBJECT(GAMEPLAY::GET_HASH_KEY("prop_cactus_01a"), -0.1509, 0.7198, -0.9917, 0, 0, 0);
  46.         ENTITY::ATTACH_ENTITY_TO_ENTITY(NPCactus, ped, 0, 0.1509, 0.7198, -0.9917, 0, 0, 180, 0, 1, 0, 0, 2, 1);
  47.         WEAPON::GIVE_DELAYED_WEAPON_TO_PED(ped, GAMEPLAY::GET_HASH_KEY("WEAPON_PISTOL"), 1000, 1);
  48.         NotifyAboveMap("Cactus Mode ~g~Enabled~w~");
  49.         WAIT(1000);
  50.         NotifyAboveMap("~g~3");
  51.         WAIT(1000);
  52.         NotifyAboveMap("~g~2");
  53.         WAIT(1000);
  54.         NotifyAboveMap("~g~1");
  55.         WAIT(1000);
  56.         NotifyAboveMap("~g~Cactus ~g~Wars!");
  57.         PED::SET_PED_RELATIONSHIP_GROUP_HASH(ped, GAMEPLAY::GET_HASH_KEY("HATES_PLAYER"));
  58.         ENTITY::FREEZE_ENTITY_POSITION(ped, false);
  59.         ENTITY::FREEZE_ENTITY_POSITION(playerPed, false);
  60.  
  61.         if (ENTITY::IS_ENTITY_DEAD(ped))
  62.         {
  63.             NotifyAboveMap("~g~Congratulations!~w~, You have Won the ~g~Cactus ~g~War!");
  64.             WAIT(2000);
  65.             for (int i = 0; i < 3; i++)
  66.             {
  67.                 char statNameFull[32];
  68.                 sprintf_s(statNameFull, "SP%d_TOTAL_CASH", i);
  69.                 Hash hash = GAMEPLAY::GET_HASH_KEY(statNameFull);
  70.                 int val;
  71.                 STATS::STAT_GET_INT(hash, &val, -1);
  72.                 val += 5000;
  73.                 STATS::STAT_SET_INT(hash, val, 1);
  74.             }
  75.             NotifyAboveMap("You have been rewarded ~g~$5000");
  76.         }
  77.     }
  78.     WAIT(3000);
  79. }
  80.  
  81. void CactusModCheck()
  82. {
  83.     if (ENTITY::IS_ENTITY_DEAD(ped))
  84.     {
  85.         NotifyAboveMap("~g~Congratulations!~w~, You have Won the ~g~Cactus ~g~War!");
  86.         WAIT(2000);
  87.         for (int i = 0; i < 3; i++)
  88.         {
  89.             char statNameFull[32];
  90.             sprintf_s(statNameFull, "SP%d_TOTAL_CASH", i);
  91.             Hash hash = GAMEPLAY::GET_HASH_KEY(statNameFull);
  92.             int val;
  93.             STATS::STAT_GET_INT(hash, &val, -1);
  94.             val += 5000;
  95.             STATS::STAT_SET_INT(hash, val, 1);
  96.         }
  97.         NotifyAboveMap("You have been rewarded ~g~$5000");
  98.     }
  99.  
  100.     else if (PLAYER::IS_PLAYER_DEAD(PLAYER::PLAYER_ID()))
  101.     {
  102.         WAIT(5000);
  103.         NotifyAboveMap("You lost the Cactus War.");
  104.         WAIT(1000);
  105.         NotifyAboveMap("Your ~r~Opponent~w~ has been rewarded ~g~$5000~w~ from your cash.");
  106.     }
  107.  
  108.     else if (PLAYER::IS_PLAYER_WANTED_LEVEL_GREATER(PLAYER::PLAYER_ID(), 0))
  109.     {
  110.         NotifyBottomCentre("Lose The Cops!");
  111.     }
  112. }
  113.  
  114. void main()
  115. {
  116.     DWORD maxTickCount;
  117.     DWORD waitTime = 150;
  118.     while (true)
  119.     {
  120.         DWORD maxTickCount = GetTickCount() + waitTime;
  121.         do
  122.         {
  123.             if (GetKeyState(0x4B) < 0) // K KEY
  124.             {
  125.                 CactusMod();
  126.             }
  127.  
  128.             if (GetKeyState(0x4C) < 0) // L KEY
  129.             {
  130.                 Ped playerPed = PLAYER::PLAYER_PED_ID();
  131.                 ENTITY::SET_ENTITY_VISIBLE(playerPed, true);
  132.                 OBJECT::DELETE_OBJECT(&PlayerCactus);
  133.                 NotifyAboveMap("Your Player is now Visible & Object is now ~g~Detached~w~.");
  134.                 WAIT(3000);
  135.             }
  136.             CactusModCheck();
  137.             WAIT(0);
  138.         } while (GetTickCount() < maxTickCount);
  139.         //waitTime = 0; no need
  140.         //waitTime = 200; I don't think this needed either
  141.     }
  142. }
  143.  
  144. void ScriptMain()
  145. {
  146.     main();
  147.     CactusMod();
  148. }
Advertisement
Add Comment
Please, Sign In to add comment