Jump to content

[SA mobile/android] scan and detecting ALL existing pedestrian in the game


askman

Recommended Posts

I`m currently tried to make a project so
I`m looking for a method to detecting ALL ped that currently existed in the game. including grouped gang member or character that spawned/used by another script

 

As far as I know in mobile version, there are well known 3 opcodes to take/return a random ped in street

 

073F: get_actor_in_sphere 4@ 7@ 10@ radius 20.0 with_pedtype_civilian 1 gang 1 criminal/prostitute 1 handle_as 27@ 
08E5: get_actor_in_sphere 27@ 28@ 29@ radius 50.0 handle_as 0@ 
0A3E: unknown_get_actor_in_sphere $72 $73 $74 radius 0.6 0.6 1.0 handle_as 17@ 


but all of these opcodes are unable to take a specific ped like a gang member that formed as a group, or ped that handled by another mod

Ill put the sample using one of these opcode above


{$CLEO .csa}

script_name 'AU'


:N1
wait 0
3@ = -20.0
0208: 4@ = random_float_in_ranges -20.0 20.0 
0209: 5@ = random_int_in_ranges 1 3
if
5@ == 1
jf @ST
3@ = 20.0

 

:ST
wait 0
jump @INIT

 

:INIT

wait 0
04C4: store_coords_to 0@ 1@ 2@ from_actor $PLAYER_ACTOR with_offset 4@ 3@ 0.0 
0A3E: unknown_get_actor_in_sphere 0@ 1@ 2@ radius 25.0 25.0 25.0 handle_as 11@
if
056D:   actor 11@ defined    
jf @N1
0187: 10@ = create_marker_above_actor 11@ 
jump @N1


this code will add a red marker on a ped that normaly walking on the street. but for a reason, the script always fail to detect a gang member that usually formed as a group in the street. same things happen with actor that created/handled by a mod or a mission script resulting their exsistence just skipped from the selection and didn`t have a marker

so my question is there another way to detect that grouped gang member pedestrian or character that spawned/used by another script, because I really need that.

Link to comment
Share on other sites

@askman have you tried this:

while true
    wait 0
    0DD0: 29@ = get_label_addr @_ZN6CPools11ms_pPedPoolE 
    0DD1: 29@ = get_func_addr_by_cstr_name 29@
    0DD8: 29@ = read_mem_addr 29@ size 4 add_ib 0
    29@ += 4
    0DD8: 29@ = read_mem_addr 29@ size 4 add_ib 0 
    for 30@ = 0 to 0x8B00 step 0x100
        0DD8: 31@ = read_mem_addr 29@ size 1 add_ib 0 
        29@ += 1
        if and
            0029:  31@ >= 0 
            001B:  0x80 > 31@
        then 
            005A: 31@ += 30@
            if 056D:   actor 31@ defined
            then
                0321: AS_actor 31@ die_headshotted
            end
        end
    end
end 

:_ZN6CPools11ms_pPedPoolE
hex
    "_ZN6CPools11ms_pPedPoolE" 00
end

???

Link to comment
Share on other sites

On 7/24/2023 at 5:29 PM, Jack said:

@askman have you tried this:

while true
    wait 0
    0DD0: 29@ = get_label_addr @_ZN6CPools11ms_pPedPoolE 
    0DD1: 29@ = get_func_addr_by_cstr_name 29@
    0DD8: 29@ = read_mem_addr 29@ size 4 add_ib 0
    29@ += 4
    0DD8: 29@ = read_mem_addr 29@ size 4 add_ib 0 
    for 30@ = 0 to 0x8B00 step 0x100
        0DD8: 31@ = read_mem_addr 29@ size 1 add_ib 0 
        29@ += 1
        if and
            0029:  31@ >= 0 
            001B:  0x80 > 31@
        then 
            005A: 31@ += 30@
            if 056D:   actor 31@ defined
            then
                0321: AS_actor 31@ die_headshotted
            end
        end
    end
end 

:_ZN6CPools11ms_pPedPoolE
hex
    "_ZN6CPools11ms_pPedPoolE" 00
end

???

thanks @Jack. the script work perfecly well as I needed, but looking at the source code, I have no idea how memory opcodes part actually work. I`m never messing with gta memory addresses yet.


if I`m correct, I can gain access of every function in the game via the string written inside thats hex construct, because I seen a lot of people used this opcode for a various operation.             


I would like to know how its work but the problem is I cannot understand it. is there any guide or tutorial about manipulating gta memory addreses, I would like to learn it

Link to comment
Share on other sites

@askman 

Due to a diferent address positions depending on the game version the string method is much safer:   

0DD0: 29@ = get_label_addr @_ZN6CPools11ms_pPedPoolE 
0DD1: 29@ = get_func_addr_by_cstr_name 29@
0DD8: 29@ = read_mem_addr 29@ size 4 add_ib 0

Usual memry reading:

0DD8: 29@ = read_mem_addr 0x95AC44 size 4 add_ib 0

where 0x95AC44 is _ZN6CPools11ms_pPedPoolE at version 2.10

The code searches the ped pool from the start to the end of it. 

 

On 7/26/2023 at 12:01 PM, askman said:

Is there any guide or tutorial about manipulating gta memory addreses, I would like to learn it

In order to fully understand you need IDA with the public gta database for the android.

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.