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

Happy Holidays from the GTANet team!

Fuel gauge native & car camera rotation


hygkolk1
 Share

Recommended Posts

Hello,

 

Sorry for 2 questions at once, I read the rules and did not read about asking two questions in a single post

 

I have been looking for a native "command" to retrieve the value of the fuel gauge in a car, and set it to any value you want.

In the game the fuel gauge is static and set to max but if you shoot the tank on for example a truck then it drops and your car will stop after the fuel gauge reaches 0. (so there are values set for it?)

I have looked and crtl+f'd nativedb throughout, with no luck, other dashboard items like blinkers are available..

 

Also I am looking to improve the camera angles while driving, I would like to be able to for example look at my feet while driving :colgate:

But right now your view in first person is limited..

I was wondering if I could make a mod in Lua which checks to see if player is in car and if returned true then sets the camera rotation to greater values.

 

Any idea's how to get fuel float & set max camera viewing angles?

 

I know you guys have hate for newbie posters that think they are modders but I am seriously curious how one would take these problems :)

 

thanks

  • Like 1
Link to comment
Share on other sites

The fuel gauge would probably require memory editing.

So finding the address with lets say cheat engine?

I know I can't handle a task like that, I would end up with 1 mil results since all i know it decreases by a fixed and then stops decreasing..

Link to comment
Share on other sites

 

The fuel gauge would probably require memory editing.

So finding the address with lets say cheat engine?

I know I can't handle a task like that, I would end up with 1 mil results since all i know it decreases by a fixed and then stops decreasing..

 

Easiest way for is probably ScriptHookV's getScriptHandleBaseAddress function and then:

float fuel = *(float *)(CVehicle + (GAME_VERSION > 3 ? 0x768 : 0x758));
Link to comment
Share on other sites

CVehicle is the base address? Is that working code for the fuel or just an example? Also is there any documentation online for GTA V memory addresses?

Link to comment
Share on other sites

Unknown_Modder, I can not find any information about getScriptHandleBaseAddress nor what CVehicle is (and even why GAME_VERSION needs to be more than 3), thanks for your help but could you point me to where I can find some documentation on what you just posted?

Link to comment
Share on other sites

Unknown_Modder, I can not find any information about getScriptHandleBaseAddress nor what CVehicle is (and even why GAME_VERSION needs to be more than 3), thanks for your help but could you point me to where I can find some documentation on what you just posted?

So here's a complete function (the simplest I could think of). ScriptHookV SDK is required:

#define GAME_VERSION getGameVersion()float getFuel(Vehicle vehicle){    BYTE *address = getScriptHandleBaseAddress(vehicle); // CVehicle    int offset = (GAME_VERSION > 3 ? 0x768 : 0x758); // offset changed in b372    return address == NULL ? 0.0f : *(float *)(address + offset); // return 0.0f if address is NULL}

Do you understand now?

 

EDIT: setFuel would be this:

void setFuel(Vehicle vehicle, float value){    BYTE *address = getScriptHandleBaseAddress(vehicle);    int offset = (GAME_VERSION > 3 ? 0x768 : 0x758);    if (address) { *(float *)(address + offset) = value; }}
Edited by Unknown_Modder
  • Like 2
Link to comment
Share on other sites

Maybe this parameter from handling.meta will be helpful.

 

<fPetrolTankVolume value="65.000000" />

HHnErXC.png


Link to comment
Share on other sites

MrGTAmodsgerman

Hello,

 

Sorry for 2 questions at once, I read the rules and did not read about asking two questions in a single post

 

I have been looking for a native "command" to retrieve the value of the fuel gauge in a car, and set it to any value you want.

In the game the fuel gauge is static and set to max but if you shoot the tank on for example a truck then it drops and your car will stop after the fuel gauge reaches 0. (so there are values set for it?)

I have looked and crtl+f'd nativedb throughout, with no luck, other dashboard items like blinkers are available..

 

Also I am looking to improve the camera angles while driving, I would like to be able to for example look at my feet while driving :colgate:

But right now your view in first person is limited..

I was wondering if I could make a mod in Lua which checks to see if player is in car and if returned true then sets the camera rotation to greater values.

 

Any idea's how to get fuel float & set max camera viewing angles?

 

I know you guys have hate for newbie posters that think they are modders but I am seriously curious how one would take these problems :)

 

thanks

I remember the time where i ask the same thing but everbody says "Its not possible" "You can only damage your petrol tank"

I hope you get it to work! I cant wait, would be awesome to see a real petrol state of a mod inside my vehicle!

Edited by MrGTAmodsgerman
Link to comment
Share on other sites

  • 5 months later...

 

Unknown_Modder, I can not find any information about getScriptHandleBaseAddress nor what CVehicle is (and even why GAME_VERSION needs to be more than 3), thanks for your help but could you point me to where I can find some documentation on what you just posted?

So here's a complete function (the simplest I could think of). ScriptHookV SDK is required:

#define GAME_VERSION getGameVersion()float getFuel(Vehicle vehicle){    BYTE *address = getScriptHandleBaseAddress(vehicle); // CVehicle    int offset = (GAME_VERSION > 3 ? 0x768 : 0x758); // offset changed in b372    return address == NULL ? 0.0f : *(float *)(address + offset); // return 0.0f if address is NULL}

Do you understand now?

 

EDIT: setFuel would be this:

void setFuel(Vehicle vehicle, float value){    BYTE *address = getScriptHandleBaseAddress(vehicle);    int offset = (GAME_VERSION > 3 ? 0x768 : 0x758);    if (address) { *(float *)(address + offset) = value; }}

 

Hi Dear

 

May I ask what is the expected return of getScriptHandleBaseAddress(Vehicle vehicle)?

 

I'm trying to use the same routine to get the steer/throttle/brake value when game AI is driving. However, the return value of getScriptHandleBaseAddress(Vehicle vehicle) is 120, and the pointer is ffffffff8154d8s2 (16hex). I tried to serach the 16 hex value in CheatEngin but found nothing? Any advice on this?

 

1. Why I get scan error (no readable memory found) in Cheat Enging when search the address range [ffffffff8154d8s2, some larger value]?

2. Is ffffffff8154d8s2 a possibly right value or should it be 8154d8s2 instead? But if I search [8154d8s2, some larger value] it also returns a scan error message saying no readable memory found.

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.