Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //spawning
- void request_vehicle(std::string modelName, std::string modelTitle)
- {
- uint model = joaat(modelName);
- STREAMING::REQUEST_MODEL(model);
- DWORD now = GetTickCount();
- while (!STREAMING::HAS_MODEL_LOADED(model) && GetTickCount() < now + 5000)
- {
- WAIT(0);
- }
- if (!STREAMING::HAS_MODEL_LOADED(model))
- {
- notifyBottom("Timed out requesting %s : 0x%X", modelTitle.c_str(), model);
- return;
- }
- auto vehicle = do_spawn_vehicle(model, true);
- if (vehicle)
- {
- // Add blip
- //if (featureAddBlipForSpawnedVehicles)
- // add_blip_for_vehicle(vehicle);
- // Add to All Spawned Vehicles list
- SpawnedVehicle* db = new SpawnedVehicle();
- db->hash = model;
- db->name = modelTitle;
- db->vehicle = vehicle;
- spawnedVehicles.push_back(db);
- notifyBottom("Spawned %s : 0x%X", modelTitle.c_str(), model);
- }
- }
- Vehicle do_spawn_vehicle(uint model, bool cleanup)
- {
- auto heading = selfHeading;
- auto coords = selfCoords;
- float forward = 5.f;
- float xVect = forward * sin(degToRad(heading)) * -1.0f;
- float yVect = forward * cos(degToRad(heading));
- BOOL isAircraft = VEHICLE::IS_THIS_MODEL_A_HELI(model) || VEHICLE::IS_THIS_MODEL_A_PLANE(model);
- Vehicle vehicle = NULL;
- if (isAircraft && isVehWrapInSpawned)
- {
- vehicle = VEHICLE::CREATE_VEHICLE(model, coords.x + xVect, coords.y + yVect, coords.z + 1000, heading, TRUE, TRUE);
- VEHICLE::SET_VEHICLE_FORWARD_SPEED(vehicle, 500.0f);
- VEHICLE::SET_HELI_BLADES_FULL_SPEED(vehicle);
- }
- else
- {
- vehicle = VEHICLE::CREATE_VEHICLE(model, coords.x + xVect, coords.y + yVect, coords.z, heading, TRUE, TRUE);
- VEHICLE::SET_VEHICLE_ON_GROUND_PROPERLY(vehicle);
- }
- DECORATOR::DECOR_SET_INT(vehicle, "MPBitset", 0);
- if (isVehSpawnTuned) upgradeVehMaximum(vehicle);
- if (isVehWrapInSpawned) PED::SET_PED_INTO_VEHICLE(selfPed, vehicle, -1);
- return vehicle;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement