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. Forum Support

    3. Suggestions

[SA] Getting a car's tyre position


rscaerzx
 Share

Recommended Posts

Hi,

I wanted to know if it's possible to get a specific car's tyre position or offsets with CLEO script by reading memory addresses ? Perhaps even more parts like gas tanks and such. Something like this but able to access the offsets directly in-game: https://pastebin.com/rKDAhRkv

Thanks

Link to comment
Share on other sites

Yes, it's possible.

You should follow this logic:

 

 

CVector GetCarWheelOffset(CVehicle *vehicle, int componentId) {    if (vehicle->m_dwVehicleSubClass == VEHICLE_AUTOMOBILE) { // (vehicle +0x594) == 0        CAutomobile *car = reinterpret_cast<CAutomobile *>(vehicle);        if (car->m_aCarNodes[componentId]) { // (car +(0x648+4*componentId))            RwV3d *offset = &car->m_aCarNodes[componentId]->modelling.pos; // frame +0x40            return { offset->x, offset->y, offset->z }; // (vec +0x0, +0x4, +0x8)        }    }    return { 0.0f, 0.0f, 0.0f };}
Edited by DK22Pac
  • Like 2
Link to comment
Share on other sites

Thank you, it works perfectly!

03C0: [email protected] = actor $PLAYER_ACTOR car0A97: [email protected] = car [email protected] struct000A: [email protected] += 0x6480006: [email protected] = 40012: [email protected] *= componentId005A: [email protected] += [email protected]  // (int)0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0000A: [email protected] += 0x400A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0 // x000A: [email protected] += 0x40A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0 // y000A: [email protected] += 0x40A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0 // z0AD1: show_formatted_text_highpriority "Offsets: %f %f %f" time 5000 [email protected] [email protected] [email protected]

But how about bikes? I tried to read the xyz offsets just like above but it doesn't seem to work

  • CBike + 0x5B0 = [dword] wheel_front Component (RwFrame)
  • CBike + 0x5B4 = [dword] wheel_rear Component (RwFrame)

Also I've read your blogspot about the component ids http://dk22pac.blogspot.my/p/sa-hirerarchy-automobile.html I'd like to get the offsets of the petrol cap component but I believe it has a different structure. I would really appreciate if you could help me access the offsets.. thanks!

Link to comment
Share on other sites

Yes, bike wheels are placed inside other components in hierarchy, so you should additionally transform wheel offset by multiplying it with 'parent' matrices.

 

CVector GetBikeWheelPosition(CBike *bike, int componentId) {    if (bike->m_aBikeNodes[componentId]) { // (bike +0x5A0+4*componentId)        RwV3d offset = bike->m_aBikeNodes[componentId]->modelling.pos; // frame +0x40        RwFrame *parentNode = reinterpret_cast<RwFrame *>(bike->m_aBikeNodes[componentId]->object.parent); // (frame+0x4)        while (parentNode && parentNode->object.parent) {            RwV3dTransformPoint(&offset, &offset, &parentNode->modelling); // 0x7EDD60            parentNode = reinterpret_cast<RwFrame *>(parentNode->object.parent);        }        return { offset.x, offset.y, offset.z }; // (vec +0x0, +0x4, +0x8)    }    return { 0.0f, 0.0f, 0.0f };}
Bike components

 

I'd like to get the offsets of the petrol cap component but I believe it has a different structure. I would really appreciate if you could help me access the offsets.. thanks!

CVector GetVehicleDummyOffset(CVehicle *vehicle, int dummyId) {    CVehicleModelInfo *vehModel = reinterpret_cast<CVehicleModelInfo *>(CModelInfo::GetModelInfo(vehicle->m_wModelIndex)); // 0x403DA0    if (vehModel && vehModel->m_pVehicleStruct) // (vehModel +0x5C)        return vehModel->m_pVehicleStruct->m_avDummyPosn[dummyId]; // vehModelStruct +0x0+12*dummyId    return { 0.0f, 0.0f, 0.0f };}
Dummy IDs (CAutomobile)

 

 

 

0  headlights1  taillights2  headlights23  taillights24  ped_frontseat5  ped_backseat6  exhaust7  engine8  petrolcap9  hookup10 ped_arm11 miscpos_c12 miscpos_d13 miscpos_a14 miscpos_b

 

Dummy IDs (CBike)

 

 

 

0  headlights1  taillights2  headlights23  taillights24  ped_frontseat5  ped_backseat6  exhaust7  engine8  petrolcap9  hookup10 bargrip11 miscpos_a12 miscpos_b

 

Note: It's really necessary to check vehicle type before accessing components/dummies tables.

  • Like 2
Link to comment
Share on other sites

Awesomee
Thank you so much :D:D
:cookie::cookie::cookie:

 

 

 

...const    componentId = 4 // BIKE_WHEEL_FRONT    dummyId = 8 // petrolcapend...03C0: [email protected] = actor $PLAYER_ACTOR car0A97: [email protected] = car [email protected] struct000A: [email protected] += 0x5A00006: [email protected] = 40012: [email protected] *= componentId005A: [email protected] += [email protected]  // (int)0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 00085: [email protected] = [email protected] // (int)000A: [email protected] += 0x400A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0000A: [email protected] += 0x40A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0000A: [email protected] += 0x40A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0        000A: [email protected] += 0x40A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0000A: [email protected] += 0x100AA5: call_method 0x7EDD60 num_params 3 pop 3 [email protected] [email protected] [email protected]: show_formatted_text_highpriority "Wheel Offsets: %f %f %f" time 5000 [email protected] [email protected] [email protected]: [email protected] = car [email protected] model0AA7: call_function 0x403DA0 num_params 1 pop 1 [email protected] [email protected]: [email protected] += 0x5C0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 00006: [email protected] = 120012: [email protected] *= dummyId005A: [email protected] += [email protected]  // (int) 0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0 // x000A: [email protected] += 0x40A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0 // y000A: [email protected] += 0x40A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0 // z0AD1: show_formatted_text_highpriority "Petrolcap offsets: %f %f %f" time 5000 [email protected] [email protected] [email protected] 

 

 

 

 

Note: It's really necessary to check vehicle type before accessing components/dummies tables.

Alright I'll keep that in mind :)

Edited by rscaerzx
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.