Quantcast

Jump to content

» «
Photo

struct of car

8 replies to this topic
dtd mods
  • dtd mods

    gta coder

  • BUSTED!
  • Joined: 07 Jul 2008

#1

Posted 28 April 2009 - 06:09 PM

hi every1 what is this? and how can i use this? give an example
CODE:
0A97: 1@ = car 0@ struct

ZAZ
  • ZAZ

    Kernlochbohrer

  • Members
  • Joined: 10 Jan 2005
  • European-Union

#2

Posted 28 April 2009 - 06:44 PM

QUOTE (dtd mods @ Apr 28 2009, 18:09)
hi every1 what is this? and how can i use this? give an example
CODE:
0A97: 1@ = car 0@ struct

It reads several infos of the player car. Needs to read memory adresses to get the infos.
Im not able to do it. I can just give exembles:

Yelmi used it to read the Nitro state:
CODE
{$CLEO .cs}
:Nitro_Display
03A4: name_thread 'NITRO'

:NITRO_11
0001: wait 0 ms
00D6: if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @NITRO_11
00D6: if and
0038:   $ONMISSION == 0
00DF:   actor $PLAYER_ACTOR driving
004D: jump_if_false @NITRO_11


:NITRO_68
0001: wait 0 ms
00D6: if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @NITRO_68
077E: get_active_interior_to 2@
00D6: if and
0038:   $ONMISSION == 0
0039:   2@ == 0
00DF:   actor $PLAYER_ACTOR driving
004D: jump_if_false @NITRO_88
03C0: 0@ = actor $PLAYER_ACTOR car
096D: get_car 0@ car_component 8 on_slot 17@
00D6: if
8039:   not  17@ == -1
004D: jump_if_false @NITRO_88
00D6: if
00DB:   actor $PLAYER_ACTOR in_car 0@
004D: jump_if_false @NITRO_88
0A97: 8@ = car 0@ struct
000A: 8@ += 2424
0A8D: 9@ = read_memory 8@ size 1 virtual_protect 0
03F0: enable_text_draw 1
045A: text_draw_1number  250.0  40.0 'NUMBER' 9@    // value
0002: jump @NITRO_68

:NITRO_88
01C3: remove_references_to_car 0@  // Like turning a car into any random car
0002: jump @NITRO_11


Seemann used it for the carrec.cs which allows to record a carrec path
look at: http://cleo.sannybuilder.com/
More informations at http://www.gtaforums...howtopic=297295
and
http://www.gtaforums...howtopic=408404

Seemann posted a link to a tool made by Sanchez in the .RRR format explanation topic
but the link is dead.
I uploaded it at mediafire: R3D.rar
It shows the infos of the carstruct

Wesser
  • Wesser

    The complexity simplifier, the efficiency optimizer.

  • Feroci Racing
  • Joined: 19 Aug 2006
  • Unknown

#3

Posted 29 April 2009 - 08:02 PM Edited by Wesser, 17 May 2011 - 06:15 PM.

Well, first of all read something about how the addresses work in a process before making changes.
CODE
0A96: 0@ = actor $ACTOR struct
0A97: 0@ = car $VEHICLE struct
0A98: 0@ = object $OBJECT struct

These opcodes reads the pointer of actors, cars and objects where some values can be found by adding another ones. These opcodes aren't really important if you want to get values from the player, because they can be replaced by using these lines (I didn't tested them but they will work surely, I think):
CODE
0@ = 0xB6F5F0 // CPlayer
0@ = 0xB6F980 // CPlayerVehicle
//0@ = 0x???????? // there's no CPlayerObject

To have the value of an address you should read it, ofcourse, so use 0A8D to do it. This is an example to get the player's xyz coords.
CODE
Address + Offset taken from gtamodding.com in #Pedestrians

0xB6F5F0 - Player pointer (CPlayer)

+0x14 - Pointer to XYZ position structure
+0x30 = XPos
+0x34 = YPos
+0x38 = ZPos

Everytime you heard a pointer, you should read it's memory. So follow the code above:
CODE
0A96: 0@ = actor $PLAYER_ACTOR struct
0@ += 0x14
0A8D: 0@ = read_memory 0@ size 4 virtual_protect 0 // read pointer's memory of CPed XYZ position structure
0@ += 0x30
0A8D: 1@ = read_memory 0@ size 4 virtual_protect 0 // x pos
0@ += 0x4
0A8D: 2@ = read_memory 0@ size 4 virtual_protect 0 // y pos
0@ += 0x4
0A8D: 3@ = read_memory 0@ size 4 virtual_protect 0 // z pos

Using the CPed pointer I added 0x14 to get the player pos structure and then I added again 0x30, 0x34, 0x38 to get respectively the xyz player coords.

Note: I added for the next coords 0x4 so I didn't have to reread the player pointer and add 0x14.

You can get the same effects as the opcode 0A96 by doing this (a bit longer and unused):
CODE
0A8D: 0@ = read_memory 0xB6F5F0 size 4 virtual_protect 0 // read pointer's memory of CPlayer structure

You have to know with these addresses you can do whatever you want if you know where your data is certainly stored (you should try to search all addresses in the exe by yourself, I use cheat engine to find some).

You should read something on gtamodding.com memory addresses section for gta sa. It can be found here.

PatrickW
  • PatrickW

    GTA Juggernaut

  • Inactive Staff
  • Joined: 07 Jan 2004
  • Netherlands
  • Best Script 2013 [DYOM]
    Best Script 2012 [DYOM]

#4

Posted 29 April 2009 - 08:13 PM

QUOTE (Wesser @ Apr 29 2009, 21:02)
Well, first of all read something about how the addresses work in a process before making changes.
CODE
0A96: 0@ = actor $ACTOR struct
0A97: 0@ = car $VEHICLE struct
0A98: 0@ = object $OBJECT struct

These opcodes reads the pointer of actors, cars and objects where some values can be found by adding another ones. These opcodes aren't really important because they can be replaced by using these lines (I didn't tested them but they will work surely, I think).
CODE
0@ = 0xB7CD98 // CPed
0@ = 0xB7D324 // CVehicle
0@ = 0x?????? // I don't remember


Using absolute addresses as you suggest, you are only able to get information on some specific Items, such as the player actor and the current car of the player actor.

The 0A96, 0A97 and 0A98 opcodes are very important, as they provide access to the memory structure for ANY actor, ANY car and ANY OBJECT.
These opcodes are especially crucial if you want to access or modify a property of an actor, car or object, for which no SCM opcodes exist.

Wesser
  • Wesser

    The complexity simplifier, the efficiency optimizer.

  • Feroci Racing
  • Joined: 19 Aug 2006
  • Unknown

#5

Posted 29 April 2009 - 08:18 PM

Yep, you are right, I was wrong. I know I posted the player and vehicle pointer so you can only get values from player or the current car used by him.

PatrickW
  • PatrickW

    GTA Juggernaut

  • Inactive Staff
  • Joined: 07 Jan 2004
  • Netherlands
  • Best Script 2013 [DYOM]
    Best Script 2012 [DYOM]

#6

Posted 29 April 2009 - 08:28 PM

No problem, your examples for accessing properties through a pointer (either obtained through one of the opcodes or as an absolute address) are very useful nevertheless.

BTW, the offsets at which certain properties can be found in these memory structures, as well as other useful memory addresses can be found here.

dtd mods
  • dtd mods

    gta coder

  • BUSTED!
  • Joined: 07 Jul 2008

#7

Posted 30 April 2009 - 06:35 PM Edited by dtd mods, 30 April 2009 - 06:57 PM.

QUOTE (Wesser @ Apr 29 2009, 20:02)
Well, first of all read something about how the addresses work in a process before making changes.
CODE
0A96: 0@ = actor $ACTOR struct
0A97: 0@ = car $VEHICLE struct
0A98: 0@ = object $OBJECT struct

These opcodes reads the pointer of actors, cars and objects where some values can be found by adding another ones. These opcodes aren't really important if you want to get values from the player, because they can be replaced by using these lines (I didn't tested them but they will work surely, I think).
CODE
0@ = 0xB7CD98 // CPed
0@ = 0xB7D324 // CVehicle
0@ = 0x?????? // I don't remember

To have the value of an address you should read it, ofcourse, so use 0A8D to do it. This is an example to get the player's xyz coords.
CODE
0A96: 0@ = actor $PLAYER_ACTOR struct
0@ += 0x14
0@ += 0x30
0A8D: 1@ = read_memory 0@ size 4 virtual_protect 0 // x pos
0@ += 0x4
0A8D: 2@ = read_memory 0@ size 4 virtual_protect 0 // y pos
0@ += 0x4
0A8D: 3@ = read_memory 0@ size 4 virtual_protect 0 // z pos

Using the CPed pointer I added 0x14 to get the player pos structure and then I added again 0x30, 0x34, 0x38 to get respectively the xyz player coords.

Note: I added for the next coords 0x4 so I didn't have to reread the player pointer and add 0x14.

You can also make a different code which makes the same thing by seeing the following (more easier but unused).
CODE
0@ = 0xB7CDDC
0A8D: 1@ = read_memory 0@ size 4 virtual_protect 0 // x pos
0@ = 0xB7CDE0
0A8D: 2@ = read_memory 0@ size 4 virtual_protect 0 // y pos
0@ = 0xB7CDE4
0A8D: 3@ = read_memory 0@ size 4 virtual_protect 0 // z pos

You have to know with these addresses you can do whatever you want if you know where your data is certainly stored (you should try to search all addresses in the exe by yourself, I use cheat engine to find some).

You should read something on gtamodding.com memory addresses section for gta sa. It can be found here.

thx for the help but i dont understand how can i use them for example this 0xBAA420 - Wanted Level can you help? i mean throgn the memory address how can i put to the player a wanted level to 4

dtd mods
  • dtd mods

    gta coder

  • BUSTED!
  • Joined: 07 Jul 2008

#8

Posted 30 April 2009 - 06:59 PM

QUOTE (Wesser @ Apr 29 2009, 20:02)
Well, first of all read something about how the addresses work in a process before making changes.
CODE
0A96: 0@ = actor $ACTOR struct
0A97: 0@ = car $VEHICLE struct
0A98: 0@ = object $OBJECT struct

These opcodes reads the pointer of actors, cars and objects where some values can be found by adding another ones. These opcodes aren't really important if you want to get values from the player, because they can be replaced by using these lines (I didn't tested them but they will work surely, I think).
CODE
0@ = 0xB7CD98 // CPed
0@ = 0xB7D324 // CVehicle
0@ = 0x?????? // I don't remember

To have the value of an address you should read it, ofcourse, so use 0A8D to do it. This is an example to get the player's xyz coords.
CODE
0A96: 0@ = actor $PLAYER_ACTOR struct
0@ += 0x14
0@ += 0x30
0A8D: 1@ = read_memory 0@ size 4 virtual_protect 0 // x pos
0@ += 0x4
0A8D: 2@ = read_memory 0@ size 4 virtual_protect 0 // y pos
0@ += 0x4
0A8D: 3@ = read_memory 0@ size 4 virtual_protect 0 // z pos

Using the CPed pointer I added 0x14 to get the player pos structure and then I added again 0x30, 0x34, 0x38 to get respectively the xyz player coords.

Note: I added for the next coords 0x4 so I didn't have to reread the player pointer and add 0x14.

You can also make a different code which makes the same thing by seeing the following (more easier but unused).
CODE
0@ = 0xB7CDDC
0A8D: 1@ = read_memory 0@ size 4 virtual_protect 0 // x pos
0@ = 0xB7CDE0
0A8D: 2@ = read_memory 0@ size 4 virtual_protect 0 // y pos
0@ = 0xB7CDE4
0A8D: 3@ = read_memory 0@ size 4 virtual_protect 0 // z pos

You have to know with these addresses you can do whatever you want if you know where your data is certainly stored (you should try to search all addresses in the exe by yourself, I use cheat engine to find some).

You should read something on gtamodding.com memory addresses section for gta sa. It can be found here.

thx for the help but i dont understand how can i use them for example this 0xBAA420 - Wanted Level can you help?i mean how to add to the player a wanted level to 2 but with the memory address

Wesser
  • Wesser

    The complexity simplifier, the efficiency optimizer.

  • Feroci Racing
  • Joined: 19 Aug 2006
  • Unknown

#9

Posted 01 May 2009 - 07:46 AM

The post has been redirected here.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users