Advertisement
Tustin

GTA V Spawn vehicle

May 8th, 2015
720
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1.     void SpawnVehicle(Hash hash)
  2.     {
  3.         if (IS_MODEL_IN_CDIMAGE(hash))
  4.         {
  5.             REQUEST_MODEL(hash);
  6.             while (!HAS_MODEL_LOADED(hash)) WAIT(0);
  7.             /* gets coordinates + 2 on y axis from you */
  8.             Vector3 pos = GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(PLAYER_PED_ID(), 0, 2.0, 0);
  9.             Vehicle veh = CREATE_VEHICLE(hash, pos.x, pos.y, pos.z, GET_ENTITY_HEADING(PLAYER_PED_ID()), 0, 1);
  10.             SET_MODEL_AS_NO_LONGER_NEEDED(hash);
  11.             PrintMessage("Spawned vehicle");
  12.         }
  13.         else
  14.             PrintMessage("Vehicle doesn't exist");
  15.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement