Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Drug Wars
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

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

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

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

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

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    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. Design Your Own Mission
      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
    1. Announcements

    2. Support

    3. Suggestions

[SA] Check if vehicle owned by player


MKKJ
 Share

Recommended Posts

I've been trying to make script which needs to check if certain vehicle player tries to drive is owned by player

And opcode 0A17 sets something like "player owner" flag to spawner vehicles - whether you gain wanted star if entering this car with police nearby.

 

Is there are any way to read this flag or set this flag for other vehicles?

Edited by MKKJ
Link to comment
Share on other sites

Yes, but it won't help - not directly anyway. 0A17 sets a flag on a car generator; that information is easily mapped in memory but won't help. You need info on the vehicle that is created by the car generator. I'm not finding anything obvious in my standard CVehicle reference. Players may have additional info in the SA Memory topic that never migrated to the wiki.

 

ChangeLawEnforcerState - I wonder what function does.

 

This seems like the sort of thing that might be easy to track down, but I doubt I'll have the time to investigate anytime soon. My thought is to restrict vehicle creation using restricted cube corners and any codes that reduced traffic or disable aircraft and police that seem appropriate. Then dump the entire car generator pool and create and display a row of 5 player owned and another row of non-owned car generators in an isolated area like a gully or runway. Then flood the rest of the cargen pool with undisplayed generators to prevent streamed car generators from creating vehicles. Hopefully that will limit all vehicles in memory to a controlled set of 10. If those records are extracted and aligned in an editor (text, hex, spreadsheet) the difference between the first set of owned vehicles might be visually distinguishable.

Link to comment
Share on other sites

Yeah, i tried search CVehicle reference and found nothing - not checked the topic, though.
Strange, I thought someone already figured out this, as this flag used commonly and also used at ambulance/police car for slight health/shotgun.

I think i found some of this 'function' you said, I recalled HasBeenOwnedByPlayer flag or something from gitlab back then... But I'm not into coding so i don't know what to do about it.

Nevertheless, thanks for the answer. I've figured out a workaround anyway (ineffective though, only worked if there's a driver and player tries to jack it)

But I would love to hear if there's a proper way to read/set this 'flag'.

Edited by MKKJ
Link to comment
Share on other sites

Check out CVehicle+0x42A & 2. If I am not mistaken, if this bit is set, player doesn't get wanted level for entering this vehicle, which is, as far as I understand, what you need.

  • Like 2
Link to comment
Share on other sites

Check out CVehicle+0x42A & 2. If I am not mistaken, if this bit is set, player doesn't get wanted level for entering this vehicle, which is, as far as I understand, what you need.

Oh yeah, i tried it and looks like it also holds other flags as well, maybe like this

 

+1066

1 = Visibly damaged

2 = Owned by player

32 = Player can move?

 

Is there are another flag in this?

Posibbly there's more but i guess i found what i need. Thanks.

Edited by MKKJ
Link to comment
Share on other sites

Did you find a direct association between opcode 0A17 and CVehicle+0x42A & 2? If no one has checked this flag on a vehicle created by a player owned car generator then perhaps I'll run a quick test just to be sure.

Link to comment
Share on other sites

Seems like 0A17 sets this bit to its spawned vehicle.

I tested it with Sweet's car generator - this bit is already set when i tried to enter it. And from main.scm this generator already flagged as player owned with 0A17.

 

Edit:

I also checked Ryder's Picador, cars in Wang Cars and Bike School 'gifts'. All of them have this bit already set on them and have 0A17 applied to their generator.

Driving school 'gift' cars don't have 0A17 set at their generator and this 'player owner' bit is not set on them.

Edited by MKKJ
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • 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.