Jump to content

Change cop’s weapon in gta sa mobile


Dark-Silva

Recommended Posts

While there are plenty of cleos for changing police weapons on the PC side, there are hardly any mobile counterparts.

I currently have a cleo that does this, but it has a flaw: it can only change the weapons of some of the cops that spawn on the road and the SWATs that get off the helicopter, but not everyone who comes out of the vehicle ( Including the police, SWAT, and FBI, only one of them may change his weapon). If possible, I need an Android cleo that can change police weapons and wanted systems similar to gta 5: the highest wanted level is five (like gta 5), and police officers of lspd, sfpd and lvpd start using it when they are wanted at level three Mini uzi, swat/FBI start to use mp5 and m4 when wanted at level 4, and the army will appear at wanted level 5).

I know my assumptions are not realistic. So for the time being, I just want to change the cop's weapon, trouble master can help me.

The following is the source code of cleo that I use:

 

// This file was decompiled using SASCM.ini published on 2021-01-30

{$CLEO .csa}

 

03A4: script_name 'AI100'

 

:AI100_11

0001: wait 0 ms

00A0: store_actor $PLAYER_ACTOR position_to 4@ 5@ 6@

0A3E: unknown_get_actor_in_sphere 4@ 5@ 6@ radius 25.5 25.5 25.5 handle_as 0@

00D6: if

056D: actor 0@ defined

004D: jump_if_false @AI100_11

0002: jump @AI100_81

 

:AI100_81

00D6: if or

02F2: actor 0@ model == #LAPD1

02F2: actor 0@ model == #SFPD1

02F2: actor 0@ model == #LVPD1

02F2: actor 0@ model == #CSHER

004D: jump_if_false @AI100_136

0247: load_model #MP5LNG

0002: jump @AI100_198

 

:AI100_136

00D6: if

02F2: actor 0@ model == #FBI

004D: jump_if_false @AI100_167

0247: load_model #SNIPER

0002: jump @AI100_268

 

:AI100_167

00D6: if

02F2: actor 0@ model == #SWAT

004D: jump_if_false @AI100_11

0247: load_model #M4

0002: jump @AI100_299

 

:AI100_198

00D6: if

010F: player $PLAYER_CHAR wanted_level > 2

004D: jump_if_false @AI100_223

0002: jump @AI100_237

 

:AI100_223

081A: set_actor 0@ weapon_skill_to 1

0002: jump @AI100_11

 

:AI100_237

081A: set_actor 0@ weapon_skill_to 2

01B2: give_actor 0@ weapon 29 ammo 1800 // Load the weapon model before using this

01B9: set_actor 0@ armed_weapon_to 29

0002: jump @AI100_11

 

:AI100_268

081A: set_actor 0@ weapon_skill_to 2

01B2: give_actor 0@ weapon 34 ammo 150 // Load the weapon model before using this

01B9: set_actor 0@ armed_weapon_to 34

0002: jump @AI100_11

 

:AI100_299

081A: set_actor 0@ weapon_skill_to 2

0446: set_actor 0@ dismemberment_possible 1

01B2: give_actor 0@ weapon 31 ammo 1500 // Load the weapon model before using this

01B9: set_actor 0@ armed_weapon_to 31

0002: jump @AI100_337

 

:AI100_337

034F:remove_char_elegantly actor 0@

0002: jump @AI100_11

 

Link to comment
Share on other sites

On 4/22/2023 at 7:53 AM, Dark-Silva said:

... the highest wanted level is five (like gta 5)...

Changing ped weapons is relatively easy. However making 5 stars instead of 6 might be tricky 'cause it's "hardcoded" so lets focus on that problem first (untested):

{$CLEO .csa}

03A4: script_name 'AI100' 
0DD0: 0@ = get_label_addr @_ZN17CWidgetPlayerInfo10DrawWantedEv
0DD1: get_func_addr_by_cstr_name 0@ = get_func_addr_by_cstr_name 0@ 
0@ += 0x14A 
0DD8: 1@ = read_mem_addr 0@ size 4 add_ib 0 
if  1@ == 0x0F06F1BA //  CMP.W R10,#6    //  1.08 
jf @AI100_97 
0@ += 2 
0DD9: write_mem_addr 0@ value 5 size 1 add_ib 0 protect 0 
jump @AI100_97 

:AI100_97
004E: terminate_this_custom_script 

:_ZN17CWidgetPlayerInfo10DrawWantedEv
hex
    "_ZN17CWidgetPlayerInfo10DrawWantedEv" 00
end

I don't use the android device for gaming so beta tester is needed.

Edited by Jack
Link to comment
Share on other sites

7 hours ago, Jack said:

更换ped武具相对容易。然而,制造5颗星而不是6颗颗星可能会很刺手,因为它是“硬编码”的,所以让我们首先注意这个问题(冒昧)

 

我不使用 Android 设备游戏,因此需要 Beta 测试人员。

非常感谢您的回复,我用sunny builder编译了您的脚本,在游戏中似乎不起作用,但我还是很感谢您的努力。

另外请教一下如何通过换ped来换警察的武器,对于我这样的菜鸟来说,这个工作太坑爹了。

Edited by Dark-Silva
Link to comment
Share on other sites

7 hours ago, Jack said:

Changing ped weapons is relatively easy. However making 5 stars instead of 6 might be tricky 'cause it's "hardcoded" so lets focus on that problem first (untested):

{$CLEO .csa}

03A4: script_name 'AI100' 
0DD0: 0@ = get_label_addr @_ZN17CWidgetPlayerInfo10DrawWantedEv
0DD1: get_func_addr_by_cstr_name 0@ = get_func_addr_by_cstr_name 0@ 
0@ += 0x14A 
0DD8: 1@ = read_mem_addr 0@ size 4 add_ib 0 
if  1@ == 0x0F06F1BA //  CMP.W R10,#6    //  1.08 
jf @AI100_97 
0@ += 2 
0DD9: write_mem_addr 0@ value 5 size 1 add_ib 0 protect 0 
jump @AI100_97 

:AI100_97
004E: terminate_this_custom_script 

:_ZN17CWidgetPlayerInfo10DrawWantedEv
hex
    "_ZN17CWidgetPlayerInfo10DrawWantedEv" 00
end

I don't use the android device for gaming so beta tester is needed.

Thank you very much for your reply, I compiled your script with sunny builder, it doesn't seem to work in the game, but I still appreciate your effort.

Also, please tell me how to change the weapons of the police by changing the ped, for a rookie like me, this job is too tricky.

Link to comment
Share on other sites

My best guess for SA Android 2.00 FLA.

{$CLEO .csa}

03A4: script_name 'AI100' 
0DD0: 0@ = get_label_addr @_ZN17CWidgetPlayerInfo10DrawWantedEv
0DD1: get_func_addr_by_cstr_name 0@ = get_func_addr_by_cstr_name 0@ 
0@ += 0x296 
//0DD8: 1@ = read_mem_addr 0@ size 4 add_ib 0 
//if  1@ == 0x0F06F1BA //  CMP.W R10,#6    //  1.08 
//if  1@ == // don't know, print it out on screen if this works //  CMP.W R9,#6    //  v2.00 FLA
//jf @AI100_97 
0@ += 2 
0DD9: write_mem_addr 0@ value 5 size 1 add_ib 0 protect 0 
jump @AI100_97 

:AI100_97
004E: terminate_this_custom_script 

:_ZN17CWidgetPlayerInfo10DrawWantedEv
hex
    "_ZN17CWidgetPlayerInfo10DrawWantedEv" 00
end

 

Link to comment
Share on other sites

1 hour ago, OrionSR said:

My best guess for SA Android 2.00 FLA.

{$CLEO .csa}

03A4: script_name 'AI100' 
0DD0: 0@ = get_label_addr @_ZN17CWidgetPlayerInfo10DrawWantedEv
0DD1: get_func_addr_by_cstr_name 0@ = get_func_addr_by_cstr_name 0@ 
0@ += 0x296 
//0DD8: 1@ = read_mem_addr 0@ size 4 add_ib 0 
//if  1@ == 0x0F06F1BA //  CMP.W R10,#6    //  1.08 
//if  1@ == // don't know, print it out on screen if this works //  CMP.W R9,#6    //  v2.00 FLA
//jf @AI100_97 
0@ += 2 
0DD9: write_mem_addr 0@ value 5 size 1 add_ib 0 protect 0 
jump @AI100_97 

:AI100_97
004E: terminate_this_custom_script 

:_ZN17CWidgetPlayerInfo10DrawWantedEv
hex
    "_ZN17CWidgetPlayerInfo10DrawWantedEv" 00
end

 

Also thanks for your help.

Sorry, but your script also doesn't make the cops use the target weapon.

I think the problem may be with the script I am using, it only works on one of the cops in a certain range, or maybe there is a problem with my version of the game.

Maybe I should rewrite or change the script, but there are almost no scripts in this series on Android at present, and I can hardly write a reliable script myself.

Link to comment
Share on other sites

@Dark-Silva Our scripts are made to decrease the number of stars on the screen down to 5. How many stars do you have after compiling those codes?

EDIT: I thought the "offset" to the address is the same - obviosly I was wrong which is a problem. 

Lets try this:

{$CLEO .csa}
03A4: script_name 'AI100'

while true
    wait 0
    0DD0: 0@ = get_label_addr @_ZN17CWidgetPlayerInfo10DrawWantedEv
    0DD1: 0@ = get_func_addr_by_cstr_name 0@
    0085: 2@ = 0@
    2@ += 0x2F0 //  fncSize
    for 1@ = 0@ to 2@ step 1
        0DD8: 3@ = read_mem_addr 1@ size 4 add_ib 0  //  Ops, I forgot to read it first 
        if 3@ == 0x0F06F1BA
        then        
            1@ += 2
            0DD9: write_mem_addr 1@ value 5 size 1 add_ib 0 protect 0 //  0x27D9F2  1.08
break
        end  
    end
end

004E: terminate_this_custom_script 
 
:_ZN17CWidgetPlayerInfo10DrawWantedEv   //  0x27D8A8    1.08
hex
    "_ZN17CWidgetPlayerInfo10DrawWantedEv" 00
end
Edited by Jack
Link to comment
Share on other sites

36 minutes ago, Jack said:

@Dark-Silva Our scripts are made to decrease the number of stars on the screen down to 5. How many stars do you have after compiling those codes?

EDIT: I thought the "offset" to the address is the same - obviosly I was wrong which is a problem. 

Lets try this:

{$CLEO .csa}
03A4: script_name 'AI100'

while true
    wait 0
    0DD0: 0@ = get_label_addr @_ZN17CWidgetPlayerInfo10DrawWantedEv
    0DD1: 0@ = get_func_addr_by_cstr_name 0@
    0085: 2@ = 0@
    2@ += 0x2F0 //  fncSize
    for 1@ = 0@ to 2@ step 1
        0DD8: 3@ = read_mem_addr 1@ size 4 add_ib 0  //  Ops, I forgot to read it first 
        if 3@ == 0x0F06F1BA
        then        
            1@ += 2
            0DD9: write_mem_addr 1@ value 5 size 1 add_ib 0 protect 0 //  0x27D9F2  1.08
break
        end  
    end
end

004E: terminate_this_custom_script 
 
:_ZN17CWidgetPlayerInfo10DrawWantedEv   //  0x27D8A8    1.08
hex
    "_ZN17CWidgetPlayerInfo10DrawWantedEv" 00
end

I'm sorry to tell you that your script didn't come in handy, the wanted level is still level 6, maybe there is something wrong with my gta sa version

Link to comment
Share on other sites

Version is exactly the problem we're trying to get rid of by reading function addresses based on their names. Anyway try this:

{$CLEO .csa}
03A4: script_name 'AI100'

0DD0: 0@ = get_label_addr @_ZN17CWidgetPlayerInfo10DrawWantedEv
0DD1: 0@ = get_func_addr_by_cstr_name 0@
0DD0: 1@ = get_label_addr @_ZN17CWidgetPlayerInfo4DrawEv
0DD1: 1@ = get_func_addr_by_cstr_name 1@

//  CMP instruction
for 2@ = 0@ to 1@ step 1
    0DD8: 3@ = read_mem_addr 2@ size 2 add_ib 0
    if and
        3@ >= 0x2806    //  CMP R0, #6
        0x2F06 > 3@     //  CMP R15, #6
    then
        0DD9: write_mem_addr 2@ value 5 size 1 add_ib 0 protect 0 //  0x27D9F2  1.08
break   
    end
end

//  CMP.W instruction
for 2@ = 0@ to 1@ step 1
    0085: 4@ = 2@
    0DD8: 3@ = read_mem_addr 4@ size 2 add_ib 0
    if 3@ == 0x0F06
    then
        0085: 4@ = 2@
        4@ += 2
        0DD8: 3@ = read_mem_addr 4@ size 2 add_ib 0   
        if and 
            3@ >= 0xF1B0    //  CMP.W R0, #6
            0xF1BF > 3@     //  CMP.W R15, #6
        then   
            2@ += 2
            0DD9: write_mem_addr 2@ value 5 size 1 add_ib 0 protect 0 //  0x27D9F2  1.08
break       
        end
    end 
end      

004E: terminate_this_custom_script 
 
:_ZN17CWidgetPlayerInfo10DrawWantedEv   //  0x27D8A8    1.08
hex
    "_ZN17CWidgetPlayerInfo10DrawWantedEv" 00
end

:_ZN17CWidgetPlayerInfo4DrawEv
hex
    "_ZN17CWidgetPlayerInfo4DrawEv" 00
end

EDIT: If it's still not working try changing {CLEO .csa} to {CLEO .csi}

Edited by Jack
Link to comment
Share on other sites

13 hours ago, Jack said:

Version is exactly the problem we're trying to get rid of by reading function addresses based on their names. Anyway try this:

{$CLEO .csa}
03A4: script_name 'AI100'

0DD0: 0@ = get_label_addr @_ZN17CWidgetPlayerInfo10DrawWantedEv
0DD1: 0@ = get_func_addr_by_cstr_name 0@
0DD0: 1@ = get_label_addr @_ZN17CWidgetPlayerInfo4DrawEv
0DD1: 1@ = get_func_addr_by_cstr_name 1@

//  CMP instruction
for 2@ = 0@ to 1@ step 1
    0DD8: 3@ = read_mem_addr 2@ size 2 add_ib 0
    if and
        3@ >= 0x2806    //  CMP R0, #6
        0x2F06 > 3@     //  CMP R15, #6
    then
        0DD9: write_mem_addr 2@ value 5 size 1 add_ib 0 protect 0 //  0x27D9F2  1.08
break   
    end
end

//  CMP.W instruction
for 2@ = 0@ to 1@ step 1
    0085: 4@ = 2@
    0DD8: 3@ = read_mem_addr 4@ size 2 add_ib 0
    if 3@ == 0x0F06
    then
        0085: 4@ = 2@
        4@ += 2
        0DD8: 3@ = read_mem_addr 4@ size 2 add_ib 0   
        if and 
            3@ >= 0xF1B0    //  CMP.W R0, #6
            0xF1BF > 3@     //  CMP.W R15, #6
        then   
            2@ += 2
            0DD9: write_mem_addr 2@ value 5 size 1 add_ib 0 protect 0 //  0x27D9F2  1.08
break       
        end
    end 
end      

004E: terminate_this_custom_script 
 
:_ZN17CWidgetPlayerInfo10DrawWantedEv   //  0x27D8A8    1.08
hex
    "_ZN17CWidgetPlayerInfo10DrawWantedEv" 00
end

:_ZN17CWidgetPlayerInfo4DrawEv
hex
    "_ZN17CWidgetPlayerInfo4DrawEv" 00
end

EDIT: If it's still not working try changing {CLEO .csa} to {CLEO .csi}

Sorry to tell you that this script still doesn't work (I've tried both csa and csi formats), but thank you for everything.

Maybe you can try to see if the script you compiled is running normally to rule out the problem of my game version (due to the system problem of my mobile phone, my game version seems to only support cleo).

Currently I think a script that modifies the cops' weapons makes more sense and is more likely to succeed.

Link to comment
Share on other sites

On 4/22/2023 at 7:53 AM, Dark-Silva said:

it can only change the weapons of some of the cops that spawn on the road and the SWATs that get off the helicopter, but not everyone who comes out of the vehicle ( Including the police, SWAT, and FBI, only one of them may change his weapon). 

That's probably because the code constantly changes weapons to the actors which already recieved a new weapon. You need to mark the armed actors somehow. Change their health or example:

0AB1: cleo_call @changeActorWeapon num_params 3 handle 31@ weapon 30 ammo 9999  //  example with ak47
:changeActorWeapon
//  0@ handle;  1@ weaponID;    2@ ammo
if 82D8: NOT actor 0@ current_weapon == 1@
then    
    0226: 4@ = actor 0@ health
    if 4@ == 100    //  default actor health
    then
        if 1@ <> 0 
        then  
            0781: get_weapon_with_ID 1@ model_to 3@
            if 0248:   model 3@ available
            then
                01B2: give_actor 0@ weapon 1@ ammo 2@
                01B9: set_actor 0@ armed_weapon_to 1@
                0223: set_actor 0@ health_to 99 //  actor has been marked  
            else
                0247: load_model 3@
                038B: load_requested_models
            end
        else
            01B2: give_actor 0@ weapon 0 ammo 0
            01B9: set_actor 0@ armed_weapon_to 0
            0223: set_actor 0@ health_to 99 //  actor has been marked  
        end
    end
end
0AB2: cleo_return 0 

Decompile if you want to to get a standard code like in decompiled main.scm.
PS: I don't have a solution for the number of stars for now.

 

EDIT:

@Dark-Silva 0AB1 is not supported by the android - use the rest of the code:

:mainLoop
    wait 0 
    00A0: store_actor $PLAYER_ACTOR position_to 4@ 5@ 6@
    0A3E: unknown_get_actor_in_sphere 4@ 5@ 6@ radius 25.5 25.5 25.5 handle_as 0@ 
    if 056D:   actor 0@ defined 
    jf @gotoMainLoop 
    1@ = 30 
    if 82D8:   not actor 0@ current_weapon == 1@ 
    jf @gotoMainLoop 
    0226: 7@ = actor 0@ health
    if 7@ == 100    //  default actor health 
    jf @gotoMainLoop 
    if not 1@ == 0 
    jf @disarmActor 
    0781: get_weapon_with_ID 1@ model_to 3@ 
    if  0248:   model 3@ available
    jf @loadModel 
    01B2: give_actor 0@ weapon 1@ ammo 2@
    01B9: set_actor 0@ armed_weapon_to 1@ 
    0223: set_actor 0@ health_to 99 //  actor has been marked  
    jump @procedToTheNextOne 
    
    :loadModel
    0247: load_model 3@
    038B: load_requested_models
    :procedToTheNextOne
    jump @gotoMainLoop 
    
    :disarmActor
    01B2: give_actor 0@ weapon 0 ammo 0
    01B9: set_actor 0@ armed_weapon_to 0 
    0223: set_actor 0@ health_to 99 //  actor has been marked  
    
    :gotoMainLoop
jump @mainLoop 

Regarding my previous code replace all "add_ib 0 protect 0" with "add_ib 1 protect 1". Maybe that will help.

Edited by Jack
Link to comment
Share on other sites

Please excuse my stupidity, since I don't know c language, I can't quite understand your script. I made some changes on it (probably wrong), but still can't make it work in the game (I want swat to equip m4 and set their health to 200), I don't know if it's the original script or My stupid modification.
If you can, I hope you can help me set up this script as a template for my reference.

16 hours ago, Jack said:

That's probably because the code constantly changes weapons to the actors which already recieved a new weapon. You need to mark the armed actors somehow. Change their health or example:

0AB1: cleo_call @changeActorWeapon num_params 3 handle 31@ weapon 30 ammo 9999  //  example with ak47
:changeActorWeapon
//  0@ handle;  1@ weaponID;    2@ ammo
if 82D8: NOT actor 0@ current_weapon == 1@
then    
    0226: 4@ = actor 0@ health
    if 4@ == 100    //  default actor health
    then
        if 1@ <> 0 
        then  
            0781: get_weapon_with_ID 1@ model_to 3@
            if 0248:   model 3@ available
            then
                01B2: give_actor 0@ weapon 1@ ammo 2@
                01B9: set_actor 0@ armed_weapon_to 1@
                0223: set_actor 0@ health_to 99 //  actor has been marked  
            else
                0247: load_model 3@
                038B: load_requested_models
            end
        else
            01B2: give_actor 0@ weapon 0 ammo 0
            01B9: set_actor 0@ armed_weapon_to 0
            0223: set_actor 0@ health_to 99 //  actor has been marked  
        end
    end
end
0AB2: cleo_return 0 

Decompile if you want to to get a standard code like in decompiled main.scm.
PS: I don't have a solution for the number of stars for now.

 

EDIT:

@Dark-Silva 0AB1 is not supported by the android - use the rest of the code:

:mainLoop
    wait 0 
    00A0: store_actor $PLAYER_ACTOR position_to 4@ 5@ 6@
    0A3E: unknown_get_actor_in_sphere 4@ 5@ 6@ radius 25.5 25.5 25.5 handle_as 0@ 
    if 056D:   actor 0@ defined 
    jf @gotoMainLoop 
    1@ = 30 
    if 82D8:   not actor 0@ current_weapon == 1@ 
    jf @gotoMainLoop 
    0226: 7@ = actor 0@ health
    if 7@ == 100    //  default actor health 
    jf @gotoMainLoop 
    if not 1@ == 0 
    jf @disarmActor 
    0781: get_weapon_with_ID 1@ model_to 3@ 
    if  0248:   model 3@ available
    jf @loadModel 
    01B2: give_actor 0@ weapon 1@ ammo 2@
    01B9: set_actor 0@ armed_weapon_to 1@ 
    0223: set_actor 0@ health_to 99 //  actor has been marked  
    jump @procedToTheNextOne 
    
    :loadModel
    0247: load_model 3@
    038B: load_requested_models
    :procedToTheNextOne
    jump @gotoMainLoop 
    
    :disarmActor
    01B2: give_actor 0@ weapon 0 ammo 0
    01B9: set_actor 0@ armed_weapon_to 0 
    0223: set_actor 0@ health_to 99 //  actor has been marked  
    
    :gotoMainLoop
jump @mainLoop 

Regarding my previous code replace all "add_ib 0 protect 0" with "add_ib 1 protect 1". Maybe that will help.

Please excuse my stupidity, since I don't know c language, I can't quite understand your script. I made some changes on it (probably wrong), but still can't make it work in the game (I want swat to equip m4 and set their health to 200), I don't know if it's the original script or My stupid modification.
If you can, I hope you can help me set up this script as a template for my reference.

Below is my modified script:

 

:mainLoop

    wait 0 

    00A0: store_actor $PLAYER_ACTOR position_to 4@ 5@ 6@

    0A3E: unknown_get_actor_in_sphere 4@ 5@ 6@ radius 25.5 25.5 25.5 handle_as 0@ 

    02F2:actor 0@ meoldel == #swat                    

    if 056D: actor 0@ defined 

    jf @gotoMainLoop 

    1@ = #MICRO_UZI 

    3@ = #m4

    if 82D8: not actor 0@ current_weapon == 1@ 

    jf @gotoMainLoop 

    0226: 7@ = actor 0@ health

    if 7@ == 150 // default actor health 

    jf @gotoMainLoop 

    if not 1@ == 0 

    jf @disarmActor 

    0781: get_weapon_with_ID 1@ model_to 3@ 

    if 0248: model 3@ available

    jf @loadModel 

    01B2: give_actor 0@ weapon #m4 ammo 114514

    01B9: set_actor 0@ armed_weapon_to #M4 

    0223: set_actor 0@ health_to 200 // actor has been marked  

    jump @procedToTheNextOne 

    

    :loadModel

    0247: load_model 3@

    038B: load_requested_models

    :procedToTheNextOne

    jump @gotoMainLoop 

    

    :disarmActor

    01B2: give_actor 0@ weapon 31 ammo 114514

    01B9: set_actor 0@ armed_weapon_to 31 

    0223: set_actor 0@ health_to 200 // actor has been marked  

    

    :gotoMainLoop

jump @mainLoop 

Link to comment
Share on other sites

@Dark-Silva 

I've just realized that the opcode 0A3E is not always functional. Try the bellow code (swat with m4 and health of 200): 

{$CLEO .csa}


03A4: script_name 'AI100'



0247: load_model #M4
038B: load_requested_models 



while true
    wait 0
    if 0248:   model #M4 available 
    then
break
    end
end

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   //  remove this line if not working 
    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 8118:   not actor 31@ dead 
            then
                if 02F2:   actor 31@ model == #SWAT 
                then
                    if 82D8: NOT actor 31@ current_weapon == 31
                    then
                        01B2: give_actor 31@ weapon 31 ammo 9999
                        01B9: set_actor 31@ armed_weapon_to 31
                        0223: set_actor 31@ health_to 200 
                    end
                end
            end
        end
    end
end

:_ZN6CPools11ms_pPedPoolE
hex
    "_ZN6CPools11ms_pPedPoolE" 00
end

 

Edited by Jack
Link to comment
Share on other sites

I'm wondering if this Police Weapon strategy for PC can be adapted to mobile. The idea is to change the constants used when spawning cops as the wanted level changes. I haven't even tested the script shown, though.

 

@Dark-Silva What version of SA Mobile are you running?

0DD6: 0@ = get_game_version // android 

Actually, I'm not sure which version is which by number. Not many people use 1.08 anymore. Is 2.00 FLA the latest Cleo version?

Edited by OrionSR
Link to comment
Share on other sites

12 hours ago, Jack said:

@Dark-Silva 

I've just realized that the opcode 0A3E is not always functional. Try the bellow code (swat with m4 and health of 200): 

{$CLEO .csa}


03A4: script_name 'AI100'



0247: load_model #M4
038B: load_requested_models 



while true
    wait 0
    if 0248:   model #M4 available 
    then
break
    end
end

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   //  remove this line if not working 
    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 8118:   not actor 31@ dead 
            then
                if 02F2:   actor 31@ model == #SWAT 
                then
                    if 82D8: NOT actor 31@ current_weapon == 31
                    then
                        01B2: give_actor 31@ weapon 31 ammo 9999
                        01B9: set_actor 31@ armed_weapon_to 31
                        0223: set_actor 31@ health_to 200 
                    end
                end
            end
        end
    end
end

:_ZN6CPools11ms_pPedPoolE
hex
    "_ZN6CPools11ms_pPedPoolE" 00
end

 

Thank you very much for your efforts. Your script runs almost perfectly on the Android version. It successfully generated SWAT that meets the needs. Thank you for your help to solve the problem that has been confusing me!

However, this also caused strange phenomena in some missions. For example, in the mission "Reorganize the Gang", the generated SWAT (using m4 and with a blood volume of 200) was consistent with the one in the script, not the original system (in the original mission, the SWAT used mp5 And the blood volume is the normal wanted blood volume).

This increase in difficulty is a very interesting change for the Android version. I personally like it very much. After all, this kind of SWAT is more in line with the strength of V-generation or real SWAT.

However, I am still thinking about how to change the data of the enforcer driven by SWATs. Handling can make it have the same performance and impact resistance as the V generation, but it cannot resist some firearm damage like the V generation. Or maybe I should replace the SWAT vehicles with fib grangers and replace the four person team with the same three person team as the V generation, but I don't expect them to carry two people on the side of the car and use the pistol like the V generation Shooting (this may require a series of scripts and animation mods, cumbersome and easy game crashes)

I have a bold idea, to assemble the wanted system of the v generation into sa, the pc side seems to be able to achieve the goal through wanted modifiers/scripts, but on the android side. . . I don't hold out hope.

Perhaps a light imitation is still feasible, such as balancing SWAT and FBI in the wanted system, maybe the FBI and SWAT can be generated at level 4 wanted, and only SWAT can be generated at five stars? ………

Thanks for all your hard work, maybe I should give you what you need? ...

PS: Maybe you can go to the gtainside/gtaall website to publish your scripts, I believe this will be very exciting news for most Android players!

10 hours ago, OrionSR said:

I'm wondering if this Police Weapon strategy for PC can be adapted to mobile. The idea is to change the constants used when spawning cops as the wanted level changes. I haven't even tested the script shown, though.

 

@Dark-Silva What version of SA Mobile are you running?

0DD6: 0@ = get_game_version // android 

Actually, I'm not sure which version is which by number. Not many people use 1.08 anymore. Is 2.00 FLA the latest Cleo version?

emmmmm... My version seems to be a modified version of Android 2.0, which supports cleo and Chinese components.
Due to the damn Huawei mobile phone system update, the Hongmeng system prevents my phone from running apk that supports fla and multi-threading. I can only use the modified version.

Link to comment
Share on other sites

On 4/27/2023 at 2:48 AM, Dark-Silva said:

However, this also caused strange phenomena in some missions. For example, in the mission "Reorganize the Gang", the generated SWAT (using m4 and with a blood volume of 200) was consistent with the one in the script, not the original system (in the original mission, the SWAT used mp5 And the blood volume is the normal wanted blood volume).

There's a method to determine if an actor is created by the game or a mission:

0DD0: 0@ = get_label_addr @_ZN6CPools6GetPedEi
0DD1: 0@ = get_func_addr_by_cstr_name 0@
0DD3: context_set_reg 0 value 31@
0DD2: context_call_func 0@
0DD4: 1@ = context_get_reg 0
1@ += 0x444
0DD8: 1@ = read_mem_addr 1@ size 1 add_ib 0
if 1@ == 1  //  gameCreatedPed
then
  //  31@ - non mission ped
end

:_ZN6CPools6GetPedEi
hex
    "_ZN6CPools6GetPedEi" 00
end

Basicly the 1st five lines are actually 0A96 but in the mobile version.

 

Also most of the cop peds used in missions are defined as CIVMALE (value 4) so easier method would be to simply check pedtype of an actor. If it's not 6 (which is COP) there's a good chance that it's not been used in missions so:

if 02F2:   actor 31@ model == #SWAT 
then  
    089F: get_actor 31@ pedtype_to 1@
    if 1@ <> 6
        //  mission cop
    else
        //  pedtype 6 ---> non mission cop  
    end
end 

but the 1st method is a 100% secure and it can definetely tell if it's a game or a script actor.
 

Edited by Jack
Link to comment
Share on other sites

On 2023/4/28 at AM1点41分, Jack said:

有一种方法可以确定演员是由游戏还是任务创建的:


基本上前五行实际上是 0A96 但在移动版本中。

 

此外,任务中使用的大多数警察都被定义为 CIVMALE(值 4),因此更简单的方法是简单地检查演员的 pedtype。如果它不是 6(这是 COP),那么它很可能没有在任务中使用过:

但是第一种方法是 100% 安全的,它可以明确地判断它是游戏还是脚本演员。
 

This is an interesting test, but I don't know how to view the test results.

Since your script has met my needs, I am currently focusing on other aspects of the wanted system, such as my above-mentioned settings. Thank you very much for your contribution

On 4/28/2023 at 1:41 AM, Jack said:

There's a method to determine if an actor is created by the game or a mission:

0DD0: 0@ = get_label_addr @_ZN6CPools6GetPedEi
0DD1: 0@ = get_func_addr_by_cstr_name 0@
0DD3: context_set_reg 0 value 31@
0DD2: context_call_func 0@
0DD4: 1@ = context_get_reg 0
1@ += 0x444
0DD8: 1@ = read_mem_addr 1@ size 1 add_ib 0
if 1@ == 1  //  gameCreatedPed
then
  //  31@ - non mission ped
end

:_ZN6CPools6GetPedEi
hex
    "_ZN6CPools6GetPedEi" 00
end

Basicly the 1st five lines are actually 0A96 but in the mobile version.

 

Also most of the cop peds used in missions are defined as CIVMALE (value 4) so easier method would be to simply check pedtype of an actor. If it's not 6 (which is COP) there's a good chance that it's not been used in missions so:

if 02F2:   actor 31@ model == #SWAT 
then  
    089F: get_actor 31@ pedtype_to 1@
    if 1@ <> 6
        //  mission cop
    else
        //  pedtype 6 ---> non mission cop  
    end
end 

but the 1st method is a 100% secure and it can definetely tell if it's a game or a script actor.
 

This is an interesting test, but I don't know how to view the test results.
Since your script has met my needs, I am currently focusing on other aspects of the wanted system, such as my above-mentioned settings. Thank you very much for your contribution.

Link to comment
Share on other sites

6 hours ago, Dark-Silva said:

I don't know how to view the test results.

Mission swat won't be armed the m4 firearm (only those who came from the 4th wanted star and helicopter rope):

Spoiler
{$CLEO .csa}
03A4: script_name 'AI100'

0247: load_model #M4
038B: load_requested_models 

while true
    wait 0
    if 0248:   model #M4 available 
    then
break
    end
end

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@
            
            //--------------------------------------------
            0DD0: 0@ = get_label_addr @_ZN6CPools6GetPedEi
            0DD1: 0@ = get_func_addr_by_cstr_name 0@
            0DD3: context_set_reg 0 value 31@
            0DD2: context_call_func 0@
            0DD4: 1@ = context_get_reg 0
            1@ += 0x444
            0DD8: 1@ = read_mem_addr 1@ size 1 add_ib 0
            if 1@ == 1  //  gameCreatedPed
            then
            //--------------------------------------------    
                //  31@ - non mission ped   
                if 8118:   not actor 31@ dead 
                then
                    if 02F2:   actor 31@ model == #SWAT 
                    then
                        if 82D8: NOT actor 31@ current_weapon == 31
                        then
                            01B2: give_actor 31@ weapon 31 ammo 9999
                            01B9: set_actor 31@ armed_weapon_to 31
                            0223: set_actor 31@ health_to 200 
                        end
                    end
                end
                
                
            else
                if 1@ == 2  //  scriptCreatedPed
                then
                    //  31@ - mission ped
                end
            end
              
        end
    end
end

:_ZN6CPools11ms_pPedPoolE
hex
    "_ZN6CPools11ms_pPedPoolE" 00
end

:_ZN6CPools6GetPedEi
hex
    "_ZN6CPools6GetPedEi" 00
end 

 

 

Link to comment
Share on other sites

Dark-Silva
On 4/30/2023 at 5:00 PM, Jack said:

Mission swat won't be armed the m4 firearm (only those who came from the 4th wanted star and helicopter rope):

  Hide contents
{$CLEO .csa}
03A4: script_name 'AI100'

0247: load_model #M4
038B: load_requested_models 

while true
    wait 0
    if 0248:   model #M4 available 
    then
break
    end
end

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@
            
            //--------------------------------------------
            0DD0: 0@ = get_label_addr @_ZN6CPools6GetPedEi
            0DD1: 0@ = get_func_addr_by_cstr_name 0@
            0DD3: context_set_reg 0 value 31@
            0DD2: context_call_func 0@
            0DD4: 1@ = context_get_reg 0
            1@ += 0x444
            0DD8: 1@ = read_mem_addr 1@ size 1 add_ib 0
            if 1@ == 1  //  gameCreatedPed
            then
            //--------------------------------------------    
                //  31@ - non mission ped   
                if 8118:   not actor 31@ dead 
                then
                    if 02F2:   actor 31@ model == #SWAT 
                    then
                        if 82D8: NOT actor 31@ current_weapon == 31
                        then
                            01B2: give_actor 31@ weapon 31 ammo 9999
                            01B9: set_actor 31@ armed_weapon_to 31
                            0223: set_actor 31@ health_to 200 
                        end
                    end
                end
                
                
            else
                if 1@ == 2  //  scriptCreatedPed
                then
                    //  31@ - mission ped
                end
            end
              
        end
    end
end

:_ZN6CPools11ms_pPedPoolE
hex
    "_ZN6CPools11ms_pPedPoolE" 00
end

:_ZN6CPools6GetPedEi
hex
    "_ZN6CPools6GetPedEi" 00
end 

 

 

Sorry for not getting back to you until now due to the damn exam.

After testing, the script did not play a role in the game, and the game still generates the corresponding characters according to the system standard (that is, SWAT in normal state still uses uzi, SWAT in missions uses mp5, and the lives of both are the same).

Perhaps some commands of some scripts are not recognized? ………

Link to comment
Share on other sites

7 hours ago, Dark-Silva said:

After testing, the script did not play a role in the game, and the game still generates the corresponding characters according to the system standard (that is, SWAT in normal state still uses uzi, SWAT in missions uses mp5, and the lives of both are the same).

I'm confused. First you said the script is functional:

On 4/27/2023 at 2:48 AM, Dark-Silva said:

Thank you very much for your efforts. Your script runs almost perfectly on the Android version. It successfully generated SWAT that meets the needs. Thank you for your help to solve the problem that has been confusing me!

... the generated SWAT (using m4 and with a blood volume of 200)...

And now you're saying it's not functional??? Which script exactly?

On 4/27/2023 at 2:48 AM, Dark-Silva said:

My version seems to be a modified version of Android 2.0, which supports cleo and Chinese components.
Due to the damn Huawei mobile phone system update, the Hongmeng system prevents my phone from running apk that supports fla and multi-threading. I can only use the modified version.

Have you ever successfully installed any cleo script for that modified version? Did it work? 

Link to comment
Share on other sites

Dark-Silva
19 hours ago, Jack said:

I'm confused. First you said the script is functional:

And now you're saying it's not functional??? Which script exactly?

Have you ever successfully installed any cleo script for that modified version? Did it work? 

For the version issue, I have updated my sa version, it can support cleo and flx and unlock 60 pins, most of the normal scripts can run on it.

What I mean by scripts that work are scripts that had bugs before (i.e. SWATs use m4 and they have 200 health whether assigned or not).

Later, I only used the last script you gave (according to your description, SWATs are assigned normal tasks in the task, they will not use m4 and their life is normal), before using it, I put the previously run The buggy script moved out of my cleo.

Or maybe I need to use both scripts? ...

Link to comment
Share on other sites

@Dark-Silva 
I was wrong. The offsets also vary from version to version so clearly 0x444 is not the CPed::m_nCreatedBy offset on your version. Newer version is actually 0x448. 
Lets just use the opcode 089F to get the pedtype and then test it. 
The next code should make a few changes:
- decrease the number of stars on the widget to 5,
- all law enforcement peds inside vehicles should have SWAT model,
- all law enforcement peds inside vehicles should have diferent weapons (4 of them are included):
    - drivers should have silenced pistol
    - front right passenger should have AK47,
    - back left passenger should have a shotgun,
    - back right passenger should have a sniper riffle.
    

Spoiler
{$CLEO .csa}
0000:

repeat
    wait 250
until 0256:   player $PLAYER_CHAR defined 

0247: load_model #SILENCED
0247: load_model #AK47
0247: load_model #CHROMEGUN
0247: load_model #SNIPER
038B: load_requested_models 

while true
    wait 0
    if and
        0248:   model #SILENCED available
        0248:   model #AK47 available
        0248:   model #CHROMEGUN available
        0248:   model #SNIPER available 
    then
break
    end
end

0DD0: 0@ = get_label_addr @_ZN17CWidgetPlayerInfo10DrawWantedEv 
0DD1: 0@ = get_func_addr_by_cstr_name 0@
0DD0: 1@ = get_label_addr @_ZN17CWidgetPlayerInfo23PassesDisplayConditionsEv 
0DD1: 1@ = get_func_addr_by_cstr_name 1@
if 0029: 0@ >= 1@
then
    1@ = 0x320
    005A: 1@ += 0@
end

for 31@ = 0@ to 1@ step 1
    0DD8: 30@ = read_mem_addr 31@ size 4 add_ib 0
    if and
        0029: 30@ >= 0x0F06F1B0 //  CMP.W R0, #6   
        001B: 0x0F06F1BF > 30@  //  CMP.W R15, #6  
    then
        31@ += 2
        0DD9: write_mem_addr 31@ value 5 size 1 add_ib 0 protect 1
break
    end 
end

while true
    wait 0
    050F: get_max_wanted_level_to 0@ 
    if 0@ > 5
    then
        01F0: set_max_wanted_level_to 5 
    end
    
    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@
            089F: get_actor 31@ pedtype_to 1@ 
            if 1@ == 6  //  pedtypeCop
            then
                if 0449:   actor 31@ in_a_car 
                then
                    0811: 2@ = actor 31@ used_car 
                    if 056E:   car 2@ defined 
                    then
                        if and
                            82F2: NOT actor 31@ model == #SWAT
                            8137: NOT car 2@ model == #ENFORCER  
                        then
                            0DD0: 0@ = get_label_addr @_ZN4CPed13SetModelIndexEj
                            0DD1: 0@ = get_func_addr_by_cstr_name 0@
                            0DD3: context_set_reg 1 value #SWAT
                            0DD3: context_set_reg 0 value 31@
                            0DD2: context_call_func 0@
                        end
                    end
                end
            end
        end
    end
    
    0DD0: 29@ = get_label_addr @_ZN6CPools15ms_pVehiclePoolE 
    0DD1: 29@ = get_func_addr_by_cstr_name 29@
    0DD8: 29@ = read_mem_addr 29@ size 4 add_ib 0
    29@ += 4
    0A8D: 29@ = read_memory 29@ size 4 virtual_protect 0
    for 30@ = 0 to 0x6D00 step 0x100
        0A8D: 31@ = read_memory 29@ size 1 virtual_protect 0
        29@ += 1
        if and
            0029: 31@ >= 0 
            001B: 0x80 > 31@
        then
            	005A: 31@ += 30@
                0DD0: 0@ = get_label_addr @_ZNK8CVehicle23IsLawEnforcementVehicleEv
                0DD1: 0@ = get_func_addr_by_cstr_name 0@
                0DD3: context_set_reg 0 value 1@
                0DD2: context_call_func 0@
                0DD4: 2@ = context_get_reg 0
                if 2@ == 1   //  police vehicle
                then
                    046C: 2@ = car 31@ driver 
                    
                    if 0431:   car 31@ passenger_seat_free 0 
                    then
                        0432: 3@ = get_actor_handle_from_car 31@ passenger_seat 0
                    end
                    
                    if 0431:   car 31@ passenger_seat_free 1 
                    then
                        0432: 4@ = get_actor_handle_from_car 31@ passenger_seat 1
                    end
                    
                    if 0431:   car 31@ passenger_seat_free 2 
                    then
                        0432: 5@ = get_actor_handle_from_car 31@ passenger_seat 2
                    end
                    
                    if 056D:   actor 2@ defined 
                    then
                        if 82D8:   not actor 2@ current_weapon == 23 
                        then
                            01B2: give_actor 2@ weapon 23 ammo 999
                            01B9: set_actor 2@ armed_weapon_to 23 
                        end
                    end
                    
                    if 056D:   actor 3@ defined 
                    then
                        if 82D8:   not actor 3@ current_weapon == 30 
                        then
                            01B2: give_actor 3@ weapon 30 ammo 999
                            01B9: set_actor 3@ armed_weapon_to 30 
                        end
                    end
                    
                    if 056D:   actor 4@ defined 
                    then
                        if 82D8:   not actor 4@ current_weapon == 25 
                        then
                            01B2: give_actor 4@ weapon 25 ammo 999
                            01B9: set_actor 4@ armed_weapon_to 25 
                        end
                    end
                    
                    if 056D:   actor 5@ defined 
                    then
                        if 82D8:   not actor 5@ current_weapon == 34 
                        then
                            01B2: give_actor 5@ weapon 34 ammo 999
                            01B9: set_actor 5@ armed_weapon_to 34 
                        end
                    end
                end
        end
    end
end 

:_ZN17CWidgetPlayerInfo10DrawWantedEv
hex
    "_ZN17CWidgetPlayerInfo10DrawWantedEv" 00
end

:_ZN17CWidgetPlayerInfo23PassesDisplayConditionsEv
hex
    "_ZN17CWidgetPlayerInfo23PassesDisplayConditionsEv" 00
end

:_ZN6CPools11ms_pPedPoolE
hex
    "_ZN6CPools11ms_pPedPoolE" 00
end

:_ZN6CPools6GetPedEi
hex
    "_ZN6CPools6GetPedEi" 00
end

:_ZN6CPools15ms_pVehiclePoolE
hex
    "_ZN6CPools15ms_pVehiclePoolE" 00
end

:_ZN6CPools10GetVehicleEi
hex
    "_ZN6CPools10GetVehicleEi" 00
end

:_ZNK8CVehicle23IsLawEnforcementVehicleEv
hex
    "_ZNK8CVehicle23IsLawEnforcementVehicleEv" 00
end

:_ZN4CPed13SetModelIndexEj
hex
    "_ZN4CPed13SetModelIndexEj" 00
end

 

Would you be able to test codes I provide 'cause I can't?

Edited by Jack
Link to comment
Share on other sites

Dark-Silva
On 5/11/2023 at 4:10 PM, Jack said:

@Dark-Silva 
I was wrong. The offsets also vary from version to version so clearly 0x444 is not the CPed::m_nCreatedBy offset on your version. Newer version is actually 0x448. 
Lets just use the opcode 089F to get the pedtype and then test it. 
The next code should make a few changes:
- decrease the number of stars on the widget to 5,
- all law enforcement peds inside vehicles should have SWAT model,
- all law enforcement peds inside vehicles should have diferent weapons (4 of them are included):
    - drivers should have silenced pistol
    - front right passenger should have AK47,
    - back left passenger should have a shotgun,
    - back right passenger should have a sniper riffle.
    

  Reveal hidden contents
{$CLEO .csa}
0000:

repeat
    wait 250
until 0256:   player $PLAYER_CHAR defined 

0247: load_model #SILENCED
0247: load_model #AK47
0247: load_model #CHROMEGUN
0247: load_model #SNIPER
038B: load_requested_models 

while true
    wait 0
    if and
        0248:   model #SILENCED available
        0248:   model #AK47 available
        0248:   model #CHROMEGUN available
        0248:   model #SNIPER available 
    then
break
    end
end

0DD0: 
0DD1: 0@ = get_func_addr_by_cstr_name 0@
0DD0: 
0DD1: 1@ = get_func_addr_by_cstr_name 1@
if 0029: 0@ >= 
then
    1@
    005A: 1@ += 0@
end

for 31@ = 0@ to 1@ step 1
    0DD8: 30@ = read_mem_addr 31@ size 4 add_ib 0
    if and
        0029: 
        001B: 0x0F06F1BF > 
    then
        31@
        0DD9: write_mem_addr 
break
    end 
end

while true
    wait 0
    050F: get_max_wanted_level_to 0@ 
    if 
    then
        01F0: set_max_wanted_level_to 5 
    end
    
    0DD0: 
    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@
            089F: get_actor 31@ pedtype_to 1@ 
            if 1@ == 6  //  pedtypeCop
            then
                if 0449:   actor 31@ in_a_car 
                then
                    0811: 2@ = actor 31@ used_car 
                    if 056E:   car 2@ defined 
                    then
                        if and
                            82F2: NOT actor 31@ model == #SWAT
                            8137: NOT car 
                        then
                            0DD0: 0@ = get_label_addr @_ZN4CPed13SetModelIndexEj
                            0DD1: 0@ = get_func_addr_by_cstr_name 0@
                            0DD3: context_set_reg 1 value #SWAT
                            0DD3: context_set_reg 0 value 31@
                            0DD2: context_call_func 0@
                        end
                    end
                end
            end
        end
    end
    
    0DD0: 29@ = get_label_addr @_ZN6CPools15ms_pVehiclePoolE 
    0DD1: 29@ = get_func_addr_by_cstr_name 29@
    0DD8: 29@ = read_mem_addr 29@ size 4 add_ib 0
    29@ += 4
    0A8D: 29@ = read_memory 29@ size 4 virtual_protect 0
    for 30@ = 0 to 0x6D00 step 0x100
        0A8D: 31@ = read_memory 29@ size 1 virtual_protect 0
        29@ += 1
        if and
            0029: 31@ >= 0 
            001B: 0x80 > 31@
        then
            	005A: 31@ += 30@
                0DD0: 0@ = get_label_addr @_ZNK8CVehicle23IsLawEnforcementVehicleEv
                0DD1: 0@ = get_func_addr_by_cstr_name 0@
                0DD3: context_set_reg 0 value 1@
                0DD2: context_call_func 0@
                0DD4: 2@ = context_get_reg 0
                if 2@ == 1   //  police vehicle
                then
                    046C: 2@ = car 31@ driver 
                    
                    if 0431:   car 31@ passenger_seat_free 0 
                    then
                        0432: 3@ = get_actor_handle_from_car 31@ passenger_seat 0
                    end
                    
                    if 0431:   car 31@ passenger_seat_free 1 
                    then
                        0432: 4@ = get_actor_handle_from_car 31@ passenger_seat 1
                    end
                    
                    if 0431:   car 31@ passenger_seat_free 2 
                    then
                        0432: 5@ = get_actor_handle_from_car 31@ passenger_seat 2
                    end
                    
                    if 056D:   actor 2@ defined 
                    then
                        if 82D8:   not actor 2@ current_weapon == 23 
                        then
                            01B2: give_actor 2@ weapon 23 ammo 999
                            01B9: set_actor 2@ armed_weapon_to 23 
                        end
                    end
                    
                    if 056D:   actor 3@ defined 
                    then
                        if 82D8:   not actor 3@ current_weapon == 30 
                        then
                            01B2: give_actor 3@ weapon 30 ammo 999
                            01B9: set_actor 3@ armed_weapon_to 30 
                        end
                    end
                    
                    if 056D:   actor 4@ defined 
                    then
                        if 82D8:   not actor 4@ current_weapon == 25 
                        then
                            01B2: give_actor 4@ weapon 25 ammo 999
                            01B9: set_actor 4@ armed_weapon_to 25 
                        end
                    end
                    
                    if 056D:   actor 5@ defined 
                    then
                        if 82D8:   not actor 5@ current_weapon == 34 
                        then
                            01B2: give_actor 5@ weapon 34 ammo 999
                            01B9: set_actor 5@ armed_weapon_to 34 
                        end
                    end
                end
        end
    end
end 

:_ZN17CWidgetPlayerInfo10DrawWantedEv
hex
    "_ZN17CWidgetPlayerInfo10DrawWantedEv" 00
end

:_ZN17CWidgetPlayerInfo23PassesDisplayConditionsEv
hex
    "_ZN17CWidgetPlayerInfo23PassesDisplayConditionsEv" 00
end

:_ZN6CPools11ms_pPedPoolE
hex
    "_ZN6CPools11ms_pPedPoolE" 00
end

:_ZN6CPools6GetPedEi
hex
    "_ZN6CPools6GetPedEi" 00
end

:_ZN6CPools15ms_pVehiclePoolE
hex
    "_ZN6CPools15ms_pVehiclePoolE" 00
end

:_ZN6CPools10GetVehicleEi
hex
    "_ZN6CPools10GetVehicleEi" 00
end

:_ZNK8CVehicle23IsLawEnforcementVehicleEv
hex
    "_ZNK8CVehicle23IsLawEnforcementVehicleEv" 00
end

:_ZN4CPed13SetModelIndexEj
hex
    "_ZN4CPed13SetModelIndexEj" 00
end

 

Would you be able to test codes I provide 'cause I can't?

I tested the code you provided and compiled it with sunny builder 3, but it shows that your code has insufficient actual parameters (two parameters are expected), which makes the code unable to be compiled into a script (by the way, this cleo seems to me I've seen it somewhere, but it's a script used by the PC version).

 

According to the current configuration of the mobile terminal SA, I am afraid that it cannot reach the setting of the wanted system similar to the 5th generation.

 

The following are my settings, I hope they can be satisfied:

 

1. The overall wanted level can remain the same, but it is best to change it to level five;

 

2. When the police are wanted at level 3 and above, the script can increase their life and use a new model (the model equipped with body armor);

 

3. Remove the FBI from the wanted system, and change it to SWAT to be responsible for the fourth and fifth levels of wanted? (Or is the FBI responsible for level 4 and SWAT for level 5? Or are they both responsible for level 4 and 5???)

 

4. Strengthen SWAT (already implemented by your previous script, it makes SWAT reach 5th generation strength in terms of force), and let them use the same vehicles as 5th generation noose (FBI rancher and enforcer).

 

5. Fair treatment by the police? (Or a wanted system exclusively for npcs???) and improve their IQ.

 

To be honest, I feel like a "idealist" who can't program is daydreaming

Edited by Dark-Silva
Link to comment
Share on other sites

42 minutes ago, Dark-Silva said:

...insufficient actual parameters (two parameters are expected)...

At which line exactly? 

EDIT: I noticed that the code you copied while quoting is not the same as the one I posted. 

Edited by Jack
Link to comment
Share on other sites

Dark-Silva
7 hours ago, Jack said:

At which line exactly? 

EDIT: I noticed that the code you copied while quoting is not the same as the one I posted. 

To reassure you, I re-copied your script and compiled it with sb3 again, but the result is still insufficient parameters.
Sorry, I don't know how to check the corresponding parameter problem, and sb3 doesn't show where the code goes wrong. But I think maybe the parameter refers to insufficient number of entities? /or some entities cannot be replaced by the same parameter? ? ?

Link to comment
Share on other sites

5 hours ago, Dark-Silva said:

To reassure you, I re-copied your script...

It's been 8 hours and you still haven't noticed that you did not copy the text from my post correctly? 

Here's some parts of my post:

0DD0: 0@ = get_label_addr @_ZN17CWidgetPlayerInfo10DrawWantedEv 
0DD1: 0@ = get_func_addr_by_cstr_name 0@
0DD0: 1@ = get_label_addr @_ZN17CWidgetPlayerInfo23PassesDisplayConditionsEv 
0DD1: 1@ = get_func_addr_by_cstr_name 1@
if 0029: 0@ >= 1@
then
    1@ = 0x320
    005A: 1@ += 0@
end

The exact same text you "copied" then quoted:

0DD0:
0DD1: 0@ = get_func_addr_by_cstr_name 0@
0DD0:
0DD1: 1@ = get_func_addr_by_cstr_name 1@
if 0029: 0@ >=
then
    1@
    005A: 1@ += 0@
end

 

Edited by Jack
Link to comment
Share on other sites

Dark-Silva
4 hours ago, Jack said:

It's been 8 hours and you still haven't noticed that you did not copy the text from my post correctly? 

Here's some parts of my post:

0DD0: 0@ = get_label_addr @_ZN17CWidgetPlayerInfo10DrawWantedEv 
0DD1: 0@ = get_func_addr_by_cstr_name 0@
0DD0: 1@ = get_label_addr @_ZN17CWidgetPlayerInfo23PassesDisplayConditionsEv 
0DD1: 1@ = get_func_addr_by_cstr_name 1@
if 0029: 0@ >= 1@
then
    1@ = 0x320
    005A: 1@ += 0@
end

The exact same text you "copied" then quoted:

0DD0:
0DD1: 0@ = get_func_addr_by_cstr_name 0@
0DD0:
0DD1: 1@ = get_func_addr_by_cstr_name 1@
if 0029: 0@ >=
then
    1@
    005A: 1@ += 0@
end

 

?

In order to verify my statement, I show you the code I copied here.

I don't know how you got to know that there is something wrong with the code I copied.

After comparison, I didn't find that the code I copied and run had the error you described, but the code still failed to become a script.

 

{$CLEO .csa}

0000:

 

repeat

    wait 250

until 0256: player $PLAYER_CHAR defined 

 

0247: load_model #SILENCED

0247: load_model #AK47

0247: load_model #CHROMEGUN

0247: load_model #SNIPER

038B: load_requested_models 

 

while true

    wait 0

    if and

        0248: model #SILENCED available

        0248: model #AK47 available

        0248: model #CHROMEGUN available

        0248: model #SNIPER available 

    then

break

    end

end

 

0DD0: 0@ = get_label_addr @_ZN17CWidgetPlayerInfo10DrawWantedEv 

0DD1: 0@ = get_func_addr_by_cstr_name 0@

0DD0: 1@ = get_label_addr @_ZN17CWidgetPlayerInfo23PassesDisplayConditionsEv 

0DD1: 1@ = get_func_addr_by_cstr_name 1@

if 0029: 0@ >= 1@

then

    1@ = 0x320

    005A: 1@ += 0@

end

 

for 31@ = 0@ to 1@ step 1

    0DD8: 30@ = read_mem_addr 31@ size 4 add_ib 0

    if and

        0029: 30@

        001B: 0x0F06F1BF > 30@ // CMP.W R15, #6  

    then

        31@ += 2

        0DD9: write_mem_addr 31@ value 5 size 1 add_ib 0 protect 1

break

    end 

end

 

while true

    wait 0

    050F: get_max_wanted_level_to 0@ 

    if 0@ > 5

    then

        01F0: set_max_wanted_level_to 5 

    end

    

    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@

            089F: get_actor 31@ pedtype_to 1@ 

            if 1@ == 6 // pedtypeCop

            then

                if 0449: actor 31@ in_a_car 

                then

                    0811: 2@ = actor 31@ used_car 

                    if 056E: car 2@ defined 

                    then

                        if and

                            82F2: NOT actor 31@ model == #SWAT

                            8137: NOT car 2@ model == #ENFORCER  

                        then

                            0DD0: 0@ = get_label_addr @_ZN4CPed13SetModelIndexEj

                            0DD1: 0@ = get_func_addr_by_cstr_name 0@

                            0DD3: context_set_reg 1 value #SWAT

                            0DD3: context_set_reg 0 value 31@

                            0DD2: context_call_func 0@

                        end

                    end

                end

            end

        end

    end

    

    0DD0: 29@ = get_label_addr @_ZN6CPools15ms_pVehiclePoolE 

    0DD1: 29@ = get_func_addr_by_cstr_name 29@

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

    29@ += 4

    0A8D: 29@ = read_memory 29@ size 4 virtual_protect 0

    for 30@ = 0 to 0x6D00 step 0x100

        0A8D: 31@ = read_memory 29@ size 1 virtual_protect 0

        29@

        if and

            0029: 31@ >= 0 

            001B: 0x80 > 31@

        then

             005A: 31@ += 30@

                0DD0: 0@ = get_label_addr @_ZNK8CVehicle23IsLawEnforcementVehicleEv

                0DD1: 0@ = get_func_addr_by_cstr_name 0@

                0DD3: context_set_reg 0 value 1@

                0DD2: context_call_func 0@

                0DD4: 2@ = context_get_reg 0

                if 2@ == 1 // police vehicle

                then

                    046C: 2@ = car 31@ driver 

                    

                    if 0431: car 31@ passenger_seat_free 0 

                    then

                        0432: 3@ = get_actor_handle_from_car 31@ passenger_seat 0

                    end

                    

                    if 0431: car 31@ passenger_seat_free 1 

                    then

                        0432: 4@ = get_actor_handle_from_car 31@ passenger_seat 1

                    end

                    

                    if 0431: car 31@ passenger_seat_free 2 

                    then

                        0432: 5@ = get_actor_handle_from_car 31@ passenger_seat 2

                    end

                    

                    if 056D: actor 2@ defined 

                    then

                        if 82D8: not actor 2@ current_weapon == 23 

                        then

                            01B2: give_actor 2@ weapon 23 ammo 999

                            01B9: set_actor 2@ armed_weapon_to 23 

                        end

                    end

                    

                    if 056D: actor 3@ defined 

                    then

                        if 82D8: not actor 3@ current_weapon == 30 

                        then

                            01B2: give_actor 3@ weapon 30 ammo 999

                            01B9: set_actor 3@ armed_weapon_to 30 

                        end

                    end

                    

                    if 056D: actor 4@ defined 

                    then

                        if 82D8: not actor 4@ current_weapon == 25 

                        then

                            01B2: give_actor 4@ weapon 25 ammo 999

                            01B9: set_actor 4@ armed_weapon_to 25 

                        end

                    end

                    

                    if 056D: actor 5@ defined 

                    then

                        if 82D8: not actor 5@ current_weapon == 34 

                        then

                            01B2: give_actor 5@ weapon 34 ammo 999

                            01B9: set_actor 5@ armed_weapon_to 34 

                        end

                    end

                end

        end

    end

end 

 

:_ZN17CWidgetPlayerInfo10DrawWantedEv

hex

    "_ZN17CWidgetPlayerInfo10DrawWantedEv" 00

end

 

:_ZN17CWidgetPlayerInfo23PassesDisplayConditionsEv

hex

    "_ZN17CWidgetPlayerInfo23PassesDisplayConditionsEv" 00

end

 

:_ZN6CPools11ms_pPedPoolE

hex

    "_ZN6CPools11ms_pPedPoolE" 00

end

 

:_ZN6CPools6GetPedEi

hex

    "_ZN6CPools6GetPedEi" 00

end

 

:_ZN6CPools15ms_pVehiclePoolE

hex

    "_ZN6CPools15ms_pVehiclePoolE" 00

end

 

:_ZN6CPools10GetVehicleEi

hex

    "_ZN6CPools10GetVehicleEi" 00

end

 

:_ZNK8CVehicle23IsLawEnforcementVehicleEv

hex

    "_ZNK8CVehicle23IsLawEnforcementVehicleEv" 00

end

 

:_ZN4CPed13SetModelIndexEj

hex

    "_ZN4CPed13SetModelIndexEj" 00

end

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.