CabConModding
Facebook
Twitter
youtube
Discord
Contact us
RSS
Menu
CabConModding
Home
New
Top
Premium
Rules
FAQ - Frequently Asked Questions
Games
Fornite
Call of Duty: Black Ops 3
Clash of Clans
Grand Theft Auto 5
Apex Legends
Assassin’s Creed Origins
Forums
Premium
Latest posts
What's new
Latest posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Log in
Register
What's new
Premium
Latest posts
Menu
Log in
Register
Navigation
Install the app
Install
More options
Dark Theme
Contact us
Close Menu
Forums
Gaming
Grand Theft Auto 5
Grand Theft Auto 5 PS3
Help Spawning Vehicles
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="ryan" data-source="post: 31524" data-attributes="member: 2400"><p>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 <img src="/styles/default/xenforo/smilies.emoji/people/slight_smile.emoji.svg" class="smilie" loading="lazy" alt=":smile:" title="Smile :smile:" data-shortname=":smile:" /> (BTW some of it is C&P because i am new but i am trying to learn).</p><p></p><p>Spawn The Vehicles:[ICODE]</p><p>bool* spawn_vehicle(int _do, char* name) {</p><p> static bool value;</p><p> static char* _name;</p><p> if (name != 0) _name = name;</p><p></p><p> if (!value) return &value;</p><p> switch (_do) {</p><p> case -1: {</p><p> sprintf("Spawned ~b~%s", _name);</p><p> break;</p><p> }</p><p> case 1: {</p><p> int hash = SPAWNER::GET_HASH_KEY(_name);</p><p> Vector3 origin;</p><p> if (SPAWNER::IS_MODEL_IN_CDIMAGE(hash) && SPAWNER::IS_MODEL_VALID(hash)) {</p><p> SPAWNER::REQUEST_MODEL(hash);</p><p> if (SPAWNER::HAS_MODEL_LOADED(hash)) {</p><p> int ped_id = PLAYER::PLAYER_PED_ID();</p><p> int old_vehicle = SPAWNER::GET_VEHICLE_PED_IS_USING(ped_id);</p><p> float speed = SPAWNER::GET_ENTITY_SPEED(old_vehicle);</p><p> if (old_vehicle) SPAWNER::DELETE_VEHICLE(&old_vehicle);</p><p> origin = SPAWNER::GET_ENTITY_COORDS(ped_id, true);</p><p> int new_vehicle = SPAWNER::CREATE_VEHICLE(hash, origin.x, origin.y, origin.z, 0, 1, 0);</p><p> if (new_vehicle) {</p><p> SPAWNER::SET_ENTITY_HEADING(new_vehicle, SPAWNER::GET_ENTITY_HEADING(ped_id));</p><p> SPAWNER::SET_PED_INTO_VEHICLE(ped_id, new_vehicle, -1);</p><p> SPAWNER::SET_VEHICLE_ENGINE_ON(new_vehicle, 1, 0);</p><p> SPAWNER::SET_VEHICLE_FORWARD_SPEED(new_vehicle, speed);</p><p> value = 0;</p><p> }</p><p> }</p><p> }</p><p> else value = 0;</p><p> break;</p><p> }</p><p> }</p><p> return &value;</p><p>}</p><p>[/ICODE]</p><p>AddVehOption[ICODE]</p><p>void addVehOption(char *option, char *model, char* notifcation, char *info = NULL)</p><p>{</p><p> addOption(option, info);</p><p> if (currentOption == optionCount && optionPress)</p><p> {</p><p> hash_veh = GAMEPLAY::GET_HASH_KEY(model);</p><p> spawn_vehicle(true, model);</p><p> drawNotification(notifcation);</p><p> }</p><p>}[/ICODE]</p></blockquote><p></p>
[QUOTE="ryan, post: 31524, member: 2400"] 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:[ICODE] 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; } [/ICODE] AddVehOption[ICODE] 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); } }[/ICODE] [/QUOTE]
Verification
Post reply
Forums
Gaming
Grand Theft Auto 5
Grand Theft Auto 5 PS3
Help Spawning Vehicles
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
Accept
Learn more…
Top