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

    1. GTANet.com

    1. GTA Online

      1. The Diamond Casino Heist
      2. Find Lobbies & Players
      3. Guides & Strategies
      4. Vehicles
      5. Content Creator
      6. Help & Support
    2. Red Dead Online

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

    1. Red Dead Redemption 2

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

    1. Grand Theft Auto Series

    2. GTA 6

      1. St Andrews Cathedral
    3. GTA V

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

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA Chinatown Wars

    6. GTA Vice City Stories

    7. GTA Liberty City Stories

    8. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
    9. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
    10. GTA III

      1. Guides & Strategies
      2. Help & Support
    11. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

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

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

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

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

    1. Announcements

    2. Support

    3. Suggestions

Sign in to follow this  
tysman

Need help with Vehicle spawn

Recommended Posts

tysman

Hello I am spawning a Maverick helicopter on top of CJ's garage door and i want the garage door to remain closed when i am walking up the stairs to the top of the garage.

 

Full script

 

// This file was decompiled using sascm.ini published by Seemann (http://sannybuilder.com/files/SASCM.rar) on 13.10.2007{$VERSION 3.1.0027}{$CLEO .cs}//-------------MAIN---------------thread "MAV"wait [email protected] = 16.1466:MAV_11wait 0 if  Player.Defined($PLAYER_CHAR)jf @MAV_11Model.Load(#MAVERICK):MAV_36wait 0 if and  Model.Available(#MAVERICK)jf @MAV_3609E2: $10978 = parked_car_generator_w_numberplate #MAVERICK -1 3 1 alarm 0 door_lock 0 0 10000 plate "_GROVE__" at 2506.349 -1696.324 17.59747 angle 90.0 014C: set_parked_car_generator $10978 cars_to_generate_to 101:MAV_56wait 0if0819: [email protected] = actor $PLAYER_ACTOR distance_from_groundjf @MAV_5603B1:   garage 'cjgaragedoor' door_closedreturn

 

Share this post


Link to post
Share on other sites
Bad.boy!

There are some mistakes in your script:

 

You have to use "if" instead of "if and"

 

:MAV_36wait 0if Model.Available(#MAVERICK)jf @MAV_36

 

 

You shouldn't use globals here use locals instead, and choppers haven't got number plates, use 014B instead.

 

014B: [email protected] = init_parked_car_generator #MAVERICK color -1 -1 1 alarm 0 door_lock 0 0 10000 at 2506.349 -1696.324 17.59747 angle 90.0 

 

 

When between if statement you have to use ==

 

:MAV_56wait 0if0819: [email protected] == actor $PLAYER_ACTOR distance_from_groundjf @MAV_56

 

 

03B1 is used wrong, use 0361 instead.

 

0361: close_garage 'cjgaragedoor' 

 

Edited by Bad.boy!

Share this post


Link to post
Share on other sites
tysman

ok i did the changes and the door still opens, is there a way where if he is above ground the door will remain closed always?

Share this post


Link to post
Share on other sites
Deji

 

:MAV_56wait 0if0819: [email protected] == actor $PLAYER_ACTOR distance_from_groundjf @MAV_56

 

 

0819 is not a conditional opcode. Also, you don't even have to load the models for a car generator (you're not creating something, you're creating something that will create something tounge.gif). And "return" is a bad way to attempt to end a script.

 

I'm so generous nowadays...

 

{$CLEO .cs}//thread "MAV" // you really dont need this :)0A95: enable_thread_saving      // SHOULD stop the script running multiple times and creating LOADS of cargens.                               // I'm not sure if CLEO still considers this after 0A93 is used, though. So perhaps you could                               // just end the code with an infinite loop with a long weight... pun intended?014B: [email protected] = init_car_generator #MAVERICK color -1 3 force_spawn 1 alarm 0 door_lock 0 min_delay 0 max_delay 10000 at 2506.349 -1696.324 17.59747 angle 90.0014C: set_parked_car_generator [email protected] cars_to_generate_to 1010A93: end_custom_thread

 

 

About the garage thing. I don't know what you want, exactly.. but your code didn't even do anything to the garages. Even I can't convert all frankenstein scripts to work as they appear to be intended to tounge2.gif

Share this post


Link to post
Share on other sites
tysman

i want the garage to remain closed if i am a certain distance off the ground (on top of the garage and walking up the stairs object that i put on the side of the garage to get to the helicopter)

Share this post


Link to post
Share on other sites
tysman

the reson why is that gangster that is wearing stripped Blue shirt always steals my cars when i am on top of the garage, so i want it closed if i am on top of the garage

Share this post


Link to post
Share on other sites
Bad.boy!

I don't know if the coords are correct, but this should work, and why do you stand on top of your garage anyway?

 

 

{$CLEO .cs}thread 'MAV'0A95: enable_thread_saving:MAV_11wait 0if Player.Defined($PLAYER_CHAR)jf @MAV_11Model.Load(#MAVERICK):MAV_36wait 0if Model.Available(#MAVERICK)jf @MAV_36014B: [email protected] = init_parked_car_generator #MAVERICK color -1 -1 1 alarm 0 door_lock 0 0 10000 at 2506.349 -1696.324 17.59747 angle 90.0 014C: set_parked_car_generator [email protected] cars_to_generate_to 101:MAV_56wait 00819: [email protected] = actor $PLAYER_ACTOR [email protected] == 16.1466jf @MAV_5602B9: deactivate_garage 'cjgaragedoor':MAV_57wait 00819: [email protected] = actor $PLAYER_ACTOR [email protected] == 16.1466jf @MAV_58jump @MAV_57:MAV_580299: activate_garage 'cjgaragedoor'jump @MAV_56

 

Share this post


Link to post
Share on other sites
tysman

The door still opens, is there another way for keeping the door closed when going up the stairs and being on top of the garage? without effecting if you where on the ground and the garage will open. Maybe a code for example

 

if CJ on ground open 'cjgaragedoor'

 

and

 

if CJ not on ground keep 'cjgaragedoor' closed

 

Share this post


Link to post
Share on other sites
thelink2012

But the garage roof is considered a ground. (The Helicopter is there yes?)

 

I think that you can do it:

 

If Player ZCoord > CJGarageGround_Z  Do Deactivate_The_Door

 

 

See the CJGarageGround_Z with the Sanny Coord Manager.

Share this post


Link to post
Share on other sites
tysman

OK is that how i should put the code in or is it worded diferently?

Share this post


Link to post
Share on other sites
tysman

OR could i create a sphere and when CJ is in the sphere the garage wont open and then if CJ isn't in the sphere the garage will open?

Share this post


Link to post
Share on other sites
thelink2012

Yes, You can do that.

Share this post


Link to post
Share on other sites
tysman

Is there a sphere i can use that is visible so i can get the size adjusted right?

Edited by tysman

Share this post


Link to post
Share on other sites
tysman

i dont think anything will work cause i am trying to modify what the game is doing by opening the garage door. The only way this would work is if i remove the code from the main.scm that tells the garage door to open if i am a certain distance away from the garage, then maybe my codes will work here is my full code that i have so far:

 

// This file was decompiled using sascm.ini published by Seemann (http://sannybuilder.com/files/SASCM.rar) on 13.10.2007{$VERSION 3.1.0027}{$CLEO .cs}//-------------MAIN---------------thread "MAV":MAV_11wait 0ifPlayer.Defined($PLAYER_CHAR)jf @MAV_11Model.Load(#MAVERICK):MAV_36wait 0ifModel.Available(#MAVERICK)jf @MAV_36014B: [email protected] = init_parked_car_generator #MAVERICK color -1 -1 1 alarm 0 door_lock 0 0 10000 at 2506.349 -1696.324 17.59747 angle 90.0014C: set_parked_car_generator [email protected] cars_to_generate_to 101:MAV_56wait 0if80FE:   not actor $PLAYER_ACTOR sphere 0 in_sphere 2506.349 -1696.324 17.59747 radius 20.0 20.0 20.0 jf @MAV_5602B9: deactivate_garage 'cjgaragedoor':MAV_57wait 0if00FE:   actor $PLAYER_ACTOR sphere 0 in_sphere 2506.0017 -1685.6748 13.5571 radius 40.0 40.0 40.0jf @MAV_58jump @MAV_57:MAV_580299: activate_garage 'cjgaragedoor'jump @MAV_56

 

Share this post


Link to post
Share on other sites
thelink2012

Some corrections:

 

Firstly, repeating Deji corrections:

 

Add enable thread saving to the script, so the car generator will not duplicate:

 

0A95: enable_thread_saving

 

 

You don't need to name the thread in that circustances... You will not access the thread externally and no possibility of a jump to zero offset, since you put some code before the first "jumped offset". So remove the thead name.

 

You don't need to load model in a car generator...

 

You don't need to check if player-defined to create a generator...

 

So...

 

{$CLEO}0A95: enable_thread_saving014B: [email protected] = init_parked_car_generator #MAVERICK color -1 -1 1 alarm 0 door_lock 0 mind 0 maxd 10000 at 2506.349 -1696.324 17.59747 angle 90.0014C: set_parked_car_generator [email protected] cars_to_generate_to 101:MAV_56wait 00256:   player $PLAYER_CHAR defined         // Since we will use player handle below check here thisjf @MAV_56if80FE:   not actor $PLAYER_ACTOR sphere 0 in_sphere 2506.349 -1696.324 17.59747 radius 20.0 20.0 20.0jf @MAV_5602B9: deactivate_garage 'cjgaragedoor'      // Sure that the garage is cjgaragedoor? In IPL that is named CJSAFE:MAV_57wait 0if80FE:   not actor $PLAYER_ACTOR sphere 0 in_sphere 2506.0017 -1685.6748 13.5571 radius 40.0 40.0 40.0jf @MAV_57  // Simple optimization:MAV_580299: activate_garage 'cjgaragedoor'        // Sure that the garage is cjgaragedoor? In IPL that is named CJSAFEjump @MAV_56

 

Share this post


Link to post
Share on other sites
tysman

did the changes still opens when i teleport to that spot

Share this post


Link to post
Share on other sites
thelink2012

Change 'cjgaragedoor' to 'CJSAFE' .-.

Share this post


Link to post
Share on other sites
tysman

I did here is my full code now i am getting somewhere with this code the game crashed when i teleported to the spot:

 

// This file was decompiled using sascm.ini published by Seemann (http://sannybuilder.com/files/SASCM.rar) on 13.10.2007{$VERSION 3.1.0027}{$CLEO .cs}//-------------MAIN---------------thread "MAV":MAV_11wait 0ifPlayer.Defined($PLAYER_CHAR)jf @MAV_11Model.Load(#MAVERICK):MAV_36wait 0ifModel.Available(#MAVERICK)jf @MAV_36014B: [email protected] = init_parked_car_generator #MAVERICK color -1 -1 1 alarm 0 door_lock 0 0 10000 at 2506.349 -1696.324 17.59747 angle 90.0014C: set_parked_car_generator [email protected] cars_to_generate_to 101:MAV_5600FE:   actor $PLAYER_ACTOR sphere 0 in_sphere 2504.894 -1692.6023 17.9575 radius 40.0 40.0 40.0if Garage.IsClosed('CJSAFE')jf @MAV_56Garage.Open('CJSAFE') :MAV_5700FE:   actor $PLAYER_ACTOR sphere 0 in_sphere 2504.894 -1692.6023 17.9575 radius 40.0 40.0 40.0                          if Garage.IsOpen('CJSAFE')jf @MAV_58jump @MAV_57:MAV_58Garage.Close('CJSAFE')jump @MAV_11

 

Share this post


Link to post
Share on other sites
thelink2012

Look, you forget a wait in two loops, and your if statement isn't correct, two comparations = IF AND... and I will not repeat the corrections in my preview post.

 

Replace that part

 

:MAV_56wait 0if and00FE:   actor $PLAYER_ACTOR sphere 0 in_sphere 2504.894 -1692.6023 17.9575 radius 40.0 40.0 40.0Garage.IsClosed('CJSAFE')jf @MAV_56Garage.Open('CJSAFE'):MAV_57wait 0if and00FE:   actor $PLAYER_ACTOR sphere 0 in_sphere 2504.894 -1692.6023 17.9575 radius 40.0 40.0 40.0                          Garage.IsOpen('CJSAFE')jf @MAV_58jump @MAV_57

 

Share this post


Link to post
Share on other sites
tysman

the garage is acting funny it is opening and closing rapidly

Share this post


Link to post
Share on other sites
thelink2012

Working

 

If any radius is bad, change it.

 

{$CLEO}0A95: enable_thread_saving014B: [email protected] = init_parked_car_generator #MAVERICK color -1 -1 1 alarm 0 door_lock 0 mind 0 maxd 10000 at 2506.349 -1696.324 17.59747 angle 90.0014C: set_parked_car_generator [email protected] cars_to_generate_to 101:MAV_56wait 00256:   player $PLAYER_CHAR definedjf @MAV_56if00FE:   actor $PLAYER_ACTOR sphere 0 in_sphere 2505.5327 -1693.0532 17.9575 radius 10.0 10.0 2.0jf @MAV_56if 83B1:   garage 'CJSAFE' door_open         // If the garage is openthen   0361: close_garage 'CJSAFE'                 // Close it before deactivationend02B9: deactivate_garage 'CJSAFE':MAV_57wait 0if80FE:   not actor $PLAYER_ACTOR sphere 0 in_sphere 2505.5327 -1693.0532 17.9575 radius 10.0 10.0 2.0jf @MAV_57:MAV_580299: activate_garage 'CJSAFE'jump @MAV_56

 

Edited by Link2012

Share this post


Link to post
Share on other sites
tysman

sweet thanks very much man it works perfectly smile.gif have some cookie.gifcookie.gifcookie.gifcookie.gif

Share this post


Link to post
Share on other sites
Deji

I think Link2012 meant to post:

 

:MAV_56wait 0if and00FE:   actor $PLAYER_ACTOR sphere 0 in_sphere 2504.894 -1692.6023 17.9575 radius 40.0 40.0 40.0Garage.IsClosed('CJSAFE')jf @MAV_56Garage.Open('CJSAFE'):MAV_57wait 0if and80FE:   not actor $PLAYER_ACTOR sphere 0 in_sphere 2504.894 -1692.6023 17.9575 radius 42.0 42.0 42.0                          Garage.IsOpen('CJSAFE')jf @MAV_58jump @MAV_57

 

 

EDIT

 

Woah, there goes tabbed browsing keeping me behind again tounge.gif

Share this post


Link to post
Share on other sites
tysman

Thnks Deji it works fine but i noticed if i drive far away and come back it has spawned another helicopter (difrent colour)

Share this post


Link to post
Share on other sites
thelink2012

If you want any expecific color to the helicopter set the color arguments:

014B: [email protected] = init_parked_car_generator #MAVERICK color -1 -1 1 alarm 0 door_lock 0 mind 0 maxd 10000 at 2506.349 -1696.324 17.59747

 

The first -1 is the primary color, and the second the secondary color.

Colors: http://wiki.sa-mp.com/wiki/Color_ID

 

Share this post


Link to post
Share on other sites
tysman

OK thanks i just don't wanting it to spawn another helicopter until i drive (fly) one away from the garage

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.

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.