Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "script.h"
- #include <string>
- #pragma warning(disable : 4244 4305) // Double <-> Float Conversions
- void NotifyAboveMap(char* Message)
- {
- UI::_0x202709F4C58A0424("STRING");
- UI::_ADD_TEXT_COMPONENT_STRING(Message);
- UI::_0x2ED7843F8F801023(0, 1);
- }
- void NotifyBottomCentre(char* Message)
- {
- UI::_0xB87A37EEB7FAA67D("STRING");
- UI::_ADD_TEXT_COMPONENT_STRING(Message);
- UI::_0x9D77056A530643F6(2000, 1);
- }
- Object PlayerCactus;
- Object NPCactus;
- Ped ped;
- void CactusMod()
- {
- Ped playerPed = PLAYER::PLAYER_PED_ID();
- Vector3 position = ENTITY::GET_ENTITY_COORDS(playerPed, 1);
- if (PED::GET_CLOSEST_PED(position.x, position.y, position.z, 20.0f, 1, 0, &ped, 1, 1, -1))
- {
- ENTITY::SET_ENTITY_VISIBLE(playerPed, false);
- STREAMING::REQUEST_MODEL(GAMEPLAY::GET_HASH_KEY("prop_cactus_01a"));
- while (!STREAMING::HAS_MODEL_LOADED(GAMEPLAY::GET_HASH_KEY("prop_cactus_01a")))
- WAIT(0);
- PlayerCactus = OBJECT::CREATE_OBJECT(GAMEPLAY::GET_HASH_KEY("prop_cactus_01a"), -0.1509, 0.7198, -0.9917, 0, 0, 0);
- ENTITY::ATTACH_ENTITY_TO_ENTITY(PlayerCactus, playerPed, 0, 0.1509, 0.7198, -0.9917, 0, 0, 180, 0, 1, 0, 0, 2, 1);
- WEAPON::GIVE_DELAYED_WEAPON_TO_PED(playerPed, GAMEPLAY::GET_HASH_KEY("WEAPON_PISTOL"), 1000, 1);
- ENTITY::SET_ENTITY_VISIBLE(ped, false);
- ENTITY::FREEZE_ENTITY_POSITION(ped, true);
- ENTITY::FREEZE_ENTITY_POSITION(playerPed, true);
- STREAMING::REQUEST_MODEL(GAMEPLAY::GET_HASH_KEY("prop_cactus_01a"));
- while (!STREAMING::HAS_MODEL_LOADED(GAMEPLAY::GET_HASH_KEY("prop_cactus_01a")))
- WAIT(0);
- NPCactus = OBJECT::CREATE_OBJECT(GAMEPLAY::GET_HASH_KEY("prop_cactus_01a"), -0.1509, 0.7198, -0.9917, 0, 0, 0);
- ENTITY::ATTACH_ENTITY_TO_ENTITY(NPCactus, ped, 0, 0.1509, 0.7198, -0.9917, 0, 0, 180, 0, 1, 0, 0, 2, 1);
- WEAPON::GIVE_DELAYED_WEAPON_TO_PED(ped, GAMEPLAY::GET_HASH_KEY("WEAPON_PISTOL"), 1000, 1);
- NotifyAboveMap("Cactus Mode ~g~Enabled~w~");
- WAIT(1000);
- NotifyAboveMap("~g~3");
- WAIT(1000);
- NotifyAboveMap("~g~2");
- WAIT(1000);
- NotifyAboveMap("~g~1");
- WAIT(1000);
- NotifyAboveMap("~g~Cactus ~g~Wars!");
- PED::SET_PED_RELATIONSHIP_GROUP_HASH(ped, GAMEPLAY::GET_HASH_KEY("HATES_PLAYER"));
- ENTITY::FREEZE_ENTITY_POSITION(ped, false);
- ENTITY::FREEZE_ENTITY_POSITION(playerPed, false);
- if (ENTITY::IS_ENTITY_DEAD(ped))
- {
- NotifyAboveMap("~g~Congratulations!~w~, You have Won the ~g~Cactus ~g~War!");
- WAIT(2000);
- for (int i = 0; i < 3; i++)
- {
- char statNameFull[32];
- sprintf_s(statNameFull, "SP%d_TOTAL_CASH", i);
- Hash hash = GAMEPLAY::GET_HASH_KEY(statNameFull);
- int val;
- STATS::STAT_GET_INT(hash, &val, -1);
- val += 5000;
- STATS::STAT_SET_INT(hash, val, 1);
- }
- NotifyAboveMap("You have been rewarded ~g~$5000");
- }
- }
- WAIT(3000);
- }
- void CactusModCheck()
- {
- if (ENTITY::IS_ENTITY_DEAD(ped))
- {
- NotifyAboveMap("~g~Congratulations!~w~, You have Won the ~g~Cactus ~g~War!");
- WAIT(2000);
- for (int i = 0; i < 3; i++)
- {
- char statNameFull[32];
- sprintf_s(statNameFull, "SP%d_TOTAL_CASH", i);
- Hash hash = GAMEPLAY::GET_HASH_KEY(statNameFull);
- int val;
- STATS::STAT_GET_INT(hash, &val, -1);
- val += 5000;
- STATS::STAT_SET_INT(hash, val, 1);
- }
- NotifyAboveMap("You have been rewarded ~g~$5000");
- }
- else if (PLAYER::IS_PLAYER_DEAD(PLAYER::PLAYER_ID()))
- {
- WAIT(5000);
- NotifyAboveMap("You lost the Cactus War.");
- WAIT(1000);
- NotifyAboveMap("Your ~r~Opponent~w~ has been rewarded ~g~$5000~w~ from your cash.");
- }
- else if (PLAYER::IS_PLAYER_WANTED_LEVEL_GREATER(PLAYER::PLAYER_ID(), 0))
- {
- NotifyBottomCentre("Lose The Cops!");
- }
- }
- void main()
- {
- DWORD maxTickCount;
- DWORD waitTime = 150;
- while (true)
- {
- DWORD maxTickCount = GetTickCount() + waitTime;
- do
- {
- if (GetKeyState(0x4B) < 0) // K KEY
- {
- CactusMod();
- }
- if (GetKeyState(0x4C) < 0) // L KEY
- {
- Ped playerPed = PLAYER::PLAYER_PED_ID();
- ENTITY::SET_ENTITY_VISIBLE(playerPed, true);
- OBJECT::DELETE_OBJECT(&PlayerCactus);
- NotifyAboveMap("Your Player is now Visible & Object is now ~g~Detached~w~.");
- WAIT(3000);
- }
- CactusModCheck();
- WAIT(0);
- } while (GetTickCount() < maxTickCount);
- //waitTime = 0; no need
- //waitTime = 200; I don't think this needed either
- }
- }
- void ScriptMain()
- {
- main();
- CactusMod();
- }
Advertisement
Add Comment
Please, Sign In to add comment