Jump to content

Regarding Memory Addresses (SA)


Guest

Recommended Posts

I've searched the forum about a tutorial about this or some thread which would help me with this, but I couldn't exactly find any.

It's not exactly user-friendly, so I'm going to post this thread anyway.

I would like to say "Hey there", sorry if I'm not making any sense, so please just educate me on this.

I don't really understand the Memory Addresses for GTA: SA to the best of my ability.

In "http://www.gtamodding.com/index.php?title=...s_%28SA%29#Cars"

 

I am making a small trainer (private) for me and my friends.

I only understand the parts about bit/byte, float and dword but not the part about pointers/offsets (if that's the right word).

I want to add a feature to lock your vehicles, so no-one could carjack you/throw you out your vehicle i.e. police

Under "Cars", you get three pointers. (I think that's the right word)

 

    0xB6F980 - Is the direct pointer to the pool start (CVehicle)   0xBA18FC - Current vehicle pointer:       0 = on-foot       >0 = in-car    0x969084 - First vehicle you got into

 

I'm not sure what /pointer/ I want to actually use to create a door lock. (for example)

Let's say I want to use the vehicle -locked- state.

 

 

+1272 = [dword] Car Door Locked State:   1 = open   2 = locked

 

 

How am I meant to find the correct pointer and the offset and make the right code to lock the vehicle?

Again, sorry if I'm not making sense, I don't have much knowledge when it comes to C++.

 

Slightly Offtopic: This is my C# vb.net code for "Hitman all weapons" - (These memory addresses/values are all standalone)

 

Dim hitmanweapons As String = TextBox3.Text       Try           WriteFloat("gta_sa", &HB79496, "1000") 'Pistol           WriteFloat("gta_sa", &HB79498, "1000") 'Silenced Pistol           WriteFloat("gta_sa", &HB7949C, "1000") 'Desert Eagle           WriteFloat("gta_sa", &HB794A0, "1000") 'Shotgun           WriteFloat("gta_sa", &HB794A4, "1000") 'Sawn-off Shotgun           WriteFloat("gta_sa", &HB794A8, "1000") 'Combat Shotgun           WriteFloat("gta_sa", &HB794AC, "1000") 'Machine Pistol           WriteFloat("gta_sa", &HB794B0, "1000") 'SMG           WriteFloat("gta_sa", &HB794B4, "1000") 'AK-47           WriteFloat("gta_sa", &HB794B8, "1000") 'M4       Catch ex As Exception       End Try

 

 

How am I meant to find the right pointer, and how am I meant to add it to the pointer?

(Sorry for any mistakes, I don't really understand this because I'm quite a n00b at this.)

EDIT: I wouldn't mind if you spoonfed me the solution then tell me how you did it so I could it for all the other things.

PLEASE, remember, you're telling a "newfag" how to use the memory addresses!Please simplify everything!

SOLVED, READ THREADSTARTER'S LAST POST.

Edited by Guest
Link to comment
Share on other sites

I don't have much knowledge regarding memory addresses, please correct me if I'm wrong.

 

You want to write this as an asi, or exe? If it's an asi you are definately going to need C++.

 

If the value of that address is 0, the player is on foot, if it's higher than 0 the player is in a vehicle. About the door lock I don't know.

 

0xBA18FC - Current vehicle pointer:      0 = on-foot      >0 = in-car 

 

 

This is vb.net

 

Slightly Offtopic: This is my C# code for "Hitman all weapons"

 

Dim hitmanweapons As String = TextBox3.Text      Try          WriteFloat("gta_sa", &HB79496, "1000") 'Pistol          WriteFloat("gta_sa", &HB79498, "1000") 'Silenced Pistol          WriteFloat("gta_sa", &HB7949C, "1000") 'Desert Eagle          WriteFloat("gta_sa", &HB794A0, "1000") 'Shotgun          WriteFloat("gta_sa", &HB794A4, "1000") 'Sawn-off Shotgun          WriteFloat("gta_sa", &HB794A8, "1000") 'Combat Shotgun          WriteFloat("gta_sa", &HB794AC, "1000") 'Machine Pistol          WriteFloat("gta_sa", &HB794B0, "1000") 'SMG          WriteFloat("gta_sa", &HB794B4, "1000") 'AK-47          WriteFloat("gta_sa", &HB794B8, "1000") 'M4      Catch ex As Exception      End Try

 

 

Keep in mind that this can be easily done in cleo.

Edited by Bad.boy!
Link to comment
Share on other sites

You said you dont know much about pointers and offsets and im tired and lazily stopped reading shortlyl after that part, sorry. But pointers are just numbers. So say 8 was our pointer. Its pointing to the 8th occurance in a sequence of numbers all 1 in size. An offset is just adding to that value.

 

If the sequence of numbers was 4 in size, 8 would be a pointer to the second occurance. Oh, this seems kinda like times tables... Oh yeah, thats exactly what it is. Each occurance is a struct because pools (which is what we call the memory reserved for structs/classes) simply contain lots of structs side by side. So a ped pool is a block of memory containing xx amount of ped structs, one after another. If we have the address of the start of the pool, we also have the address of the first ped in that pool. Of we add the size of a ped struct, we get the next ped in the pool. And we can just keep going till the end of the pool.

 

From any ped struct, we can add any number (between 0 and the ped struct size, of course) and we get just one of the many fields of that struct.

 

All in all, its just a sequence of numbers/bytes (data). The address can point to any occurance in the sequence...

 

Link to comment
Share on other sites

 

You said you dont know much about pointers and offsets and im tired and lazily stopped reading shortlyl after that part, sorry. But pointers are just numbers. So say 8 was our pointer. Its pointing to the 8th occurance in a sequence of numbers all 1 in size. An offset is just adding to that value.

 

If the sequence of numbers was 4 in size, 8 would be a pointer to the second occurance. Oh, this seems kinda like times tables... Oh yeah, thats exactly what it is. Each occurance is a struct because pools (which is what we call the memory reserved for structs/classes) simply contain lots of structs side by side. So a ped pool is a block of memory containing xx amount of ped structs, one after another. If we have the address of the start of the pool, we also have the address of the first ped in that pool. Of we add the size of a ped struct, we get the next ped in the pool. And we can just keep going till the end of the pool.

 

From any ped struct, we can add any number (between 0 and the ped struct size, of course) and we get just one of the many fields of that struct.

 

All in all, its just a sequence of numbers/bytes (data). The address can point to any occurance in the sequence...

Okay, thanks for defining what they are both are.

-but I'm asking 'How am I able to use this'? -because other things like the Money value is stand alone.

Whereas I would have to use two things, which I am not in the knowledge of using.

Maybe if you could explain HOW to use it, and the ending?

I know this may be called "spoonfeeding" or whatever,

but if you tell me how I did it, I may be able to try it by my self on other memory addresses and check if I can do it correctly.

 

I learn by examples and mistakes, but everyone else's learning varies biggrin.gif

EDIT: A simplified step-by-step tutorial would be much appreciated.

SOLVED, READ THREADSTARTER'S LAST POST.

Edited by Guest
Link to comment
Share on other sites

Spoonfeeding is right. Coding is like Math. You could get a tutorial to teach you how to do one thing, but what use would that be? Like math, you have to properly understand the system in order to know how to use it properly. Most people read tutorials and blindly follow how to do a particular thing... Then when something goes wrong they have no clue why. Thats why I decided to start writing somewhat of a coding manual instead of a tutorial.

 

Anyway, I dont have the examples to spoonfeed you. But there are hundereds out there. Do a little searching, they aren't too hard to find. I have a tutorial on finding addresses here: http://gtag.gtagaming.com/forums/index.php?showtopic=233

Link to comment
Share on other sites

 

Spoonfeeding is right. Coding is like Math. You could get a tutorial to teach you how to do one thing, but what use would that be? Like math, you have to properly understand the system in order to know how to use it properly. Most people read tutorials and blindly follow how to do a particular thing... Then when something goes wrong they have no clue why. Thats why I decided to start writing somewhat of a coding manual instead of a tutorial.

 

Anyway, I dont have the examples to spoonfeed you. But there are hundereds out there. Do a little searching, they aren't too hard to find. I have a tutorial on finding addresses here: http://gtag.gtagaming.com/forums/index.php?showtopic=233

I saw that topic AND I already knew how to do it long time ago...

In other words, I'm asking how would I include the offset aswell as the pointer.

 

I want to be able to write to "gta_sa" with both pointer and offset.

I've been searching around SO long, this thread, others, other websites, google etc.

I need help!

SOLVED, READ THREADSTARTER'S LAST POST.

Edited by Guest
Link to comment
Share on other sites

 

In other words, I'm asking how would I include the offset aswell as the pointer.

 

I want to be able to write to "gta_sa" with both pointer and offset.

Not to be impatient but OMG did you not read my first post?! To summarize: NUMBERS, ADDITION.

 

I dont see how I can make what I explained in my first post any clearer. Please feel free to come at me with suggestions as they may help as I write my coding manual...

Edited by Deji
Link to comment
Share on other sites

NEVER MIND, PLEASE LOCK THIS THREAD!

I just had to convert "1272", which is "0x4F8" in which I had to set the integer to "2"!

Thanks for the "help" though.

(I prefer this site rather then the installed one in Win7)

http://microcontroller.com/Hex_Binary_Deci..._Calculator.htm

 

I didn't even have to install "CLEO3" to use door locker biggrin.gif

I'm going to test this out in SAMP aswell as GTA-SA (works perfectly in SP)

 

 

WritePointerInteger("gta_sa", &H969084, "2", &H4F8)

 

The module for the VB.net is as follows:

(Credits to Cless of CEF)

 

Module RWM2   Private Declare Function ReadMemoryByte Lib "kernel32" Alias "ReadProcessMemory" (ByVal Handle As Integer, ByVal Address As Integer, ByRef Value As Byte, Optional ByVal Size As Integer = 2, Optional ByRef Bytes As Integer = 0) As Byte   Private Declare Function ReadMemoryInteger Lib "kernel32" Alias "ReadProcessMemory" (ByVal Handle As Integer, ByVal Address As Integer, ByRef Value As Integer, Optional ByVal Size As Integer = 4, Optional ByRef Bytes As Integer = 0) As Integer   Private Declare Function ReadMemoryFloat Lib "kernel32" Alias "ReadProcessMemory" (ByVal Handle As Integer, ByVal Address As Integer, ByRef Value As Single, Optional ByVal Size As Integer = 4, Optional ByRef Bytes As Integer = 0) As Single   Private Declare Function ReadMemoryDouble Lib "kernel32" Alias "ReadProcessMemory" (ByVal Handle As Integer, ByVal Address As Integer, ByRef Value As Double, Optional ByVal Size As Integer = 8, Optional ByRef Bytes As Integer = 0) As Double   Private Declare Function WriteMemoryByte Lib "kernel32" Alias "WriteProcessMemory" (ByVal Handle As Integer, ByVal Address As Integer, ByRef Value As Byte, Optional ByVal Size As Integer = 2, Optional ByRef Bytes As Integer = 0) As Byte   Private Declare Function WriteMemoryInteger Lib "kernel32" Alias "WriteProcessMemory" (ByVal Handle As Integer, ByVal Address As Integer, ByRef Value As Integer, Optional ByVal Size As Integer = 4, Optional ByRef Bytes As Integer = 0) As Integer   Private Declare Function WriteMemoryFloat Lib "kernel32" Alias "WriteProcessMemory" (ByVal Handle As Integer, ByVal Address As Integer, ByRef Value As Single, Optional ByVal Size As Integer = 2, Optional ByRef Bytes As Integer = 0) As Single   Private Declare Function WriteMemoryDouble Lib "kernel32" Alias "WriteProcessMemory" (ByVal Handle As Integer, ByVal Address As Integer, ByRef Value As Double, Optional ByVal Size As Integer = 2, Optional ByRef Bytes As Integer = 0) As Double   Public Function ReadByte(ByVal EXENAME As String, ByVal Address As Integer) As Byte       Dim Value As Byte       If Process.GetProcessesByName(EXENAME).Length <> 0 Then           Dim Handle As Integer = Process.GetProcessesByName(EXENAME)(0).Handle           If Handle <> 0 Then               ReadMemoryByte(Handle, Address, Value)           End If       End If       Return Value   End Function   Public Function ReadInteger(ByVal EXENAME As String, ByVal Address As Integer) As Integer       Dim Value As Integer       If Process.GetProcessesByName(EXENAME).Length <> 0 Then           Dim Handle As Integer = Process.GetProcessesByName(EXENAME)(0).Handle           If Handle <> 0 Then               ReadMemoryInteger(Handle, Address, Value)           End If       End If       Return Value   End Function   Public Function ReadFloat(ByVal EXENAME As String, ByVal Address As Integer) As Single       Dim Value As Single       If Process.GetProcessesByName(EXENAME).Length <> 0 Then           Dim Handle As Integer = Process.GetProcessesByName(EXENAME)(0).Handle           If Handle <> 0 Then               ReadMemoryFloat(Handle, Address, Value)           End If       End If       Return Value   End Function   Public Function ReadDouble(ByVal EXENAME As String, ByVal Address As Integer) As Double       Dim Value As Double       If Process.GetProcessesByName(EXENAME).Length <> 0 Then           Dim Handle As Integer = Process.GetProcessesByName(EXENAME)(0).Handle           If Handle <> 0 Then               ReadMemoryByte(Handle, Address, Value)           End If       End If       Return Value   End Function   Public Function ReadPointerByte(ByVal EXENAME As String, ByVal Pointer As Integer, ByVal ParamArray Offset As Integer()) As Byte       Dim Value As Byte       If Process.GetProcessesByName(EXENAME).Length <> 0 Then           Dim Handle As Integer = Process.GetProcessesByName(EXENAME)(0).Handle           If Handle <> 0 Then               For Each I As Integer In Offset                   ReadMemoryInteger(Handle, Pointer, Pointer)                   Pointer += I               Next               ReadMemoryByte(Handle, Pointer, Value)           End If       End If       Return Value   End Function   Public Function ReadPointerInteger(ByVal EXENAME As String, ByVal Pointer As Integer, ByVal ParamArray Offset As Integer()) As Integer       Dim Value As Integer       If Process.GetProcessesByName(EXENAME).Length <> 0 Then           Dim Handle As Integer = Process.GetProcessesByName(EXENAME)(0).Handle           If Handle <> 0 Then               For Each I As Integer In Offset                   ReadMemoryInteger(Handle, Pointer, Pointer)                   Pointer += I               Next               ReadMemoryInteger(Handle, Pointer, Value)           End If       End If       Return Value   End Function   Public Function ReadPointerFloat(ByVal EXENAME As String, ByVal Pointer As Integer, ByVal ParamArray Offset As Integer()) As Single       Dim Value As Single       If Process.GetProcessesByName(EXENAME).Length <> 0 Then           Dim Handle As Integer = Process.GetProcessesByName(EXENAME)(0).Handle           If Handle <> 0 Then               For Each I As Integer In Offset                   ReadMemoryInteger(Handle, Pointer, Pointer)                   Pointer += I               Next               ReadMemoryFloat(Handle, Pointer, Value)           End If       End If       Return Value   End Function   Public Function ReadPointerDouble(ByVal EXENAME As String, ByVal Pointer As Integer, ByVal ParamArray Offset As Integer()) As Double       Dim Value As Double       If Process.GetProcessesByName(EXENAME).Length <> 0 Then           Dim Handle As Integer = Process.GetProcessesByName(EXENAME)(0).Handle           If Handle <> 0 Then               For Each I As Integer In Offset                   ReadMemoryInteger(Handle, Pointer, Pointer)                   Pointer += I               Next               ReadMemoryDouble(Handle, Pointer, Value)           End If       End If       Return Value   End Function   Public Sub WriteByte(ByVal EXENAME As String, ByVal Address As Integer, ByVal Value As Byte)       If Process.GetProcessesByName(EXENAME).Length <> 0 Then           Dim Handle As Integer = Process.GetProcessesByName(EXENAME)(0).Handle           If Handle <> 0 Then               WriteMemoryByte(Handle, Address, Value)           End If       End If   End Sub   Public Sub WriteInteger(ByVal EXENAME As String, ByVal Address As Integer, ByVal Value As Integer)       If Process.GetProcessesByName(EXENAME).Length <> 0 Then           Dim Handle As Integer = Process.GetProcessesByName(EXENAME)(0).Handle           If Handle <> 0 Then               WriteMemoryInteger(Handle, Address, Value)           End If       End If   End Sub   Public Sub WriteFloat(ByVal EXENAME As String, ByVal Address As Integer, ByVal Value As Single)       If Process.GetProcessesByName(EXENAME).Length <> 0 Then           Dim Handle As Integer = Process.GetProcessesByName(EXENAME)(0).Handle           If Handle <> 0 Then               WriteMemoryFloat(Handle, Address, Value)           End If       End If   End Sub   Public Sub WriteDouble(ByVal EXENAME As String, ByVal Address As Integer, ByVal Value As Double)       If Process.GetProcessesByName(EXENAME).Length <> 0 Then           Dim Handle As Integer = Process.GetProcessesByName(EXENAME)(0).Handle           If Handle <> 0 Then               WriteMemoryDouble(Handle, Address, Value)           End If       End If   End Sub   Public Sub WritePointerByte(ByVal EXENAME As String, ByVal Pointer As Integer, ByVal Value As Byte, ByVal ParamArray Offset As Integer())       If Process.GetProcessesByName(EXENAME).Length <> 0 Then           Dim Handle As Integer = Process.GetProcessesByName(EXENAME)(0).Handle           If Handle <> 0 Then               For Each I As Integer In Offset                   ReadMemoryInteger(Handle, Pointer, Pointer)                   Pointer += I               Next               WriteMemoryByte(Handle, Pointer, Value)           End If       End If   End Sub   Public Sub WritePointerInteger(ByVal EXENAME As String, ByVal Pointer As Integer, ByVal Value As Integer, ByVal ParamArray Offset As Integer())       If Process.GetProcessesByName(EXENAME).Length <> 0 Then           Dim Handle As Integer = Process.GetProcessesByName(EXENAME)(0).Handle           If Handle <> 0 Then               For Each I As Integer In Offset                   ReadMemoryInteger(Handle, Pointer, Pointer)                   Pointer += I               Next               WriteMemoryInteger(Handle, Pointer, Value)           End If       End If   End Sub   Public Sub WritePointerFloat(ByVal EXENAME As String, ByVal Pointer As Integer, ByVal Value As Single, ByVal ParamArray Offset As Integer())       If Process.GetProcessesByName(EXENAME).Length <> 0 Then           Dim Handle As Integer = Process.GetProcessesByName(EXENAME)(0).Handle           If Handle <> 0 Then               For Each I As Integer In Offset                   ReadMemoryInteger(Handle, Pointer, Pointer)                   Pointer += I               Next               WriteMemoryFloat(Handle, Pointer, Value)           End If       End If   End Sub   Public Sub WritePointerDouble(ByVal EXENAME As String, ByVal Pointer As Integer, ByVal Value As Double, ByVal ParamArray Offset As Integer())       If Process.GetProcessesByName(EXENAME).Length <> 0 Then           Dim Handle As Integer = Process.GetProcessesByName(EXENAME)(0).Handle           If Handle <> 0 Then               For Each I As Integer In Offset                   ReadMemoryInteger(Handle, Pointer, Pointer)                   Pointer += I               Next               WriteMemoryDouble(Handle, Pointer, Value)           End If       End If   End SubEnd Module

 

Edited by Guest
Link to comment
Share on other sites

I think you meant to say thanks for the "spoonfeeding". To which I reply: You're welcome smile.gif

 

EDIT: By the way, GTAF doesnt support, nor like people who use and especially create hacks for SAMP. s0beit, a much respected member of GTAF got banned for that, so in a world with balance, you wouldn't stand a chance. Although GTAF does tend to lack balance, so you might be in luck smile.gif

Edited by Deji
Link to comment
Share on other sites

 

I think you meant to say thanks for the "spoonfeeding". To which I reply: You're welcome smile.gif

 

EDIT: By the way, GTAF doesnt support, nor like people who use and especially create hacks for SAMP. s0beit, a much respected member of GTAF got banned for that, so in a world with balance, you wouldn't stand a chance. Although GTAF does tend to lack balance, so you might be in luck smile.gif

I was only testing, and that module isn't mine. It's from Cless from CEF (Cheat Engine Forums)

-and yes, you didn't help me whatsoever (just made it more confusing) AND it does not work for SAMP.

Good day to you though.

P.S. If you spoonfed me, I wouldn't had such a hard time finding how to do it & founding out the solution. (myself)

You only gave me a tutorial where you had to scan values.

I knew that... I think every beginner knows that.

 

EDIT: I might make a small "vehicle lock" trainer for GTA: SA (SP). (Not the private trainer)

Edited by Guest
Link to comment
Share on other sites

I like to make things confusing... Its kinda what I do around here, y'know?

 

And im glad you were able to figure it out all by yourself, big boy wink.gif

 

In all fairness though, its hard to spoonfeed you when you just spit it out all down your bib...

Link to comment
Share on other sites

 

I like to make things confusing... Its kinda what I do around here, y'know?

 

And im glad you were able to figure it out all by yourself, big boy wink.gif

 

In all fairness though, its hard to spoonfeed you when you just spit it out all down your bib...

I lol'd xD

Anyway, I made up a small trainer which is 23kb (smaller then a picture?!)

If I made it in CLEO, it'll be bigger... so there's some advantages.

 

Anyway, this topic has been solved and the thread-starter (yours truly)-

request //lock

P.S. Don't make that confusing aswell.

Link to comment
Share on other sites

You don't have to rewrite every post because you have the anwer.

 

A trainer has no advantages. You need a separete application which means that you have to switch between applications. And in a cleo script this would only take 63 bytes. Not that anyone should wine over a few kB when most people have hard drives of over 300+ gb.

 

And Deji explained it pretty well. Don't complain if you don't get it but read more about the subject. You asked for spoonfeeding and you got it, don't complain because he didn't gave you the answer straight forward.

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