Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "script.h"
- #include <random>
- #include <iostream>
- #include <string>
- #include <ctime>
- #pragma warning(disable : 4244 4305) // double <-> float conversions
- Ped playerPed;
- float x, y, z, sx, sy, sz;
- Any blip[20];
- Vector3 spawnPt, spawnPt1, spawnPt2, position;
- Vector3 vehPos;
- DWORD combatMdl, driverMdl;
- DWORD crusaderHash, tankHash, lazerHash, insurgentHash, barracksHash, annihilatorHash, insurgentGHash, buzzardHash, valkyrieHash, polHeliHash, savageHash;
- // 14 slots, if it's too much, so what ?
- Any toDel;
- Any mainVehicle[20];
- Any crua[20], crub[20], cruc[20], crud[20];
- bool wasWanted = false;
- bool firstStart = true;
- bool ready[20];
- int delFlag = 0;
- float dist;
- bool debugV = true;
- bool isInTank = false;
- bool isInAir = false;
- //void set_spawn_points(Ped playerPed)
- //{
- // spawnPt1.x = position.x + 200.0f;
- // spawnPt1.y = position.y;
- // spawnPt1.z = position.z + 4.0f;
- // spawnPt2.x = position.x;
- // spawnPt2.y = position.y + 150.0f;
- // spawnPt1.z = position.z + 4.0f;
- // x = position.x;
- // y = position.y;
- // z = position.z;
- //}
- void debug_func()
- {
- if (debugV) {
- debugV = false;
- DWORD vehHash = savageHash;
- STREAMING::REQUEST_MODEL(GAMEPLAY::GET_HASH_KEY("VEHICLE_WEAPON_SPACE_ROCKET")); STREAMING::REQUEST_MODEL(driverMdl); STREAMING::REQUEST_MODEL(combatMdl); STREAMING::REQUEST_MODEL(vehHash); STREAMING::REQUEST_MODEL(GAMEPLAY::GET_HASH_KEY("WEAPON_COMBATMG"));
- // WAITING FOR LOADING //
- while (!STREAMING::HAS_MODEL_LOADED(driverMdl) && !STREAMING::HAS_MODEL_LOADED(combatMdl) && !STREAMING::HAS_MODEL_LOADED(vehHash) && !STREAMING::HAS_MODEL_LOADED(GAMEPLAY::GET_HASH_KEY("WEAPON_COMBATMG")) && !STREAMING::HAS_MODEL_LOADED((GAMEPLAY::GET_HASH_KEY("WEAPON_CARBINERIFLE"))))
- WAIT(100);
- mainVehicle[19] = VEHICLE::CREATE_VEHICLE(vehHash, position.x + 20.0f, position.y, position.z, ENTITY::GET_ENTITY_HEADING(playerPed), 0, true); WAIT(100);
- crua[19] = PED::CREATE_PED_INSIDE_VEHICLE(mainVehicle[19], 3, combatMdl, -1, false, false);
- PED::SET_PED_SHOOT_RATE(crua[19], 1);
- AI::TASK_VEHICLE_SHOOT_AT_PED(crua[19], playerPed, 100.0f);
- //AI::TASK_SHOOT_AT_COORD(crua[19], position.x + 20.0f, position.y, position.z, true, true);
- }
- }
- void spawnIns(int type, int spawnId)
- {
- bool gIns = false;
- DWORD vehHash;
- DWORD weapHash;
- weapHash = GAMEPLAY::GET_HASH_KEY("WEAPON_CARBINERIFLE");
- ready[spawnId] = false;
- // DYNAMIC SPAWN PTS
- spawnPt = spawnPt2;
- if (rand() % 11 > 5) spawnPt = spawnPt1;
- spawnPt.z += 15.0f;
- if (type > 4) spawnPt.z += 250.0f;
- // CRUSADER
- if (type == 1) vehHash = crusaderHash;
- if (type == 2) { vehHash = insurgentHash; if (rand() % 2 == 1) { vehHash = insurgentGHash; gIns = true; } }
- if (type == 3) vehHash = barracksHash;
- // TANK
- if (type == 4) vehHash = tankHash;
- // AIR VEHICLES
- // ANIHILATOR
- if (type == 5) vehHash = annihilatorHash;
- if (type == 5) weapHash = GAMEPLAY::GET_HASH_KEY("WEAPON_COMBATMG");
- // LAZERS
- if (type == 6) vehHash = lazerHash;
- if (type == 7) vehHash = buzzardHash;
- if (type == 8) vehHash = valkyrieHash;
- if (type == 9) vehHash = savageHash;
- ////////// STREAMING AND SPAWNING //////////
- // STREAMING REQUESTS //
- STREAMING::REQUEST_MODEL(GAMEPLAY::GET_HASH_KEY("WEAPON_CARBINERIFLE")); STREAMING::REQUEST_MODEL(driverMdl); STREAMING::REQUEST_MODEL(combatMdl); STREAMING::REQUEST_MODEL(vehHash); STREAMING::REQUEST_MODEL(GAMEPLAY::GET_HASH_KEY("WEAPON_COMBATMG"));
- // WAITING FOR LOADING //
- while (!STREAMING::HAS_MODEL_LOADED(driverMdl) && !STREAMING::HAS_MODEL_LOADED(combatMdl) && !STREAMING::HAS_MODEL_LOADED(vehHash) && !STREAMING::HAS_MODEL_LOADED(GAMEPLAY::GET_HASH_KEY("WEAPON_COMBATMG")) && !STREAMING::HAS_MODEL_LOADED((GAMEPLAY::GET_HASH_KEY("WEAPON_CARBINERIFLE"))))
- WAIT(100);
- // SPAWNING VEHICLE FIRST //
- mainVehicle[spawnId] = VEHICLE::CREATE_VEHICLE(vehHash, spawnPt.x, spawnPt.y, spawnPt.z - 15.0f, ENTITY::GET_ENTITY_HEADING(playerPed) , 0, true); WAIT(100);
- // WAITING 100ms
- // SETTING ON GROUND AND CREATING PEDS [ONLY FOR GROUND VEHICLES!!]
- if (type < 5) VEHICLE::SET_VEHICLE_ON_GROUND_PROPERLY(mainVehicle[spawnId]);
- if (type < 5) WAIT(2000);
- WAIT(100);
- // ALWAYS SPAWNING PILOT
- crua[spawnId] = PED::CREATE_PED_INSIDE_VEHICLE(mainVehicle[spawnId], 3, driverMdl, -1, false, false);
- // ONLY SPAWNING SECOND PERSONNEL IF NOT AIR VEHICLE AND NOT TANK
- if (type < 4) { if (gIns){ crub[spawnId] = PED::CREATE_PED_INSIDE_VEHICLE(mainVehicle[spawnId], 3, combatMdl, 7, false, false); } else { crub[spawnId] = PED::CREATE_PED_INSIDE_VEHICLE(mainVehicle[spawnId], 3, combatMdl, 0, false, false); } }
- // ONLY SPAWNING IF IS ANNI CREW OR GROUND VEHICLES
- if (type == 5 || type < 4 || type == 8) cruc[spawnId] = PED::CREATE_PED_INSIDE_VEHICLE(mainVehicle[spawnId], 3, combatMdl, 1, false, false);
- if (type == 5 || type < 4 || type == 8) crud[spawnId] = PED::CREATE_PED_INSIDE_VEHICLE(mainVehicle[spawnId], 3, combatMdl, 2, false, false);
- ////////// TASKS ON SPAWN //////////
- if (type < 5) AI::TASK_VEHICLE_DRIVE_TO_COORD(crua[spawnId], mainVehicle[spawnId], position.x, position.y, position.z, 70.0f, 1, ENTITY::GET_ENTITY_MODEL(mainVehicle[spawnId]), 1, 0xC00AB, -1);
- if (type == 6){ VEHICLE::SET_VEHICLE_FORWARD_SPEED(mainVehicle[spawnId], 80.0f); }
- else { VEHICLE::SET_VEHICLE_FORWARD_SPEED(mainVehicle[spawnId], 10.0f); }
- if (type == 5 || type == 7) VEHICLE::SET_HELI_BLADES_FULL_SPEED(mainVehicle[spawnId]);
- // ADDING ARMOUR TO 3 CREW MEMBERS, PILOT NEVER HAS ARMOR.
- if (type < 4) PED::ADD_ARMOUR_TO_PED(crub[spawnId], 100);
- if (type == 5 || type < 4) PED::ADD_ARMOUR_TO_PED(cruc[spawnId], 100);
- if (type == 5 || type < 4) PED::ADD_ARMOUR_TO_PED(crud[spawnId], 100);
- // WEAPON DELAYED
- WEAPON::GIVE_DELAYED_WEAPON_TO_PED(crua[spawnId], weapHash, 100, false);
- if (type < 4) WEAPON::GIVE_DELAYED_WEAPON_TO_PED(crub[spawnId], weapHash, 100, false);
- if (type == 5 || type < 4) WEAPON::GIVE_DELAYED_WEAPON_TO_PED(cruc[spawnId], weapHash, 100, false);
- if (type == 5 || type < 4) WEAPON::GIVE_DELAYED_WEAPON_TO_PED(crud[spawnId], weapHash, 100, false);
- if (type == 5) WAIT(2000);
- if (gIns) {
- WEAPON::SET_CURRENT_PED_WEAPON(crub[spawnId], GAMEPLAY::GET_HASH_KEY("VEHICLE_WEAPON_TURRET_INSURGENT"), true);
- WEAPON::SET_PED_INFINITE_AMMO(crub[spawnId], true, GAMEPLAY::GET_HASH_KEY("VEHICLE_WEAPON_TURRET_INSURGENT"));
- PED::SET_PED_SHOOT_RATE(crub[spawnId], 1000);
- }
- if (type == 9) {
- STREAMING::REQUEST_MODEL(GAMEPLAY::GET_HASH_KEY("VEHICLE_WEAPON_PLAYER_LAZER"));
- WEAPON::SET_CURRENT_PED_WEAPON(crua[spawnId], GAMEPLAY::GET_HASH_KEY("VEHICLE_WEAPON_PLAYER_LAZER"), true);
- WEAPON::SET_PED_INFINITE_AMMO(crua[spawnId], true, GAMEPLAY::GET_HASH_KEY("VEHICLE_WEAPON_PLAYER_LAZER"));
- PED::SET_PED_SHOOT_RATE(crua[spawnId], 100);
- AI::TASK_VEHICLE_SHOOT_AT_PED(crua[spawnId], playerPed, 100.0f);
- }
- if (type == 6) {
- VEHICLE::SET_VEHICLE_STEER_BIAS(mainVehicle[spawnId], 250.0f);
- VEHICLE::SET_VEHICLE_FORWARD_SPEED(mainVehicle[spawnId], 200.0f);
- ENTITY::SET_ENTITY_MAX_SPEED(mainVehicle[spawnId], 200.0f);
- AI::TASK_LOOK_AT_ENTITY(crua[spawnId], playerPed, -1, 2048, 3);
- AI::TASK_PLANE_CHASE(crua[spawnId], playerPed, 150.0f, 150.0f, 250.0f);
- WAIT(1000);
- }
- if (type == 7) {
- WEAPON::SET_CURRENT_PED_WEAPON(crua[spawnId], GAMEPLAY::GET_HASH_KEY("VEHICLE_WEAPON_PLAYER_BUZZARD"), true);
- WEAPON::SET_PED_INFINITE_AMMO(crua[spawnId], true, GAMEPLAY::GET_HASH_KEY("VEHICLE_WEAPON_PLAYER_BUZZARD"));
- PED::SET_PED_SHOOT_RATE(crua[spawnId], 2000);
- AI::TASK_VEHICLE_SHOOT_AT_PED(crua[spawnId], playerPed, 100.0f);
- AI::TASK_VEHICLE_CHASE(crua[spawnId], playerPed);
- }
- if (type == 8)
- {
- WEAPON::SET_CURRENT_PED_WEAPON(crud[spawnId], GAMEPLAY::GET_HASH_KEY("VEHICLE_WEAPON_PLAYER_BULLET"), true);
- WEAPON::SET_PED_INFINITE_AMMO(crud[spawnId], true, GAMEPLAY::GET_HASH_KEY("VEHICLE_WEAPON_PLAYER_BULLET"));
- PED::SET_PED_SHOOT_RATE(crud[spawnId], 1000);
- AI::TASK_VEHICLE_SHOOT_AT_PED(crud[spawnId], playerPed, 100.0f);
- WEAPON::SET_CURRENT_PED_WEAPON(cruc[spawnId], GAMEPLAY::GET_HASH_KEY("VEHICLE_WEAPON_PLAYER_BULLET"), true);
- WEAPON::SET_PED_INFINITE_AMMO(cruc[spawnId], true, GAMEPLAY::GET_HASH_KEY("VEHICLE_WEAPON_PLAYER_BULLET"));
- PED::SET_PED_SHOOT_RATE(cruc[spawnId], 1000);
- AI::TASK_VEHICLE_SHOOT_AT_PED(cruc[spawnId], playerPed, 100.0f);
- }
- if (spawnId == 6) {
- blip[spawnId] = UI::GET_BLIP_FROM_ENTITY(mainVehicle[spawnId]);
- UI::REMOVE_BLIP(&blip[spawnId]);
- blip[spawnId] = UI::ADD_BLIP_FOR_ENTITY(mainVehicle[spawnId]);
- UI::SET_BLIP_SPRITE(blip[spawnId], 16);
- UI::SET_BLIP_AS_MISSION_CREATOR_BLIP(blip[spawnId], false);
- UI::SET_BLIP_FADE(blip[spawnId], false, false);
- }
- if (spawnId < 7) {
- blip[spawnId] = UI::ADD_BLIP_FOR_ENTITY(mainVehicle[spawnId]);
- UI::SET_BLIP_SPRITE(blip[spawnId], 8);
- UI::SET_BLIP_FLASHES(blip[spawnId], true);
- }
- UI::SET_BLIP_AS_SHORT_RANGE(blip[spawnId], false);
- UI::SET_BLIP_COLOUR(blip[spawnId], 1);
- // BLIP ID 16 IS JET FIGHTER
- }
- void set_spawn_points()
- {
- //// setting offset
- //y = 300.0f;
- //x = 300.0f;
- //// setting up spawn pts
- //spawnPt1 = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(playerPed, 0.0, y, 0.0);
- //spawnPt2 = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(playerPed, x, 0.0, 0.0);
- if (isInAir == false) {
- float step = 0.0f;
- if (rand() % 2 == 1){ step = -180.0f; }
- else { step = 180.0f; }
- spawnPt1 = position;
- spawnPt1.x = position.x + step;
- if (rand() % 2 == 1){ step = -180.0f; }
- else { step = 180.0f; }
- spawnPt2 = position;
- spawnPt2.y = position.y + step;
- if (rand() % 2 == 1){ step = -2.0f; }
- else { step = 2.0f; }
- // set spawn points with a radius of 500
- int maxStep = 50;
- // finding spawnpt1 loop.
- while (!PATHFIND::IS_POINT_ON_ROAD(spawnPt1.x, spawnPt1.y, spawnPt1.z, 0) && maxStep > 0)
- {
- spawnPt1.x += step;
- maxStep--;
- }
- // resetting max step to 75
- maxStep = 50;
- if (rand() % 2 == 1){ step = -2.0f; }
- else { step = 2.0f; }
- // finding spawnpt2 loop.
- while (!PATHFIND::IS_POINT_ON_ROAD(spawnPt2.x, spawnPt2.y, spawnPt2.z, 0) && maxStep > 0)
- {
- spawnPt2.y -= step;
- maxStep--;
- }
- GAMEPLAY::GET_GROUND_Z_FOR_3D_COORD(spawnPt2.x, spawnPt2.y, spawnPt2.z + 100.0f, &spawnPt2.z);
- GAMEPLAY::GET_GROUND_Z_FOR_3D_COORD(spawnPt1.x, spawnPt1.y, spawnPt1.z + 100.0f, &spawnPt1.z);
- }
- else {
- float step = 0.0f;
- if (rand() % 2 == 1){ step = -150.0f; }
- else { step = 150.0f; }
- spawnPt1 = position;
- spawnPt2 = position;
- spawnPt1.x = position.x + step;
- if (rand() % 2 == 1){ step = -150.0f; }
- else { step = 150.0f; }
- spawnPt2.y = position.y + step;
- spawnPt1.z = position.z + 150.0f;
- spawnPt2.z = position.z + 150.0f;
- }
- }
- void update()
- {
- if (firstStart){
- // setting up models
- driverMdl = GAMEPLAY::GET_HASH_KEY("S_M_Y_Marine_01");
- combatMdl = GAMEPLAY::GET_HASH_KEY("S_M_Y_Marine_03");
- // setting up vehicles
- buzzardHash = GAMEPLAY::GET_HASH_KEY("buzzard");
- crusaderHash = GAMEPLAY::GET_HASH_KEY("crusader");
- tankHash = GAMEPLAY::GET_HASH_KEY("rhino");
- annihilatorHash = GAMEPLAY::GET_HASH_KEY("annihilator");
- insurgentHash = GAMEPLAY::GET_HASH_KEY("insurgent2");
- insurgentGHash = GAMEPLAY::GET_HASH_KEY("insurgent");
- lazerHash = GAMEPLAY::GET_HASH_KEY("lazer");
- barracksHash = GAMEPLAY::GET_HASH_KEY("barracks");
- polHeliHash = GAMEPLAY::GET_HASH_KEY("polmav");
- savageHash = GAMEPLAY::GET_HASH_KEY("savage");
- valkyrieHash = GAMEPLAY::GET_HASH_KEY("valkyrie");
- firstStart = false;
- for (int i = 0; i <= 19; i++){ ready[i] = true; }
- }
- // SPAWN ID SYSTEM ///////
- // LAND VEHICLES :: 0-5 //
- // TANK :: 6 //
- // ANNIHILATORS :: 7-8 //
- // JETS :: 9-16//
- //////////////////////////
- Player player = PLAYER::PLAYER_ID();
- playerPed = PLAYER::PLAYER_PED_ID();
- Vehicle veh = PED::GET_VEHICLE_PED_IS_USING(playerPed);
- position = ENTITY::GET_ENTITY_COORDS(playerPed, 1);
- WAIT(1000);
- isInAir = false;
- if (PED::IS_PED_IN_FLYING_VEHICLE(playerPed)) isInAir = true;
- isInTank = false;
- toDel = PED::GET_VEHICLE_PED_IS_IN(playerPed, false);
- if (ENTITY::GET_ENTITY_MODEL(toDel) == tankHash) isInTank = true;
- if (PLAYER::GET_PLAYER_WANTED_LEVEL(player) > 4)
- {
- PED::SET_AI_WEAPON_DAMAGE_MODIFIER(0.020f);
- dist = 210.0f;
- if (PED::IS_PED_IN_ANY_VEHICLE(playerPed, false)) dist = 180.0f;
- set_spawn_points();
- //CLEANING UP
- for (int i = 0; i <= 19; i++)
- {
- delFlag = 0;
- vehPos = ENTITY::GET_ENTITY_COORDS(mainVehicle[i], false);
- if (isInAir && !ENTITY::DOES_ENTITY_EXIST(mainVehicle[i])) ready[i] = true;
- if (ENTITY::IS_ENTITY_DEAD(mainVehicle[i])) { ENTITY::SET_ENTITY_AS_NO_LONGER_NEEDED(&mainVehicle[i]); ready[i] = true; }
- if (ENTITY::IS_ENTITY_DEAD(crua[i])){ ENTITY::SET_ENTITY_AS_NO_LONGER_NEEDED(&crua[i]); UI::REMOVE_BLIP(&blip[i]); delFlag++; }
- if (ENTITY::IS_ENTITY_DEAD(crub[i])){ ENTITY::SET_ENTITY_AS_NO_LONGER_NEEDED(&crub[i]); UI::REMOVE_BLIP(&blip[i]); delFlag++; }
- if (ENTITY::IS_ENTITY_DEAD(cruc[i])){ ENTITY::SET_ENTITY_AS_NO_LONGER_NEEDED(&cruc[i]); UI::REMOVE_BLIP(&blip[i]); delFlag++; }
- if (ENTITY::IS_ENTITY_DEAD(crud[i])){ ENTITY::SET_ENTITY_AS_NO_LONGER_NEEDED(&crud[i]); UI::REMOVE_BLIP(&blip[i]); delFlag++; }
- // DELFLAG IS USED TO CHECK IF ALL THE CREW IS DEAD. IF IT'S THE CASE, THEN WE DELETE THE VEHICLE
- // DELFLAG ONLY WORKS ON GROUND VEHICLES.
- if (delFlag == 4){ ENTITY::SET_ENTITY_AS_NO_LONGER_NEEDED(&mainVehicle[i]); ready[i] = true; }
- if (i < 7 || (i > 8 && i < 16)){
- if (i > 8 && i < 16) dist = 900.0f;
- if (!ENTITY::IS_ENTITY_AT_COORD(mainVehicle[i], position.x, position.y, position.z, dist, dist, dist * 1.5f, 0, 1, 0)){
- ENTITY::DELETE_ENTITY(&mainVehicle[i]);
- ENTITY::DELETE_ENTITY(&crua[i]);
- ENTITY::DELETE_ENTITY(&crub[i]);
- ENTITY::DELETE_ENTITY(&cruc[i]);
- ENTITY::DELETE_ENTITY(&crud[i]);
- ENTITY::SET_ENTITY_AS_NO_LONGER_NEEDED(&mainVehicle[i]);
- ENTITY::SET_ENTITY_AS_NO_LONGER_NEEDED(&crua[i]);
- ready[i] = true;
- UI::REMOVE_BLIP(&blip[i]);
- }
- }
- }
- // SPAWN INDEX SYSTEM ////
- // LAND VEHICLES :: 0-5 //
- // TANK :: 6 //
- // ANNIHILATORS :: 7-8 //
- // JETS :: 9-15//
- // BUZZARD :: 16 //
- // VALKYRIE :: 17 //
- // SAVAGE :: 18 //
- //////////////////////////
- // SPAWN IDs
- // CRUSADER :: 1
- // INSURGENT :: 2
- // BARRACKS :: 3
- // TANK :: 4
- // ANNIHILATOR :: 5
- // LAZER :: 6
- // BUZZARD :: 7
- // SPAWN SYSTEM V3.0
- // SPAWNS 6 GROUND VEHICLES REGARDLESS. (3 CRUSADERS, 2 INSURGENTS, 1 BARRACKS)
- // SPAWN NEW WAVE IF :
- // - VEHICLES AND CREW ARE DEAD OR DO NOT EXIST
- // - PLAYERS HAS LEFT THEM BEHIND
- // DYNAMIC SPAWN FOR OTHER ENTITIES.
- // TANK : 1 chance out of 200 per update
- // ANNIHILATOR : 2 max
- // LAZERS : only when in air and high in the sky
- wasWanted = true;
- for (int i = 0; i <= 19; i++)
- {
- position = ENTITY::GET_ENTITY_COORDS(playerPed, 1);
- set_spawn_points();
- switch (i){
- case 0:
- if (ready[i] && !isInAir) { spawnIns(1, i); }
- break;
- case 1:
- if (ready[i] && !isInAir) { spawnIns(1, i); }
- break;
- case 2:
- if (ready[i] && !isInAir) { spawnIns(1, i); }
- break;
- case 3:
- if (ready[i] && !isInAir) { spawnIns(2, i); }
- break;
- case 4:
- if (ready[i] && !isInAir) { spawnIns(2, i); }
- break;
- case 5:
- if (ready[i] && !isInAir) { spawnIns(3, i); }
- break;
- case 6:
- if (ready[i] && rand() % 75 == 0 && !isInAir) { spawnIns(4, i); }
- break;
- case 7:
- // REMOVED ANIHILATOR FOR BALANCING PURPOSES
- //if (ready[i] && !isInAir) { spawnIns(5, i); }
- break;
- case 8:
- if (ready[i] && !isInAir) { spawnIns(5, i); }
- break;
- case 9:
- if (ready[i] && isInAir) { spawnIns(6, i); }
- break;
- case 10:
- if (ready[i] && isInAir) { spawnIns(6, i); }
- break;
- case 11:
- if (ready[i] && isInAir) { spawnIns(6, i); }
- break;
- case 12:
- if (ready[i] && isInAir) { spawnIns(6, i); }
- break;
- case 13:
- if (ready[i] && isInAir) { spawnIns(6, i); }
- break;
- case 14:
- if (ready[i] && isInAir) { spawnIns(6, i); }
- break;
- case 15:
- if (ready[i] && isInAir) { spawnIns(6, i); }
- break;
- case 16:
- if (ready[i] && !isInAir) { spawnIns(7, i); }
- break;
- case 17:
- if (ready[i] && !isInAir) { spawnIns(8, i); }
- break;
- case 18:
- if (ready[i] && !isInAir && isInTank) { spawnIns(9, i); }
- break;
- }
- }
- if (!ENTITY::IS_ENTITY_DEAD(mainVehicle[16])) {
- WEAPON::SET_CURRENT_PED_WEAPON(crua[16], GAMEPLAY::GET_HASH_KEY("VEHICLE_WEAPON_PLAYER_BUZZARD"), true);
- WEAPON::SET_PED_INFINITE_AMMO(crua[16], true, GAMEPLAY::GET_HASH_KEY("VEHICLE_WEAPON_PLAYER_BUZZARD"));
- PED::SET_PED_SHOOT_RATE(crua[16], 2000);
- if (ENTITY::IS_ENTITY_A_VEHICLE(playerPed) && rand() % 11 == 5 ) {
- WEAPON::SET_CURRENT_PED_WEAPON(crua[16], GAMEPLAY::GET_HASH_KEY("VEHICLE_WEAPON_PLANE_ROCKET"), true);
- WEAPON::SET_PED_INFINITE_AMMO(crua[16], true, GAMEPLAY::GET_HASH_KEY("VEHICLE_WEAPON_PLANE_ROCKET"));
- PED::SET_PED_SHOOT_RATE(crua[16], 1);
- }
- AI::TASK_VEHICLE_SHOOT_AT_PED(crua[16], playerPed, 100.0f);
- }
- if (isInAir)
- {
- for (int i = 9; i <= 15; i++) {
- if (mainVehicle[i], position.x, position.y, position.z, 250.0f, 250.0f, 250.0f, 0, 1, 0) { ENTITY::DELETE_ENTITY(&mainVehicle[i]); ENTITY::DELETE_ENTITY(&crua[i]); }
- //AI::TASK_VEHICLE_CHASE(crua[i], playerPed);
- //VEHICLE::SET_VEHICLE_FORWARD_SPEED(mainVehicle[i], 80.0f);
- }
- }
- GAMEPLAY::SET_DISPATCH_TIME_BETWEEN_SPAWN_ATTEMPTS_MULTIPLIER(playerPed, 20.0f);
- }
- else {
- if (wasWanted){
- PED::SET_AI_WEAPON_DAMAGE_MODIFIER(1.0f);
- VEHICLE::SET_VEHICLE_MODEL_IS_SUPPRESSED(polHeliHash, false);
- VEHICLE::SET_VEHICLE_MODEL_IS_SUPPRESSED(GAMEPLAY::GET_HASH_KEY("police3"), false);
- GAMEPLAY::SET_DISPATCH_TIME_BETWEEN_SPAWN_ATTEMPTS_MULTIPLIER(playerPed, 1.0f);
- wasWanted = false;
- for (int i = 0; i <= 19; i++)
- {
- ENTITY::SET_ENTITY_AS_NO_LONGER_NEEDED(&mainVehicle[i]);
- ENTITY::SET_ENTITY_AS_NO_LONGER_NEEDED(&crua[i]);
- ENTITY::SET_ENTITY_AS_NO_LONGER_NEEDED(&crub[i]);
- ENTITY::SET_ENTITY_AS_NO_LONGER_NEEDED(&cruc[i]);
- ENTITY::SET_ENTITY_AS_NO_LONGER_NEEDED(&crud[i]);
- AI::CLEAR_PED_TASKS_IMMEDIATELY(crua[i]);
- AI::CLEAR_PED_TASKS_IMMEDIATELY(crub[i]);
- AI::CLEAR_PED_TASKS_IMMEDIATELY(cruc[i]);
- AI::CLEAR_PED_TASKS_IMMEDIATELY(crud[i]);
- UI::REMOVE_BLIP(&blip[i]);
- }
- for (int i = 9; i <= 15; i++) {
- ENTITY::DELETE_ENTITY(&mainVehicle[i]);
- ENTITY::DELETE_ENTITY(&crua[i]);
- ENTITY::SET_ENTITY_AS_NO_LONGER_NEEDED(&crua[i]);
- ENTITY::SET_ENTITY_AS_NO_LONGER_NEEDED(&mainVehicle[i]);
- }
- }
- // USE THIS TO TRY FUNKY STUFF
- //debug_func();
- }
- }
- void main()
- {
- while (true)
- {
- update();
- }
- }
- void ScriptMain()
- {
- srand(GetTickCount());
- main();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement