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. Diamond Casino & Resort
      2. DLC
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    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  
barking

Help With cars

Recommended Posts

barking

I tried to create a cleo but every time that there is no any car near me the game crashes

there is any code that will fix it?

btw i am using to find a car with this code

0AB5: store_actor $PLAYER_ACTOR closest_vehicle_to [email protected] closest_ped_to $_UNUSED_RANDOM_ACTOR

Share this post


Link to post
Share on other sites
PatrickW

You're probably always using the car-handle you get back in [email protected] in some car-related opcode after this call.

 

The problem is that when there is no car near you, the content of [email protected] is left untouched with by that opcode.

What you need to do, it assign a specific value to [email protected] before you call that opcode, e.g. -1

and after the opcode, test the value of [email protected], if it still contains -1, he didn't find a car, if it is not -1,

it will contain a valid car-handle and you can safely call a car-related opcode with it.

Share this post


Link to post
Share on other sites
barking

can u give me an example im not so understanding

Share this post


Link to post
Share on other sites
barking

oh and by the way there is any code that if i press a key it will effect not on my car while i am the driver so it will effect the car that near me not on mine?

Share this post


Link to post
Share on other sites
PatrickW

You can use 03co: to get the players car-handle and compare against that one: (untested btw tounge.gif )

 

03C0: [email protected] = actor $PLAYER_ACTOR car [email protected] = -10AB5: store_actor $PLAYER_ACTOR closest_vehicle_to [email protected] closest_ped_to $_UNUSED_RANDOM_ACTORif and NOT [email protected] == -1NOT [email protected] == [email protected]   //do something with [email protected]  e.g.   car.SetToPsychoDriver([email protected])end

 

 

Share this post


Link to post
Share on other sites
barking

well ty its working but while i am in car its not moving the cars near me but if im on foot it is any way to do this

while i am driving?

Share this post


Link to post
Share on other sites
Bennington

PatrickW, I think that won´t work. The player´s car is the nearest car everytime. This script will jump back everytime, it just can´t get any other car... the script is only preventing the effects on the car.

 

Instead of getting the nearest car, I would recommend you using a "sphere" around your car.

 

03C0: [email protected] = actor $PLAYER_ACTOR car 0407: store_coords_to [email protected] [email protected] [email protected] from_car [email protected] with_offset 0.0 0.0 0.0073E: get_car_in_sphere [email protected] [email protected] [email protected] radius 10.0 model -1 handle_as [email protected] andNOT [email protected] == -1NOT [email protected] == [email protected]

 

That script now detects a random car in a space around your car with radius 10.0. It may still get your car, but there´s a chance now that there will be "got" others. You can set the radius you like.

 

BTW, wouldn´t it be easier to check if a car exists with that opcode?!

 

056E:   car [email protected] defined

 

 

03C0: [email protected] = actor $PLAYER_ACTOR car 0407: store_coords_to [email protected] [email protected] [email protected] from_car [email protected] with_offset 0.0 0.0 0.0073E: get_car_in_sphere [email protected] [email protected] [email protected] radius 10.0 model -1 handle_as [email protected] and056E:   car [email protected] definedNOT [email protected] == [email protected]

 

Share this post


Link to post
Share on other sites
TheSiggi

If you use a sphere around the players car, the players car will be in the center of it which brings up the same problem again

 

no, the defined opcodes are weird so checking if its not 0 is the best way. if its undefined its zero.

Share this post


Link to post
Share on other sites
PatrickW

Actually, I think bennington has a very valid point there. It's been a long time since I experimented with the "get random car in sphere" opcodes, but they should be able to pickup other cars that the one the player is in currently, even if the sphere or rectangle is centered around the player.

Share this post


Link to post
Share on other sites
fireguy109

What if you first detected the player's car, gave that a name, used sphere technique, and did something like this (raw idea, not real code)

 

:firstpartplayer_char car == @15gosub @nextpart:nextpart//all that stuff you talked aboutif NOT [email protected]_if_false @firstpart // or "if car is players jump to start"//do whatever

 

Wouldn't that theoretically make sure the player car was unaffected/undetected?

Share this post


Link to post
Share on other sites
barking

oh i wonder if you can help me and ive me the code to not get car with a player??

Share this post


Link to post
Share on other sites
barking

someone please this is importent to me

''oh i wonder if you can help me and ive me the code to not get car with a player??''

Edited by barking

Share this post


Link to post
Share on other sites
Bennington

 

What if you first detected the player's car, gave that a name, used sphere technique, and did something like this (raw idea, not real code)

 

:firstpartplayer_char car == @15gosub @nextpart:nextpart//all that stuff you talked aboutif NOT [email protected]_if_false @firstpart // or "if car is players jump to start"//do whatever

 

Wouldn't that theoretically make sure the player car was unaffected/undetected?

That´s exactly what we were talking about. We didn´t give it a name but stored it in a variable. The problem is following:

That script is always storing the player´s car, because of the check if it´s the player´s car, the script restarts and gets the player car again and so on...

Looks like this:

 

:PART103C0: [email protected] = actor $PLAYER_ACTOR [email protected] = -10AB5: store_actor $PLAYER_ACTOR closest_vehicle_to [email protected] closest_ped_to [email protected] //GETS PLAYER CAR IN [email protected] EVERYTIMEif andNOT [email protected] == -1NOT [email protected] == [email protected] //FALSE, BECAUSE IT´S THE PLAYER CARjump_if_false PART1jump PART2:PART2//do something with that car

 

 

Are you understanding what I mean?

We need an option that excludes the player car from the beginning.

 

EDIT:

@barking

Please stop double-posting. And use punctuation, I´m not able to decipher even half of the things you write.

Edited by Bennington

Share this post


Link to post
Share on other sites
barking

benni

sry for double but its the last double lo i need a code like you wrote but it will net take car with a driver/player while im on foot

ty agein

Share this post


Link to post
Share on other sites
Bennington

You´re still abandoning punctuation confused.gif

Double-posts BTW don´t make any sense if the last post is just from an hour ago.

Did you try the script yet?

Share this post


Link to post
Share on other sites
barking

i tried now but it crashed me

any way can u give me a code tha will not a car with a driver player?

btw its look like the first code that someone gave me up in the topic

Share this post


Link to post
Share on other sites
fireguy109

 

That´s exactly what we were talking about. We didn´t give it a name but stored it in a variable. The problem is following:

That script is always storing the player´s car, because of the check if it´s the player´s car, the script restarts and gets the player car again and so on...

Looks like this:

 

:PART103C0: [email protected] = actor $PLAYER_ACTOR [email protected] = -10AB5: store_actor $PLAYER_ACTOR closest_vehicle_to [email protected] closest_ped_to [email protected] //GETS PLAYER CAR IN [email protected] EVERYTIMEif andNOT [email protected] == -1NOT [email protected] == [email protected] //FALSE, BECAUSE IT´S THE PLAYER CARjump_if_false PART1jump PART2:PART2//do something with that car

 

 

Are you understanding what I mean?

We need an option that excludes the player car from the beginning.

 

EDIT:

@barking

Please stop double-posting. And use punctuation, I´m not able to decipher even half of the things you write.

Oh, okay. I missed the " if NOT" part- I script with opcodes, so I don't always catch all the variables. blush.gif

 

Although wouldn't that theoretically make it abandon the script, as it'll always find the player car first and then restart the script? Just a never ending cycle of checking, without changing. We need to, like, either place a bunch of spheres around the vehicle, and check if there was anything in any one, or make it completely disregard the player car as a vehicle. facedesk.gif

Share this post


Link to post
Share on other sites
Bennington
Oh, okay. I missed the " if NOT" part- I script with opcodes, so I don't always catch all the variables. blush.gif

 

Although wouldn't that theoretically make it abandon the script, as it'll always find the player car first and then restart the script? Just a never ending cycle of checking, without changing. We need to, like, either place a bunch of spheres around the vehicle, and check if there was anything in any one, or make it completely disregard the player car as a vehicle. facedesk.gif

No prob, I´m actually coding with opcodes only, too turn.gif

 

That´s a great idea biggrin.gif We could maybe 4 to 8 spheres around the player´s car, but it will be elaborate...

 

Barking, what exactly are you needing the script for? Maybe we could find an alternate way to solve that problem?

Share this post


Link to post
Share on other sites
barking

i need a code that will get only empty cars without drivers like petric gave me but it will not take cars with players in(drivers)the car while im on foot

btw if u will find with him the code that will not effect on my car so on other car post it here please

Share this post


Link to post
Share on other sites
fireguy109

If that's so, we should make a HUGE sphere of the entire map and detect all vehicles, then delete all drivers but player_char.

 

 

:code1ifplayer_char [email protected]@code2:code2//detect all drivers and delete [email protected] [email protected][email protected]_guy = @[email protected]

 

Edited by fireguy109

Share this post


Link to post
Share on other sites
barking

someone??sad.gif

''i need a code that will get only empty cars without drivers like petric gave me but it will not take cars with players in(drivers)the car while im on foot''

Share this post


Link to post
Share on other sites
Bennington

Barking, you´re repeating yourself too often... and you seem to have barely patience. Sometimes replies aren´t coming quickly.

And it´s complete bullsh*t that you created a new topic, we can try to find a solution in this one, you don´t have to if another problems appears...

 

What do you like to do with that empty cars?

Share this post


Link to post
Share on other sites
barking

to teleport her to me

i just need the code like petick gave me but i want to get only empty cars without a driver while i use this opcode:

0AB5: store_actor $PLAYER_ACTOR closest_vehicle_to [email protected] closest_ped_to $_UNUSED_RANDOM_ACTOR

Edited by barking

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.