#1 15-07-2009 20:47

ATP
Registered: 07-07-2009
Posts: 15
Website

How can I read car ID from Memory?

Hey, How can I read out a Car ID from the Memory?

I tried it in that way:

0@ = 0xB74494 
0A8D: 1@  = read_memory 0@ size 4 virtual_protect 0
1@ += 34
0A8D: 2@ = read_memory 1@ size 2 virtual_protect 0
045A: draw_text_1number 50.0 30.0 GXT 'number' number 2@

I want to read the CarId of the first car in th Pool. But I get "134", and that is no CarID...

I took the adresses from here:
http://www.gtamodding.com/index.php?tit … SA%29#Cars

Offline

#2 16-07-2009 20:21

Seemann
Registered: 07-08-2006
Posts: 2,156

Re: How can I read car ID from Memory?

0xB74494 - Contains a pointer

you read a pointer, so you need to get the address from it

0A8D: 1@  = read_memory 0xB74494 size 4 virtual_protect 0 // read ptr
0A8D: 1@  = read_memory 1@ size 4 virtual_protect 0 // get the 1st vehicle address
1@ += 34
0A8D: 2@ = read_memory 1@ size 2 virtual_protect 0
045A: draw_text_1number 50.0 30.0 GXT 'number' number 2@

Offline

#3 17-07-2009 09:29

ATP
Registered: 07-07-2009
Posts: 15
Website

Re: How can I read car ID from Memory?

Ok thanks, that works.
I tried to read out the XYZ Position, but I always get 0, any idea why?
here is my test to get X:

0A8D: 3@  = read_memory 0xB74494 size 4 virtual_protect 0 // read ptr
0A8D: 3@  = read_memory 3@ size 4 virtual_protect 0 // get the 1st vehicle address
3@ += 20
0A8D: 4@  = read_memory 3@ size 4 virtual_protect 0 // read Matrix ptr
4@ += 48
0A8D: 5@  = read_memory 4@ size 4 virtual_protect 0 // get X
0092: 6@ = float 5@ to_integer 
045A: draw_text_1number 50.0 40.0 GXT 'number' number 6@

Last edited by ATP (17-07-2009 09:31)

Offline

#4 17-07-2009 17:18

Seemann
Registered: 07-08-2006
Posts: 2,156

Re: How can I read car ID from Memory?

Try this

0A8D: 5@  = read_memory 4@ size 4 virtual_protect 0 // get X
5@ *= 100.0
0092: 6@ = float 5@ to_integer 
6@ /= 100
045A: draw_text_1number 50.0 40.0 GXT 'number' number 6@

Offline

#5 22-07-2009 13:54

ATP
Registered: 07-07-2009
Posts: 15
Website

Re: How can I read car ID from Memory?

I have another question, is it possible to use that car like a car that is created by SCM? I mean, how can I get that car to a variable?

Offline

#6 25-07-2009 22:23

Seemann
Registered: 07-08-2006
Posts: 2,156

Re: How can I read car ID from Memory?

There's a function that converts car pointer to the handle. I used it in this script

    0A8D: 1@ = read_memory 0x00B74494 size 4 virtual_protect 0
    0AA8: call_function_method 0x00424160 struct 1@ num_params 1 pop 0 0@ 1@

0@ - input pointer
1@ - output handle

Offline

Board footer

Powered by FluxBB