Advertisement
djhonga2001

GTA-V chauffeur

Jul 12th, 2015
983
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.41 KB | None | 0 0
  1. Vector3 get_blip_marker()
  2. {
  3.     static Vector3 zero;
  4.     Vector3 coords;
  5.  
  6.     bool blipFound = false;
  7.     // search for marker blip
  8.     int blipIterator = UI::_GET_BLIP_INFO_ID_ITERATOR();
  9.     for (Blip i = UI::GET_FIRST_BLIP_INFO_ID(blipIterator); UI::DOES_BLIP_EXIST(i) != 0; i = UI::GET_NEXT_BLIP_INFO_ID(blipIterator))
  10.     {
  11.         if (UI::GET_BLIP_INFO_ID_TYPE(i) == 4)
  12.         {
  13.             coords = UI::GET_BLIP_INFO_ID_COORD(i);
  14.             blipFound = true;
  15.             break;
  16.         }
  17.     }
  18.     if (blipFound)
  19.     {
  20.         return coords;
  21.     }
  22.  
  23.     set_status_text("Map marker isn't set");
  24.     return zero;
  25. }
  26.  
  27. void get_chauffeur_to_marker()
  28. {
  29.     Vector3 coords = get_blip_marker();
  30.  
  31.     if (coords.x + coords.y == 0) return;
  32.  
  33.     // get entity to teleport
  34.     Entity e = PLAYER::PLAYER_PED_ID();
  35.     if (PED::IS_PED_IN_ANY_VEHICLE(e, 0)) //kick out of current veh
  36.     {
  37.         AI::CLEAR_PED_TASKS_IMMEDIATELY(PLAYER::PLAYER_PED_ID());
  38.     }
  39.  
  40.     GAMEPLAY::GET_GROUND_Z_FOR_3D_COORD(coords.x, coords.y, coords.z, &coords.z);
  41.     coords.z += 3.0;
  42.  
  43.     Hash V_hash = GAMEPLAY::GET_HASH_KEY("STRETCH");
  44.     Hash P_hash = GAMEPLAY::GET_HASH_KEY("A_C_CHIMP");
  45.     STREAMING::REQUEST_MODEL(V_hash);
  46.     STREAMING::REQUEST_MODEL(P_hash);
  47.     while ((!STREAMING::HAS_MODEL_LOADED(V_hash)) || (!STREAMING::HAS_MODEL_LOADED(P_hash))) WAIT(0);
  48.     Vector3 spawn_coords = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(PLAYER::PLAYER_PED_ID(), 0.0, 5.0, 0.0);
  49.     FLOAT lookDir = ENTITY::GET_ENTITY_HEADING(PLAYER::PLAYER_PED_ID());
  50.     Vehicle veh = VEHICLE::CREATE_VEHICLE(V_hash, spawn_coords.x, spawn_coords.y, spawn_coords.z, lookDir, 1, 0);
  51.     Ped ped = PED::CREATE_PED(25, P_hash, spawn_coords.x, spawn_coords.y, spawn_coords.z, 0, false, false);
  52.  
  53.     while (!NETWORK::NETWORK_HAS_CONTROL_OF_ENTITY(veh))
  54.     {
  55.         NETWORK::NETWORK_REQUEST_CONTROL_OF_ENTITY(veh);
  56.         WAIT(0);
  57.     }
  58.     VEHICLE::SET_VEHICLE_ENGINE_ON(veh, TRUE, TRUE);
  59.     VEHICLE::SET_VEHICLE_COLOURS(veh, 0, 0);
  60.     VEHICLE::SET_VEHICLE_NUMBER_PLATE_TEXT(veh, "ENT VIP");
  61.  
  62.     PED::SET_PED_INTO_VEHICLE(ped, veh, -1);
  63.  
  64.     for (int i = 1; i <= 8; i++)
  65.     {
  66.         if (!VEHICLE::IS_VEHICLE_SEAT_FREE(veh, i)) continue;
  67.         AI::TASK_WARP_PED_INTO_VEHICLE(PLAYER::PLAYER_PED_ID(), veh, i); break;
  68.     }
  69.  
  70.     //AI::TASK_VEHICLE_MISSION_COORS_TARGET(ped, veh, coords.x, coords.y, coords.z, 4, 7.0f, 0xC0027, 5.0f, -1.0f, 1);
  71.     AI::TASK_VEHICLE_DRIVE_TO_COORD(ped, veh, coords.x, coords.y, coords.z, 100, 1, ENTITY::GET_ENTITY_MODEL(veh), 4, 0xC00AB, -1);//DRIVING MODE 4
  72.  
  73.     /* DRIVING MODES :
  74.     0 = Normal behaviour but doesnt recognize other cars on the road, should only be used without pedcars in world.
  75.     1 = Drives legit and does no overtakes.Drives carefully
  76.     2 = Normal behaviour but doesnt recognize other cars on the road, should only be used without pedcars in world.
  77.     3 = Drives legit and does normal overtakes.Ignores traffic lights, and avoids other cars
  78.     4 = Drives legit and does normal overtakes.Ignores traffic lights, and avoids other cars(fast accelerate, chase ? )
  79.     5 = Drives legit and does normal overtakes.Ignores traffic lights, and avoids other cars
  80.     6 = Drives legit and does normal overtakes.Ignores traffic lights, and avoids other cars
  81.     7 = Drives legit and does overtakes depending on speed ? Drives carefully
  82.     8 = Normal behaviour but doesnt recognize other cars on the road, should only be used without pedcars in world.
  83.     9 = Drives legit and does no overtakes.Drives carefully
  84.     10 = Normal behaviour but doesnt recognize other cars on the road, should only be used without pedcars in world.
  85.     */
  86. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement