ryan
Veteran
- Messages
- 12
- Reaction score
- 4
- Points
- 793
I have been trying to figure out how to fix it so my vehicles can spawn. The notifications pop up but the vehicles do not spawn. I cam up with addVehOption because there where not enough arg in the normal addoptions. If someone can tell me what im doing wrong then that would be great thanks (BTW some of it is C&P because i am new but i am trying to learn).
Spawn The Vehicles:
AddVehOption
Spawn The Vehicles:
bool* spawn_vehicle(int _do, char* name) {
static bool value;
static char* _name;
if (name != 0) _name = name;
if (!value) return &value;
switch (_do) {
case -1: {
sprintf("Spawned ~b~%s", _name);
break;
}
case 1: {
int hash = SPAWNER::GET_HASH_KEY(_name);
Vector3 origin;
if (SPAWNER::IS_MODEL_IN_CDIMAGE(hash) && SPAWNER::IS_MODEL_VALID(hash)) {
SPAWNER::REQUEST_MODEL(hash);
if (SPAWNER::HAS_MODEL_LOADED(hash)) {
int ped_id = PLAYER::PLAYER_PED_ID();
int old_vehicle = SPAWNER::GET_VEHICLE_PED_IS_USING(ped_id);
float speed = SPAWNER::GET_ENTITY_SPEED(old_vehicle);
if (old_vehicle) SPAWNER::DELETE_VEHICLE(&old_vehicle);
origin = SPAWNER::GET_ENTITY_COORDS(ped_id, true);
int new_vehicle = SPAWNER::CREATE_VEHICLE(hash, origin.x, origin.y, origin.z, 0, 1, 0);
if (new_vehicle) {
SPAWNER::SET_ENTITY_HEADING(new_vehicle, SPAWNER::GET_ENTITY_HEADING(ped_id));
SPAWNER::SET_PED_INTO_VEHICLE(ped_id, new_vehicle, -1);
SPAWNER::SET_VEHICLE_ENGINE_ON(new_vehicle, 1, 0);
SPAWNER::SET_VEHICLE_FORWARD_SPEED(new_vehicle, speed);
value = 0;
}
}
}
else value = 0;
break;
}
}
return &value;
}
AddVehOption
void addVehOption(char *option, char *model, char* notifcation, char *info = NULL)
{
addOption(option, info);
if (currentOption == optionCount && optionPress)
{
hash_veh = GAMEPLAY::GET_HASH_KEY(model);
spawn_vehicle(true, model);
drawNotification(notifcation);
}
}