Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. Red Dead Redemption 2

      1. PC
      2. Gameplay
      3. Missions
      4. Help & Support
    2. Red Dead Online

      1. Gameplay
      2. Find Lobbies & Outlaws
      3. Help & Support
      4. Frontier Pursuits
    1. Crews & Posses

      1. Recruitment
    2. Events

    1. GTA Online

      1. DLC
      2. Find Lobbies & Players
      3. Guides & Strategies
      4. Vehicles
      5. Content Creator
      6. Help & Support
      7. The Diamond Casino Heist
    2. Grand Theft Auto Series

    3. GTA 6

    4. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    5. GTA IV

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA IV Mods
    6. GTA Chinatown Wars

    7. GTA Vice City Stories

    8. GTA Liberty City Stories

    9. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA SA Mods
    10. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA VC Mods
    11. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA III Mods
    12. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    13. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    3. Featured Mods

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption

    2. Rockstar Games

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Programming
      5. Movies & TV
      6. Music
      7. Sports
      8. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. News

    2. Forum Support

    3. Site Suggestions

Sign in to follow this  
myWay

Car spawning not working...

Recommended Posts

myWay

Hello there,

I'm new to coding and decided to give it a try, but it does not work..

I used Native trainers car spawning function and tried to spawn a single car, but it does not spawn it...

 

Here is the code:

 

if (mod_switch_pressed()){reset_mod_switch();DWORD time = GetTickCount() + 1000;LPCSTR vehicleModels = {"COMET" };DWORD model = GAMEPLAY::GET_HASH_KEY((char *)vehicleModels);STREAMING::REQUEST_MODEL(model);while (!STREAMING::HAS_MODEL_LOADED(model)) WAIT(0);FLOAT lookDir = ENTITY::GET_ENTITY_HEADING(PLAYER::PLAYER_PED_ID());Vector3 coords = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(PLAYER::PLAYER_PED_ID(), 0.0, 5.0, 0.0);VEHICLE::CREATE_VEHICLE(model, coords.x, coords.y, coords.z, lookDir, 1, 0);while (GetTickCount() < time){update_status_text();WAIT(0);}reset_mod_switch();}

 

Share this post


Link to post
Share on other sites
ISOFX

Hello there,

I'm new to coding and decided to give it a try, but it does not work..

I used Native trainers car spawning function and tried to spawn a single car, but it does not spawn it...

 

Here is the code:

 

if (mod_switch_pressed()){reset_mod_switch();DWORD time = GetTickCount() + 1000;LPCSTR vehicleModels = {"COMET" };DWORD model = GAMEPLAY::GET_HASH_KEY((char *)vehicleModels);STREAMING::REQUEST_MODEL(model);while (!STREAMING::HAS_MODEL_LOADED(model)) WAIT(0);FLOAT lookDir = ENTITY::GET_ENTITY_HEADING(PLAYER::PLAYER_PED_ID());Vector3 coords = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(PLAYER::PLAYER_PED_ID(), 0.0, 5.0, 0.0);VEHICLE::CREATE_VEHICLE(model, coords.x, coords.y, coords.z, lookDir, 1, 0);while (GetTickCount() < time){update_status_text();WAIT(0);}reset_mod_switch();}

 

I have some code here for it :

 

if ( IsKeyJustUp ( VK_F12 )) {

Ped playerPed = PLAYER :: PLAYER_PED_ID (); // PED ID retrieve the player

Hash model = GAMEPLAY :: GET_HASH_KEY ( "ENTITYXF" ); // Hash obtaining the model called LAZER

if ( STREAMING :: IS_MODEL_IN_CDIMAGE ( model ) && STREAMING :: IS_MODEL_VALID ( model )) // Check if the model shown in the game and archiving as if the model is valid

{

STREAMING :: REQUEST_MODEL ( model ); // Model applications

while ( ! STREAMING :: HAS_MODEL_LOADED ( model )) // looping until the model loaded

 

 

VEHICLE :: SET_VEHICLE_ON_GROUND_PROPERLY ( spawnedVehicle ); // Make sure that the vehicle is on the ground

STREAMING :: SET_MODEL_AS_NO_LONGER_NEEDED ( model ); // Model as no longer necessary to mark

 

notifyAboveMap ( "Entity XF spawned" ) / / My custom Notification Above the map

}

}

 

This is if you press the key "F12" an Entity will spawn beside you. All you need to do is edit the vehicle hash to anything for example "ADDER" and this will spawn an adder beside you.

 

Enjoy!

Share this post


Link to post
Share on other sites
myWay

 

Hello there,

I'm new to coding and decided to give it a try, but it does not work..

I used Native trainers car spawning function and tried to spawn a single car, but it does not spawn it...

 

Here is the code:

 

if (mod_switch_pressed()){reset_mod_switch();DWORD time = GetTickCount() + 1000;LPCSTR vehicleModels = {"COMET" };DWORD model = GAMEPLAY::GET_HASH_KEY((char *)vehicleModels);STREAMING::REQUEST_MODEL(model);while (!STREAMING::HAS_MODEL_LOADED(model)) WAIT(0);FLOAT lookDir = ENTITY::GET_ENTITY_HEADING(PLAYER::PLAYER_PED_ID());Vector3 coords = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(PLAYER::PLAYER_PED_ID(), 0.0, 5.0, 0.0);VEHICLE::CREATE_VEHICLE(model, coords.x, coords.y, coords.z, lookDir, 1, 0);while (GetTickCount() < time){update_status_text();WAIT(0);}reset_mod_switch();}

 

I have some code here for it :

 

if ( IsKeyJustUp ( VK_F12 )) {

Ped playerPed = PLAYER :: PLAYER_PED_ID (); // PED ID retrieve the player

Hash model = GAMEPLAY :: GET_HASH_KEY ( "ENTITYXF" ); // Hash obtaining the model called LAZER

if ( STREAMING :: IS_MODEL_IN_CDIMAGE ( model ) && STREAMING :: IS_MODEL_VALID ( model )) // Check if the model shown in the game and archiving as if the model is valid

{

STREAMING :: REQUEST_MODEL ( model ); // Model applications

while ( ! STREAMING :: HAS_MODEL_LOADED ( model )) // looping until the model loaded

 

 

VEHICLE :: SET_VEHICLE_ON_GROUND_PROPERLY ( spawnedVehicle ); // Make sure that the vehicle is on the ground

STREAMING :: SET_MODEL_AS_NO_LONGER_NEEDED ( model ); // Model as no longer necessary to mark

 

notifyAboveMap ( "Entity XF spawned" ) / / My custom Notification Above the map

}

}

 

This is if you press the key "F12" an Entity will spawn beside you. All you need to do is edit the vehicle hash to anything for example "ADDER" and this will spawn an adder beside you.

 

Enjoy!

 

 

So I just replace your code with mine?

Share this post


Link to post
Share on other sites
myWay

I have this code below, but it does not work when I press F9.

 

void Vehicle_Spawn(){while (true){if (IsKeyJustUp(VK_F9)){Ped playerPed = PLAYER::PLAYER_PED_ID(); Hash model = GAMEPLAY::GET_HASH_KEY("LAZER"); if (STREAMING::IS_MODEL_IN_CDIMAGE(model) && STREAMING::IS_MODEL_VALID(model)) {STREAMING::REQUEST_MODEL(model);while (!STREAMING::HAS_MODEL_LOADED(model)) WAIT(0);Vector3 playerOffsetLocation = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(playerPed, 5.0, 0.0, 0.0);Vehicle spawnedVehicle = VEHICLE::CREATE_VEHICLE(model, playerOffsetLocation.x, playerOffsetLocation.y, playerOffsetLocation.z, 0.0, 1, 1); VEHICLE::SET_VEHICLE_ON_GROUND_PROPERLY(spawnedVehicle); STREAMING::SET_MODEL_AS_NO_LONGER_NEEDED(model); }}WAIT(0);}}

Share this post


Link to post
Share on other sites
ISOFX

 

I have this code below, but it does not work when I press F9.

 

void Vehicle_Spawn(){while (true){if (IsKeyJustUp(VK_F9)){Ped playerPed = PLAYER::PLAYER_PED_ID(); Hash model = GAMEPLAY::GET_HASH_KEY("LAZER"); if (STREAMING::IS_MODEL_IN_CDIMAGE(model) && STREAMING::IS_MODEL_VALID(model)) {STREAMING::REQUEST_MODEL(model);while (!STREAMING::HAS_MODEL_LOADED(model)) WAIT(0);Vector3 playerOffsetLocation = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(playerPed, 5.0, 0.0, 0.0);Vehicle spawnedVehicle = VEHICLE::CREATE_VEHICLE(model, playerOffsetLocation.x, playerOffsetLocation.y, playerOffsetLocation.z, 0.0, 1, 1); VEHICLE::SET_VEHICLE_ON_GROUND_PROPERLY(spawnedVehicle); STREAMING::SET_MODEL_AS_NO_LONGER_NEEDED(model); }}WAIT(0);}}

 

F9? The code says F12 Try pressing that.

Share this post


Link to post
Share on other sites
CamxxCore

I have this code below, but it does not work when I press F9.

 

 

 

void Vehicle_Spawn(){while (true){if (IsKeyJustUp(VK_F9)){Ped playerPed = PLAYER::PLAYER_PED_ID(); Hash model = GAMEPLAY::GET_HASH_KEY("LAZER"); if (STREAMING::IS_MODEL_IN_CDIMAGE(model) && STREAMING::IS_MODEL_VALID(model)) {STREAMING::REQUEST_MODEL(model);while (!STREAMING::HAS_MODEL_LOADED(model)) WAIT(0);Vector3 playerOffsetLocation = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(playerPed, 5.0, 0.0, 0.0);Vehicle spawnedVehicle = VEHICLE::CREATE_VEHICLE(model, playerOffsetLocation.x, playerOffsetLocation.y, playerOffsetLocation.z, 0.0, 1, 1); VEHICLE::SET_VEHICLE_ON_GROUND_PROPERLY(spawnedVehicle); STREAMING::SET_MODEL_AS_NO_LONGER_NEEDED(model); }}WAIT(0);}}
Pretty sure you can't spawn a lazer without a freeze bypass. You have to physically edit the game's memory. Try with a regular vehicle and see what happens. (Don't hold me to that. But I wasn't able to spawn a lazer without doing so) Edited by CamxxCore

Share this post


Link to post
Share on other sites
myWay

 

 

I have this code below, but it does not work when I press F9.

 

void Vehicle_Spawn(){while (true){if (IsKeyJustUp(VK_F9)){Ped playerPed = PLAYER::PLAYER_PED_ID(); Hash model = GAMEPLAY::GET_HASH_KEY("LAZER"); if (STREAMING::IS_MODEL_IN_CDIMAGE(model) && STREAMING::IS_MODEL_VALID(model)) {STREAMING::REQUEST_MODEL(model);while (!STREAMING::HAS_MODEL_LOADED(model)) WAIT(0);Vector3 playerOffsetLocation = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(playerPed, 5.0, 0.0, 0.0);Vehicle spawnedVehicle = VEHICLE::CREATE_VEHICLE(model, playerOffsetLocation.x, playerOffsetLocation.y, playerOffsetLocation.z, 0.0, 1, 1); VEHICLE::SET_VEHICLE_ON_GROUND_PROPERLY(spawnedVehicle); STREAMING::SET_MODEL_AS_NO_LONGER_NEEDED(model); }}WAIT(0);}}

 

F9? The code says F12 Try pressing that.

 

I changed the key to F9

 if (IsKeyJustUp(VK_F9)){

Could someone please help with this?

Share this post


Link to post
Share on other sites
myWay

 

I have this code below, but it does not work when I press F9.

 

 

void Vehicle_Spawn(){while (true){if (IsKeyJustUp(VK_F9)){Ped playerPed = PLAYER::PLAYER_PED_ID(); Hash model = GAMEPLAY::GET_HASH_KEY("LAZER"); if (STREAMING::IS_MODEL_IN_CDIMAGE(model) && STREAMING::IS_MODEL_VALID(model)) {STREAMING::REQUEST_MODEL(model);while (!STREAMING::HAS_MODEL_LOADED(model)) WAIT(0);Vector3 playerOffsetLocation = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(playerPed, 5.0, 0.0, 0.0);Vehicle spawnedVehicle = VEHICLE::CREATE_VEHICLE(model, playerOffsetLocation.x, playerOffsetLocation.y, playerOffsetLocation.z, 0.0, 1, 1); VEHICLE::SET_VEHICLE_ON_GROUND_PROPERLY(spawnedVehicle); STREAMING::SET_MODEL_AS_NO_LONGER_NEEDED(model); }}WAIT(0);}}
Pretty sure you can't spawn a lazer without a freeze bypass. You have to physically edit the game's memory. Try with a regular vehicle and see what happens. (Don't hold me to that. But I wasn't able to spawn a lazer without doing so)

 

Tried using ADDER, but still does not work! :/

Share this post


Link to post
Share on other sites
CamxxCore

 

 

I have this code below, but it does not work when I press F9.

 

 

 

void Vehicle_Spawn(){while (true){if (IsKeyJustUp(VK_F9)){Ped playerPed = PLAYER::PLAYER_PED_ID(); Hash model = GAMEPLAY::GET_HASH_KEY("LAZER"); if (STREAMING::IS_MODEL_IN_CDIMAGE(model) && STREAMING::IS_MODEL_VALID(model)) {STREAMING::REQUEST_MODEL(model);while (!STREAMING::HAS_MODEL_LOADED(model)) WAIT(0);Vector3 playerOffsetLocation = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(playerPed, 5.0, 0.0, 0.0);Vehicle spawnedVehicle = VEHICLE::CREATE_VEHICLE(model, playerOffsetLocation.x, playerOffsetLocation.y, playerOffsetLocation.z, 0.0, 1, 1); VEHICLE::SET_VEHICLE_ON_GROUND_PROPERLY(spawnedVehicle); STREAMING::SET_MODEL_AS_NO_LONGER_NEEDED(model); }}WAIT(0);}}
Pretty sure you can't spawn a lazer without a freeze bypass. You have to physically edit the game's memory. Try with a regular vehicle and see what happens. (Don't hold me to that. But I wasn't able to spawn a lazer without doing so)

 

Tried using ADDER, but still does not work! :/

Well you are actually calling the vehiclespawn method somewhere right?

Share this post


Link to post
Share on other sites
myWay

In the void ScriptMain().

I did try putting if (IsKeyJustUp(VK_F9)) inside the void main() , but still it does not work.. :/

Share this post


Link to post
Share on other sites
myWay

Anyone could help me out?

Share this post


Link to post
Share on other sites
myWay

 

Anyone could help me out?

You need to edit your nativeCaller.h file. download this and put it in and tell me if it works. - https://www.dropbox.com/s/lv5i6r9pqx6vpwo/nativeCaller.h?dl=0

 

Did update, but still no luck! :/

Code below does not work either.

void main(){while (true){  if (IsKeyJustUp(VK_F9)){notifyAboveMap("Can you see this?");  }  WAIT(0);}}

Share this post


Link to post
Share on other sites
outlier

Here are some functions I pulled from my vehicle class. I don't play online so I'm not sure if it works there. In SP, I have not had any trouble spawning any vehicle (lazer, hydra, etc...). You may need to change some native defs in natives.h as well - if you get any compiler errors like can't convert char * to Any etc...

//function prototypes - place in script.hvoid max_vehicle_mods(Vehicle veh);char* get_user_input(char *def, int len);char* spawn_vehicle(bool warp);//functions - place in script.cppvoid max_vehicle_mods(Vehicle veh){    VEHICLE::SET_VEHICLE_MOD_KIT(veh, 0);    VEHICLE::SET_VEHICLE_MOD(veh, 11, VEHICLE::GET_NUM_VEHICLE_MODS(veh, 11) - 1, 1); //Engine    VEHICLE::SET_VEHICLE_MOD(veh, 12, VEHICLE::GET_NUM_VEHICLE_MODS(veh, 12) - 1, 1); //Brakes    VEHICLE::SET_VEHICLE_MOD(veh, 13, VEHICLE::GET_NUM_VEHICLE_MODS(veh, 13) - 1, 1); //Transmission    VEHICLE::SET_VEHICLE_MOD(veh, 16, VEHICLE::GET_NUM_VEHICLE_MODS(veh, 16) - 1, 1); //Armor    VEHICLE::SET_VEHICLE_MOD(veh, 15, VEHICLE::GET_NUM_VEHICLE_MODS(veh, 15) - 1, 1); //Suspension    VEHICLE::SET_VEHICLE_MOD(veh, 0, VEHICLE::GET_NUM_VEHICLE_MODS(veh, 0) - 1, 1); //Spoiler    VEHICLE::SET_VEHICLE_MOD(veh, 4, VEHICLE::GET_NUM_VEHICLE_MODS(veh, 4) - 1, 1); //Exhaust    VEHICLE::SET_VEHICLE_MOD(veh, 7, VEHICLE::GET_NUM_VEHICLE_MODS(veh, 7) - 1, 1); //Hood    VEHICLE::SET_VEHICLE_MOD(veh, 1, VEHICLE::GET_NUM_VEHICLE_MODS(veh, 1) - 1, 1); //Front Bumper    VEHICLE::SET_VEHICLE_MOD(veh, 2, VEHICLE::GET_NUM_VEHICLE_MODS(veh, 2) - 1, 1); //Rear Bumper    VEHICLE::SET_VEHICLE_MOD(veh, 6, VEHICLE::GET_NUM_VEHICLE_MODS(veh, 6) - 1, 1); //Grille    VEHICLE::SET_VEHICLE_MOD(veh, 3, VEHICLE::GET_NUM_VEHICLE_MODS(veh, 3) - 1, 1); //Skirts    VEHICLE::SET_VEHICLE_MOD(veh, 10, VEHICLE::GET_NUM_VEHICLE_MODS(veh, 10) - 1, 1); //Roof    VEHICLE::SET_VEHICLE_MOD(veh, 8, VEHICLE::GET_NUM_VEHICLE_MODS(veh, 8) - 1, 1); //Fenders    VEHICLE::SET_VEHICLE_MOD(veh, 5, VEHICLE::GET_NUM_VEHICLE_MODS(veh, 5) - 1, 1); //Rollcage    VEHICLE::SET_VEHICLE_WINDOW_TINT(veh, 1); //tint    VEHICLE::SET_VEHICLE_TYRES_CAN_BURST(veh, 0); //Bulletproof Tires    VEHICLE::SET_VEHICLE_MOD(veh, 23, 1, 1); //Custom Tires    VEHICLE::SET_VEHICLE_MOD(veh, 24, 1, 1); //Custom Tires (bike rear wheels)    VEHICLE::TOGGLE_VEHICLE_MOD(veh, 18, 1); //Turbo    VEHICLE::TOGGLE_VEHICLE_MOD(veh, 22, 1); //Neon headlights}char* get_user_input(char *def, int len){    GAMEPLAY::DISPLAY_ONSCREEN_KEYBOARD(true, "", "", def, "", "", "", len+1); //seems to want length + 1    while (GAMEPLAY::UPDATE_ONSCREEN_KEYBOARD() == 0) WAIT(0);    return GAMEPLAY::GET_ONSCREEN_KEYBOARD_RESULT();}char* spawn_vehicle(bool warp){    char *modelName = get_user_input("ENTITYXF", 32);    if (!modelName) return NULL;        DWORD model = GAMEPLAY::GET_HASH_KEY(modelName);    if (STREAMING::IS_MODEL_IN_CDIMAGE(model) && STREAMING::IS_MODEL_A_VEHICLE(model))    {        STREAMING::REQUEST_MODEL(model);                        while (!STREAMING::HAS_MODEL_LOADED(model)) WAIT(0);                Vector3 coords = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(PLAYER::PLAYER_PED_ID(), 0.0, 5.0, 0.0);        Vehicle veh = VEHICLE::CREATE_VEHICLE(model, coords.x, coords.y, coords.z, 0.0, 1, 1);        VEHICLE::SET_VEHICLE_ON_GROUND_PROPERLY(veh);                //max out mods        max_vehicle_mods(veh);                //number plate text - 8 chars max        std::string tmp(modelName);        VEHICLE::SET_VEHICLE_NUMBER_PLATE_TEXT(veh, (char *)tmp.substr(0, 8).c_str());        //warp in spawned vehicle        if (warp)        {            ENTITY::SET_ENTITY_HEADING(veh, ENTITY::GET_ENTITY_HEADING(PLAYER::PLAYER_PED_ID()));            PED::SET_PED_INTO_VEHICLE(PLAYER::PLAYER_PED_ID(), veh, -1);        }        WAIT(0);        STREAMING::SET_MODEL_AS_NO_LONGER_NEEDED(model);        ENTITY::SET_VEHICLE_AS_NO_LONGER_NEEDED(&veh);        return modelName;    }    return NULL;}//example mainvoid main(){        reset_globals();    while (true)    {        if (trainer_switch_pressed())        {            menu_beep();            process_main_menu();        }        if (IsKeyJustUp(VK_F9))        {            char *veh = spawn_vehicle(true);            //char *veh = spawn_vehicle(featureVehWrapInSpawned); //if using AB's trainer                        if (veh)            {                char msg[64] = {0};                sprintf(msg, "%s spawned!", veh);                set_status_text(msg);            }        }        update_features();        WAIT(0);    }}
Edited by outlier

Share this post


Link to post
Share on other sites
myWay

 

Here are some functions I pulled from my vehicle class. I don't play online so I'm not sure if it works there. In SP, I have not had any trouble spawning any vehicle (lazer, hydra, etc...). You may need to change some native defs in natives.h as well - if you get any compiler errors like can't convert char * to Any etc...

//function prototypes - place in script.hvoid max_vehicle_mods(Vehicle veh);char* get_user_input(char *def, int len);char* spawn_vehicle(bool warp);//functions - place in script.cppvoid max_vehicle_mods(Vehicle veh){    VEHICLE::SET_VEHICLE_MOD_KIT(veh, 0);    VEHICLE::SET_VEHICLE_MOD(veh, 11, VEHICLE::GET_NUM_VEHICLE_MODS(veh, 11) - 1, 1); //Engine    VEHICLE::SET_VEHICLE_MOD(veh, 12, VEHICLE::GET_NUM_VEHICLE_MODS(veh, 12) - 1, 1); //Brakes    VEHICLE::SET_VEHICLE_MOD(veh, 13, VEHICLE::GET_NUM_VEHICLE_MODS(veh, 13) - 1, 1); //Transmission    VEHICLE::SET_VEHICLE_MOD(veh, 16, VEHICLE::GET_NUM_VEHICLE_MODS(veh, 16) - 1, 1); //Armor    VEHICLE::SET_VEHICLE_MOD(veh, 15, VEHICLE::GET_NUM_VEHICLE_MODS(veh, 15) - 1, 1); //Suspension    VEHICLE::SET_VEHICLE_MOD(veh, 0, VEHICLE::GET_NUM_VEHICLE_MODS(veh, 0) - 1, 1); //Spoiler    VEHICLE::SET_VEHICLE_MOD(veh, 4, VEHICLE::GET_NUM_VEHICLE_MODS(veh, 4) - 1, 1); //Exhaust    VEHICLE::SET_VEHICLE_MOD(veh, 7, VEHICLE::GET_NUM_VEHICLE_MODS(veh, 7) - 1, 1); //Hood    VEHICLE::SET_VEHICLE_MOD(veh, 1, VEHICLE::GET_NUM_VEHICLE_MODS(veh, 1) - 1, 1); //Front Bumper    VEHICLE::SET_VEHICLE_MOD(veh, 2, VEHICLE::GET_NUM_VEHICLE_MODS(veh, 2) - 1, 1); //Rear Bumper    VEHICLE::SET_VEHICLE_MOD(veh, 6, VEHICLE::GET_NUM_VEHICLE_MODS(veh, 6) - 1, 1); //Grille    VEHICLE::SET_VEHICLE_MOD(veh, 3, VEHICLE::GET_NUM_VEHICLE_MODS(veh, 3) - 1, 1); //Skirts    VEHICLE::SET_VEHICLE_MOD(veh, 10, VEHICLE::GET_NUM_VEHICLE_MODS(veh, 10) - 1, 1); //Roof    VEHICLE::SET_VEHICLE_MOD(veh, 8, VEHICLE::GET_NUM_VEHICLE_MODS(veh, 8) - 1, 1); //Fenders    VEHICLE::SET_VEHICLE_MOD(veh, 5, VEHICLE::GET_NUM_VEHICLE_MODS(veh, 5) - 1, 1); //Rollcage    VEHICLE::SET_VEHICLE_WINDOW_TINT(veh, 1); //tint    VEHICLE::SET_VEHICLE_TYRES_CAN_BURST(veh, 0); //Bulletproof Tires    VEHICLE::SET_VEHICLE_MOD(veh, 23, 1, 1); //Custom Tires    VEHICLE::SET_VEHICLE_MOD(veh, 24, 1, 1); //Custom Tires (bike rear wheels)    VEHICLE::TOGGLE_VEHICLE_MOD(veh, 18, 1); //Turbo    VEHICLE::TOGGLE_VEHICLE_MOD(veh, 22, 1); //Neon headlights}char* get_user_input(char *def, int len){    GAMEPLAY::DISPLAY_ONSCREEN_KEYBOARD(true, "", "", def, "", "", "", len+1); //seems to want length + 1    while (GAMEPLAY::UPDATE_ONSCREEN_KEYBOARD() == 0) WAIT(0);    return GAMEPLAY::GET_ONSCREEN_KEYBOARD_RESULT();}char* spawn_vehicle(bool warp){    char *modelName = get_user_input("ENTITYXF", 32);    if (!modelName) return NULL;        DWORD model = GAMEPLAY::GET_HASH_KEY(modelName);    if (STREAMING::IS_MODEL_IN_CDIMAGE(model) && STREAMING::IS_MODEL_A_VEHICLE(model))    {        STREAMING::REQUEST_MODEL(model);                        while (!STREAMING::HAS_MODEL_LOADED(model)) WAIT(0);                Vector3 coords = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(PLAYER::PLAYER_PED_ID(), 0.0, 5.0, 0.0);        Vehicle veh = VEHICLE::CREATE_VEHICLE(model, coords.x, coords.y, coords.z, 0.0, 1, 1);        VEHICLE::SET_VEHICLE_ON_GROUND_PROPERLY(veh);                //max out mods        max_vehicle_mods(veh);                //number plate text - 8 chars max        std::string tmp(modelName);        VEHICLE::SET_VEHICLE_NUMBER_PLATE_TEXT(veh, (char *)tmp.substr(0, 8).c_str());        //warp in spawned vehicle        if (warp)        {            ENTITY::SET_ENTITY_HEADING(veh, ENTITY::GET_ENTITY_HEADING(PLAYER::PLAYER_PED_ID()));            PED::SET_PED_INTO_VEHICLE(PLAYER::PLAYER_PED_ID(), veh, -1);        }        WAIT(0);        STREAMING::SET_MODEL_AS_NO_LONGER_NEEDED(model);        ENTITY::SET_VEHICLE_AS_NO_LONGER_NEEDED(&veh);        return modelName;    }    return NULL;}//example mainvoid main(){        reset_globals();    while (true)    {        if (trainer_switch_pressed())        {            menu_beep();            process_main_menu();        }        if (IsKeyJustUp(VK_F9))        {            char *veh = spawn_vehicle(true);            //char *veh = spawn_vehicle(featureVehWrapInSpawned); //if using AB's trainer                        if (veh)            {                char msg[64] = {0};                sprintf(msg, "%s spawned!", veh);                set_status_text(msg);            }        }        update_features();        WAIT(0);    }}

Thanks, but it does not work. There were no errors when building, but if I press F9 nothing happens.

I have tried to show text when press F9, but that does not work either. It's really frustrating.

Share this post


Link to post
Share on other sites
ISOFX

You can use my old code for testing if you want mine works if u press 0,1,7,4,3,6,or 9 on the numpad but u can easily change it (This is my full source with everything in it)

 

My whole source - https://www.dropbox.com/s/exwblar884rtkpy/Repack%20%5BWORKING%5D.rar?dl=0

Its named as "Native Trainer" because i used that but its actually the car spawner.

 

Edit: These are the old natives but you can update them at NativeDB but just use the ones i gave you because i cant remember what i edited on it but you can copy them over to the new natives.h file.

 

Latest Natives on NativeDB - http://www.dev-c.com/nativedb/

Edited by ISOFX

Share this post


Link to post
Share on other sites
myWay

You can use my old code for testing if you want mine works if u press 0,1,7,4,3,6,or 9 on the numpad but u can easily change it (This is my full source with everything in it)

 

My whole source - https://www.dropbox.com/s/exwblar884rtkpy/Repack%20%5BWORKING%5D.rar?dl=0

Its named as "Native Trainer" because i used that but its actually the car spawner.

 

Edit: These are the old natives but you can update them at NativeDB but just use the ones i gave you because i cant remember what i edited on it but you can copy them over to the new natives.h file.

 

Latest Natives on NativeDB - http://www.dev-c.com/nativedb/

 

Huge thanks dude!! It worked. I will try to figure out why my version does not work!! Thanks!!! :):)

Share this post


Link to post
Share on other sites
ISOFX

 

You can use my old code for testing if you want mine works if u press 0,1,7,4,3,6,or 9 on the numpad but u can easily change it (This is my full source with everything in it)

 

My whole source - https://www.dropbox.com/s/exwblar884rtkpy/Repack%20%5BWORKING%5D.rar?dl=0

Its named as "Native Trainer" because i used that but its actually the car spawner.

 

Edit: These are the old natives but you can update them at NativeDB but just use the ones i gave you because i cant remember what i edited on it but you can copy them over to the new natives.h file.

 

Latest Natives on NativeDB - http://www.dev-c.com/nativedb/

 

Huge thanks dude!! It worked. I will try to figure out why my version does not work!! Thanks!!! :):)

 

Just go through mine and your files and see what i have and u dont & no problem :)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.