Jump to content

custom gang models are not working


Recommended Posts

ignore my previous topic

also sorry if I'm being dumb lol

 

I'm making a gang mod (for myself) which adds custom gangs & weapons but it doesn't load the custom ped models

it loads the default ones instead (the custom weapons work however) anyone know a fix?

{$CLEO .cs}

//-------------MAIN---------------
03A4: name_thread 'GLENPAR' 
0001: wait 100 ms 
0006: 0@ = 12645208 
000A: 0@ += 1890 
0006: 1@ = 12643640 
000A: 1@ += 966 
0006: 2@ = 12631144 
0006: 3@ = 0 
0006: 4@ = 0 
0006: 5@ = 0 
0006: 6@ = 0 
0006: 7@ = 0 
0006: 8@ = 0 
0006: 9@ = 0 
0006: 10@ = 0
0006: 20@ = 0
0006: 21@ = 0 
0002: jump @GLENPAR_132 

:GLENPAR_132
0001: wait 0 ms 
00D6: if 
0039:   4@ == 0 
004D: jump_if_false @GLENPAR_501 
0002: jump @GLENPAR_161 

:GLENPAR_161
0001: wait 0 ms 
00D6: if 
0583:   player $PLAYER_CHAR in_zone 'GLN2a' 
004D: jump_if_false @GLENPAR_197 
0002: jump @GLENPAR_233 

:GLENPAR_197
0001: wait 0 ms 
00D6: if 
0583:   player $PLAYER_CHAR in_zone 'ELS1a' 
004D: jump_if_false @GLENPAR_161 
0002: jump @GLENPAR_233

:GLENPAR_196
0001: wait 0 ms 
00D6: if 
0583:   player $PLAYER_CHAR in_zone 'ELS2' 
004D: jump_if_false @GLENPAR_161 
0002: jump @GLENPAR_233

:GLENPAR_233
0001: wait 0 ms 
0006: 4@ = 1 
0A8D: read_memory 0@ size 2 vp 0 store_to 5@ 
0A8C: write_memory 0@ size 2 val 5098 vp 0 
000A: 0@ += 2 
0A8D: read_memory 0@ size 2 vp 0 store_to 6@ 
0A8C: write_memory 0@ size 2 val 5103 vp 0 
000A: 0@ += 2 
0A8D: read_memory 0@ size 2 vp 0 store_to 7@ 
0A8C: write_memory 0@ size 2 val 17975 vp 0 
000E: 0@ += 2
0A8D: read_memory 0@ size 2 vp 0 store_to 20@ 
0A8C: write_memory 0@ size 2 val 17977 vp 0 
000E: 0@ -= 4 
0A8D: read_memory 1@ size 2 vp 0 store_to 8@ 
0A8C: write_memory 1@ size 2 val 492 vp 0 
000A: 1@ += 2 
0A8D: read_memory 1@ size 2 vp 0 store_to 9@ 
0A8C: write_memory 1@ size 2 val 509 vp 0 
000A: 1@ += 2 
0A8D: read_memory 1@ size 2 vp 0 store_to 10@ 
0A8C: write_memory 1@ size 2 val 549 vp 0 
000E: 1@ += 2 
0A8D: read_memory 1@ size 2 vp 0 store_to 21@ 
0A8C: write_memory 1@ size 2 val 509 vp 0 
000E: 1@ -= 4
0A8D: read_memory 2@ size 4 vp 0 store_to 3@ 
0237: set_gang 0 weapons_to 32 29 4 
0002: jump @GLENPAR_459 

:GLENPAR_459
0001: wait 0 ms 
0A8D: read_memory 2@ size 4 vp 0 store_to 11@ 
00D6: if 
003B:   11@ == 3@ // (int) 
004D: jump_if_false @GLENPAR_501 
0002: jump @GLENPAR_459 

:GLENPAR_501
0001: wait 0 ms 
00D6: if 
0039:   4@ == 1 
004D: jump_if_false @GLENPAR_161 
0006: 4@ = 0 
0A8C: write_memory 0@ size 2 val 5@ vp 0 
000A: 0@ += 2 
0A8C: write_memory 0@ size 2 val 6@ vp 0 
000A: 0@ += 2 
0A8C: write_memory 0@ size 2 val 7@ vp 0 
000E: 0@ += 2
0A8C: write_memory 0@ size 2 val 20@ vp 0 
000E: 0@ -= 4 
0A8C: write_memory 1@ size 2 val 8@ vp 0 
000A: 1@ += 2 
0A8C: write_memory 1@ size 2 val 9@ vp 0 
000A: 1@ += 2 
0A8C: write_memory 1@ size 2 val 10@ vp 0 
000E: 1@ += 2
0A8C: write_memory 1@ size 2 val 21@ vp 0 
000E: 1@ -= 4 
0237: set_gang 0 weapons_to 0 0 0 
0002: jump @GLENPAR_132 

 

Link to comment
https://gtaforums.com/topic/949866-custom-gang-models-are-not-working/
Share on other sites

+2 +2 +2 -4 = +2

000E: 0@ -= 4

This looks like a pointer, an address that points to the data you want to read.

0006: 2@ = 0xC0BC68  // CZoneInfo* CPopCycle::m_pCurrZoneInfo = (CZoneInfo*)0xC0BC68;

These addresses from DK22pak's documentation are for the start of the ped and car groups; I don't have info on the number of standard groups that precede the gang groups so I'm working with addresses documented for the start of the gang groups.

0006: 0@ = 0xC0F358 // short                     (*CPopulation::m_PedGroups)[21]              =  (short             (*)[21])0xC0F358;
0006: 1@ = 0xC0ED38 // short                     (*CPopulation::m_CarGroups)[23]              =  (short             (*)[23])0xC0ED38;

Start of Gang Groups:

0@ += 0xC0FA3C // beginning of gang peds group
1@ += 0xC0F074 // beginning of gang car groups

 

Describe your math; preserve the hex addresses or convert with Ctrl + H:

// 0006: 1@ = 12643640 
// 000A: 1@ += 966 

1@ = 46 // car group size [23 words]
1@ *= 3 // gang ID (0...9) // San Fierro Rifa
1@ += 0xC0F074 // beginning of gang car groups

Suggestions: Notice and make use of the references and comments provided when requesting help. 

Convert model IDs with Ctrl + Alt + H:

0A8C: write_memory 1@ size 2 val #GREENWOO vp 0 

Test with standard models before trying custom models, especially when requesting help.

0A8C: write_memory 0@ size 2 val 5098 vp 0 


 

1 hour ago, OrionSR said:

+2 +2 +2 -4 = +2


000E: 0@ -= 4

This looks like a pointer, an address that points to the data you want to read.


0006: 2@ = 0xC0BC68  // CZoneInfo* CPopCycle::m_pCurrZoneInfo = (CZoneInfo*)0xC0BC68;

These addresses from DK22pak's documentation are for the start of the ped and car groups; I don't have info on the number of standard groups that precede the gang groups so I'm working with addresses documented for the start of the gang groups.


0006: 0@ = 0xC0F358 // short                     (*CPopulation::m_PedGroups)[21]              =  (short             (*)[21])0xC0F358;
0006: 1@ = 0xC0ED38 // short                     (*CPopulation::m_CarGroups)[23]              =  (short             (*)[23])0xC0ED38;

Start of Gang Groups:


0@ += 0xC0FA3C // beginning of gang peds group
1@ += 0xC0F074 // beginning of gang car groups

 

Describe your math; preserve the hex addresses or convert with Ctrl + H:


// 0006: 1@ = 12643640 
// 000A: 1@ += 966 

1@ = 46 // car group size [23 words]
1@ *= 3 // gang ID (0...9) // San Fierro Rifa
1@ += 0xC0F074 // beginning of gang car groups

Suggestions: Notice and make use of the references and comments provided when requesting help. 

Convert model IDs with Ctrl + Alt + H:


0A8C: write_memory 1@ size 2 val #GREENWOO vp 0 

Test with standard models before trying custom models, especially when requesting help.


0A8C: write_memory 0@ size 2 val 5098 vp 0 


 

it kinda works but the models don't work

Yeah, I know. Make the suggested changes and if you are still having trouble then post the updated script with better descriptions of what you expect.

 

If you continue to quote and ignore my entire post then I will avoid responding in your topics.

 

 

We could try with a diferent approach by using functions directly:

{$CLEO}
0000:

repeat
    wait 250
until 0256:   player $PLAYER_CHAR defined

const
    _ZN6CGangs18ChooseGangPedModelEs = 0x5DE5A0
    _ZN4CPed14DeleteRwObjectEv = 0x5DEBF0
    _ZN4CPed13SetModelIndexEj = 0x5E4880
    _ZN6CPools11ms_pPedPoolE = 0xB74490
    IsGangPedType = 0x5FE9C0
    NewPedModel = #DSHER
    ped = 31@
end

while true
    wait 0     
    0A8D: 29@ = read_memory _ZN6CPools11ms_pPedPoolE size 4 virtual_protect 0
    000A: 29@ += 4
    0A8D: 29@ = read_memory 29@ size 4 virtual_protect 0
    for 30@ = 0 to 0x8B00 step 0x100
        0A8D: ped = read_memory 29@ size 1 virtual_protect 0
        29@ ++
        if and
            0029:  ped >= 0
            001B:  0x80 > ped
        then
            005A: ped += 30@
            089F: get_actor ped pedtype_to 0@
            0AA7: call_function IsGangPedType num_params 1 pop 1 pedtype 0@ store_to 1@
            if 1@ == 1  //  is ped a gang member?
            then              
                gosub @changePedModel   
            end
        end
    end
end //  while

:changePedModel
089F: get_actor ped pedtype_to 0@
0665: get_actor ped model_to 1@
if 1@ <> NewPedModel
then    
    if 0248:   model NewPedModel available
    then   
        0A96: 0@ = actor ped struct
        0@ += 0x4D4
        0A8D: 2@ = read_memory 0@ size 4 virtual_protect 0  //  2@ = ped->m_nAnimGroup;
        0A96: 0@ = actor ped struct
        0AA6: call_method _ZN4CPed14DeleteRwObjectEv struct 0@ num_params 0 pop 0   //  CPed::DeleteRwObject(CEntity *);  
        0A8E: 6@ = 0@ + 0x22    //  6@ = ped->m_nModelIndex  
        0A8C: write_memory 6@ size 2 value -1 virtual_protect 0 //  ped->m_nModelIndex = -1;
        0AA6: call_method _ZN4CPed13SetModelIndexEj struct 0@ num_params 1 pop 0 NewPedModel    //  CPed::SetModelIndex(unsigned int)
        0A96: 0@ = actor ped struct
        0@ += 0x4D4
        0A8C: write_memory 0@ size 4 value 2@ virtual_protect 0 //  ped->m_nAnimGroup = 2@;  
    else
        0247: load_model NewPedModel
        038B: load_requested_models
    end   
end  
return

The above code should replace skins of all gang members to desert sherif skin.
But there's a problem with ped tasks and their paths - it appears that the function CPed::SetModelIndex() removes them completely.

here's the updated code:

{$CLEO .cs}

03A4: name_thread 'GLENPARKBAL'
:GLENPARKBAL_0
wait 100 ms
0@ = 0xC0F358
0@ += 0xC0FA3C
1@ = 0xC0ED38
1@ += 0xC0F074
2@ = 0xC0BC68
3@ = 0
4@ = 0
5@ = 0
7@ = 0
8@ = 0
9@ = 0
10@ = 0
jump @GLENPARKBAL_121

:GLENPARKBAL_121
wait 0 ms 
if 
  4@ == 0
jf @GLENPARKBAL_552 
jump @GLENPARKBAL_123
  
:GLENPARKBAL_123
wait 0 ms
if
  Player.InZone($PLAYER_CHAR, 'GLN1')
jf @GLENPARKBAL_142
jump @GLENPARKBAL_255

:GLENPARKBAL_142
wait 0 ms
if
  Player.InZone($PLAYER_CHAR, 'ELS1a')
jf @GLENPARKBAL_152
jump @GLENPARKBAL_255

:GLENPARKBAL_152
wait 0 ms
if
  Player.InZone($PLAYER_CHAR, 'GLN2a')
jf @GLENPARKBAL_142
jump @GLENPARKBAL_255

:GLENPARKBAL_255
wait 0 ms
//038B: load_requested_models
//jf @GLENPARKBAL_342
4@ = 1
0A8D: read_memory 0@ size 2 vp 0 store_to 5@
0A8C: write_memory 0@ size 2 val 5098 vp 0
0@ += 2
0A8D: read_memory 0@ size 2 vp 0 store_to 6@
0A8C: write_memory 0@ size 2 val 5103 vp 0
0@ += 2
0A8D: read_memory 0@ size 2 vp 0 store_to 7@
0A8C: write_memory 0@ size 2 val 668 vp 0
0@ -= 4
0A8D: read_memory 1@ size 2 vp 0 store_to 8@
0A8C: write_memory 1@ size 2 val 567 vp 0
1@ += 2
0A8D: read_memory 1@ size 2 vp 0 store_to 9@
0A8C: write_memory 1@ size 2 val 567 vp 0
1@ += 2
0A8D: read_memory 1@ size 2 vp 0 store_to 10@
0A8C: write_memory 1@ size 2 val 567 vp 0
1@ -= 4
0A8D: read_memory 2@ size 4 vp 0 store_to 3@
0237: set_gang 0 weapons_to 32 22 0
jump @GLENPARKBAL_123

:GLENPARKBAL_342
wait 0 ms 
0A8D: read_memory 2@ size 4 vp 0 store_to 11@
if
003B:   11@ == 3@ // (int)
jf @GLENPARKBAL_552
jump @GLENPARKBAL_342

:GLENPARKBAL_552
wait 0 ms
if 
  4@ == 1
jf @GLENPARKBAL_123
4@ = 0
0A8C: write_memory 0@ size 2 val 5@ vp 0
0@ += 2
0A8C: write_memory 0@ size 2 val 6@ vp 0
0@ += 2
0A8C: write_memory 0@ size 2 val 7@ vp 0
0@ -= 4
0A8C: write_memory 1@ size 2 val 8@ vp 0
1@ += 2
0A8C: write_memory 1@ size 2 val 9@ vp 0
1@ += 2
0A8C: write_memory 1@ size 2 val 10@ vp 0
1@ -= 4
0237: set_gang 0 weapons_to 22 28 0
jump @GLENPARKBAL_123

 

Edited by aryaryan

If you implement the latest modification that I suggested for 0@ and 1@ then your models might finally start working, but the logic flow is still broken so don't expect the script to work properly.

 

I'm still stuck on this part. Fill in the blank.

 

If the current zone is Glen Park then modify the Ballas gang models and weapons.

If _________________________ then reset the models and weapons to default.

 

Your script is confusing. Some parts seem to be written for Rifa and others for Ballas, like you started with another script and then partially modified it, but important pieces are missing. Please post the original script.

It is unreasonable to describe your script as not working without first explaining what your script should do.

___________________________

 

Added: I would not expect the GLN1 zone to work properly in your latest script. because the jump to @GLENPARKBAL_142 skips that part. You can fix GLN1 with the modification below. However, this jump will need to change again; it needs to include the check on 4@ at @GLENPARKBAL_121, but not yet because that part is still broken and will undo your changes.

:GLENPARKBAL_152
wait 0 ms
if
  Player.InZone($PLAYER_CHAR, 'GLN2a')
//jf @GLENPARKBAL_142
//jf @GLENPARKBAL_121
jf @GLENPARKBAL_123
jump @GLENPARKBAL_255

 

Edited by OrionSR
Quote

It is unreasonable to describe your script as not working without first explaining what your script should do.

I want it to be like big gangster where it changes the models of the gang when you go to a certain area

Quote

Please post the original script.

I did copy some parts from big gangster CR edition (I don't remember from which script tho)

See if you can find the section that includes this read address:

0006: 2@ = 12631144  // CZoneInfo* CPopCycle::m_pCurrZoneInfo = (CZoneInfo*)0xC0BC68;

The relevant script segment is shown below, but it's incomplete:

:GLENPAR_459
0001: wait 0 ms 
0A8D: read_memory 2@ size 4 vp 0 store_to 11@ 
00D6: if 
003B:   11@ == 3@ // (int) 
004D: jump_if_false @GLENPAR_501 
0002: jump @GLENPAR_459 

0xC0BC68 should contain the 4 byte address for the start of the Zone Info record that contains the density information for the current zone. If you read the first byte at the address from that pointer it should tell you the density of the Ballas in that zone. So, to fill in the blank, If Ballas density is 0 then reset the models and weapons. 
 

1 hour ago, aryaryan said:

I want it to be like big gangster where it changes the models of the gang when you go to a certain area

If

  player in zone (certain areas)

then

  be like big gangster // change models

else

  no operation
end

 

The example above is intended to emphasize the need to be more specific. I'm not terribly familiar with the details of the Big Gangster mod. I think I've pretty much given you a good answer already. You just need to spit it back at me to confirm your expectations for a working script.

Edited by OrionSR

I think I figured out the missing piece. The current ZoneInfo pointer needs to be saved to 3@ and if it changes then reset the models and weapons. The section below are a series of corrections to test on the first script posted because fewer changes are needed.

 

03A4: name_thread 'GLENPAR' 
0001: wait 100 ms 
0006: 0@ = 0xC0F358 // start of ped groups 
//000A: 0@ += 1890
000A: 0@ += 1764  // offset to gang peds group
0006: 1@ = 0xC0ED38 // start of cars groups 
//000A: 1@ += 966 
000A: 1@ += 828  // offset to gang cars group
0006: 2@ = 0xC0BC68  // pointer to current ZoneInfo

0583:   player $PLAYER_CHAR in_zone 'ELS1a' 
//004D: jump_if_false @GLENPAR_161 
004D: jump_if_false @GLENPAR_196 

:GLENPAR_233
0001: wait 0 ms
0A8D: read_memory 2@ size 2 vp 0 store_to 3@  // save current pointer 
0006: 4@ = 1 

//000E: 0@ -= 4 
000E: 0@ -= 6 

//000E: 1@ -= 4
000E: 1@ -= 6

//000E: 0@ -= 4 
000E: 0@ -= 6 

//000E: 1@ -= 4
000E: 1@ -= 6

 

You should keep working on this script. There are lots of minor issues with this script but it should work as expected if you update the first script posted with my most recent suggestions. Once you get it working I'll make some major revisions to make is easier to understand and modify for other zones and gangs. But you need to get the script working first.

 

You already have a reputation for refusing to answer questions; notice that I haven't asked any. If I get ornery enough you will follow instructions, but that's an unpleasant way to interact with someone. Let's not add quits before finishing and expects someone else to write the script to your reputation. Make the changes, test, and post the most recent script, working or not.

 

Edited by OrionSR

ok yeah sorry here's the updated code:

{$CLEO .cs}

//0000: //

03A4: name_thread 'SBF'
0001: wait 100 ms
0@ = 12646972
0@ += 1890
1@ = 12643640
1@ += 1740
2@ = 12631144
3@ = 0
4@ = 0
5@ = 0
6@ = 0
7@ = 0
8@ = 0
9@ = 0
10@ = 0
076C: set_zone 'PLS' gang 1 density_to 0
076C: set_zone 'PLS' gang 7 density_to 40
076C: set_zone 'MAR3' gang 7 density_to 40
0746: set_acquaintance 1 of_actors_pedtype 15 to_actors_pedtype 0
0746: set_acquaintance 1 of_actors_pedtype 15 to_actors_pedtype 8
0746: set_acquaintance 1 of_actors_pedtype 8 to_actors_pedtype 15   
0002: jump @SBF_01

:SBF_01
wait 0
Model.Load(7974)
Model.Load(7977)
Model.Load(9194)
Model.Load(9204)
Model.Load(9268)
Model.Load(9479)
wait 0
if and
   Model.Available(7974)
   Model.Available(7977)
   Model.Available(9194)
wait 0
if and
   Model.Available(9204)
   Model.Available(9268)
   Model.Available(9479)
else_jump @SBF_01

:SBF_1
0001: wait 0 ms
00D6: if
  4@ == 0
004D: jump_if_false @SBF_50   
//jf @SBF_50
0002: jump @SBF_2

:SBF_2
0001: wait 0 ms
00D6: if
0583:   player $PLAYER_CHAR in_zone 'PLS' 
//  Player.InZone($PLAYER_CHAR, 'PLS')
//jf @SBF_3
004D: jump_if_false @SBF_3
0002: jump @SBF_40

:SBF_3
0001: wait 0 ms
00D6: if
0583:   player $PLAYER_CHAR in_zone 'MAR3'
//  Player.InZone($PLAYER_CHAR, 'MAR3')
//jf @SBF_2
004D: jump_if_false @SBF_2
0002: jump @SBF_40

:SBF_40
0001: wait 0 ms
4@ = 1
0A8D: read_memory 0@ size 2 vp 0 store_to 5@
0A8C: write_memory 0@ size 2 val 7974 vp 0
0@ += 2
0A8D: read_memory 0@ size 2 vp 0 store_to 6@
0A8C: write_memory 0@ size 2 val 7977 vp 0    
0@ += 2
0A8D: read_memory 0@ size 2 vp 0 store_to 7@
0A8C: write_memory 0@ size 2 val 9194 vp 0
0@ += 2
0A8D: read_memory 0@ size 2 vp 0 store_to 8@
0A8C: write_memory 0@ size 2 val 9204 vp 0
0@ += 2
0A8D: read_memory 0@ size 2 vp 0 store_to 9@
0A8C: write_memory 0@ size 2 val 9268 vp 0
0@ += 2
0A8D: read_memory 0@ size 2 vp 0 store_to 10@
0A8C: write_memory 0@ size 2 val 9479 vp 0
0@ -= 18
0237: set_gang 7 weapons_to 22 29 5 0
0A8D: read_memory 2@ size 4 vp 0 store_to 3@
0002: jump @SBF_41

:SBF_41
0001: wait 0 ms
0A8D: read_memory 2@ size 4 vp 0 store_to 11@
00D6: if
003B:   11@ == 3@ // (int)
004D: jump_if_false @SBF_50
//jf @SBF_50
0002: jump @SBF_41

:SBF_50
0001: wait 0 ms
00D6: if
  4@ == 1
//jf @SBF_2
004D: jump_if_false @SBF_2
4@ = 0
0A8C: write_memory 0@ size 2 val 5@ vp 2000
0@ += 2
0A8C: write_memory 0@ size 2 val 6@ vp 2000
0@ += 2
0A8C: write_memory 0@ size 2 val 7@ vp 2000
0@ += 2
0A8C: write_memory 0@ size 2 val 8@ vp 0
0@ += 2
0A8C: write_memory 0@ size 2 val 9@ vp 0
0@ += 2
0A8C: write_memory 0@ size 2 val 10@ vp 0
0@ -= 18
0237: set_gang 7 weapons_to 22 22 22 0
0002: jump @SBF_1             

 

ok it works now but theres cops everywhere its like ants, also here's the updated code:

{$CLEO .cs}

//0000: //

03A4: name_thread 'SBF'
0001: wait 100 ms
0@ = 12646972
0@ += 1770
1@ = 12643640
1@ += 888
2@ = 12631144
3@ = 0
4@ = 0
5@ = 0
05@ = 0
06@ = 0
07@ = 0
08@ = 0
09@ = 0
010@ = 0
6@ = 0
7@ = 0
8@ = 0
9@ = 0
10@ = 0
076C: set_zone 'PLS' gang 1 density_to 0
076C: set_zone 'PLS' gang 7 density_to 40
076C: set_zone 'MAR3' gang 7 density_to 40
0746: set_acquaintance 1 of_actors_pedtype 15 to_actors_pedtype 0
0746: set_acquaintance 1 of_actors_pedtype 15 to_actors_pedtype 8
0746: set_acquaintance 1 of_actors_pedtype 8 to_actors_pedtype 15   
0002: jump @SBF_01

:SBF_01
wait 0
Model.Load(7974)
Model.Load(7977)
Model.Load(9194)
Model.Load(9204)
Model.Load(9268)
Model.Load(9479)
wait 0
if and
   Model.Available(7974)
   Model.Available(7977)
   Model.Available(9194)
wait 0
if and
   Model.Available(9204)
   Model.Available(9268)
   Model.Available(9479)
else_jump @SBF_01

:SBF_1
0001: wait 0 ms
00D6: if
  4@ == 0
004D: jump_if_false @SBF_50   
//jf @SBF_50
0002: jump @SBF_2

:SBF_2
0001: wait 0 ms
00D6: if
0583:   player $PLAYER_CHAR in_zone 'PLS' 
//  Player.InZone($PLAYER_CHAR, 'PLS')
//jf @SBF_3
004D: jump_if_false @SBF_3
0002: jump @SBF_40

:SBF_3
0001: wait 0 ms
00D6: if
0583:   player $PLAYER_CHAR in_zone 'MAR3'
//  Player.InZone($PLAYER_CHAR, 'MAR3')
//jf @SBF_2
004D: jump_if_false @SBF_2
0002: jump @SBF_40

:SBF_40
0001: wait 0 ms
4@ = 1
0A8D: read_memory 0@ size 2 vp 0 store_to 05@
0A8C: write_memory 0@ size 2 val 7974 vp 0
0@ += 2
0A8D: read_memory 0@ size 2 vp 0 store_to 06@
0A8C: write_memory 0@ size 2 val 7977 vp 0    
0@ += 2
0A8D: read_memory 0@ size 2 vp 0 store_to 07@
0A8C: write_memory 0@ size 2 val 9194 vp 0
0@ += 2
0A8D: read_memory 0@ size 2 vp 0 store_to 08@
0A8C: write_memory 0@ size 2 val 9204 vp 0
0@ += 2
0A8D: read_memory 0@ size 2 vp 0 store_to 09@
0A8C: write_memory 0@ size 2 val 9268 vp 0
0@ += 2
0A8D: read_memory 0@ size 2 vp 0 store_to 010@
0A8C: write_memory 0@ size 2 val 9479 vp 0
0@ -= 24
0237: set_gang 7 weapons_to 22 29 5 0
0A8D: read_memory 2@ size 4 vp 0 store_to 3@
0002: jump @SBF_41

:SBF_41
0001: wait 0 ms
0A8D: read_memory 2@ size 4 vp 0 store_to 11@
00D6: if
0085: 11@ = 3@ // (int)
004D: jump_if_false @SBF_50
//jf @SBF_50
0002: jump @SBF_41

:SBF_50
0001: wait 0 ms
00D6: if
  4@ == 1
//jf @SBF_2
004D: jump_if_false @SBF_2
4@ = 0
0A8C: write_memory 0@ size 2 val 05@ vp 0
0@ += 2
0A8C: write_memory 0@ size 2 val 06@ vp 0
0@ += 2
0A8C: write_memory 0@ size 2 val 07@ vp 0
0@ += 2
0A8C: write_memory 0@ size 2 val 08@ vp 0
0@ += 2
0A8C: write_memory 0@ size 2 val 09@ vp 0
0@ += 2
0A8C: write_memory 0@ size 2 val 010@ vp 0
0@ -= 24
0237: set_gang 7 weapons_to 22 22 22 0
0002: jump @SBF_1             

EDIT: there is no more cop ants now but it crashes at random

Edited by aryaryan

Instructions:

  • Copy the script from the first post into a new Sanny document.
  • Update that script with the notes from this post.
  • Include all comments and formats. Make no other changes.
  • Post the updated script. Do not post a decompiled version.
17 hours ago, OrionSR said:

Instructions:

  • Copy the script from the first post into a new Sanny document.
  • Update that script with the notes from this post.
  • Include all comments and formats. Make no other changes.
  • Post the updated script. Do not post a decompiled version.

sorry could you be more specific?

my autistic ass can't understand

53 minutes ago, aryaryan said:

sorry could you be more specific?

No, that's as specific as I can be without doing it for you. If you can't follow these instructions there's no point in continuing this conversation.

1 hour ago, OrionSR said:

No, that's as specific as I can be without doing it for you. If you can't follow these instructions there's no point in continuing this conversation.

I'll try to follow your Instructions

Spoiler

Don't be be surprised if it takes me awhile to replie lol

 

Edited by aryaryan

Ok i think this is what you meant, here's the code:

{$CLEO .cs}

//0000: //

03A4: name_thread 'SBF'
0001: wait 100 ms
0@ = 12646972
0@ += 1770
1@ = 12643640
1@ += 828
2@ = 12631144
3@ = 0
4@ = 0
5@ = 0
05@ = 0
06@ = 0
07@ = 0
08@ = 0
09@ = 0
010@ = 0
6@ = 0
7@ = 0
8@ = 0
9@ = 0
10@ = 0
//076C: set_zone 'PLS' gang 1 density_to 0
//076C: set_zone 'PLS' gang 7 density_to 40
//076C: set_zone 'MAR3' gang 7 density_to 40
0746: set_acquaintance 2 of_actors_pedtype 15 to_actors_pedtype 0
0746: set_acquaintance 2 of_actors_pedtype 15 to_actors_pedtype 8
0746: set_acquaintance 2 of_actors_pedtype 8 to_actors_pedtype 15   
0002: jump @SBF_01

:SBF_01
wait 0
Model.Load(7974)
Model.Load(7977)
Model.Load(9194)
Model.Load(9204)
Model.Load(9268)
Model.Load(9479)
wait 0
if and
   Model.Available(7974)
   Model.Available(7977)
   Model.Available(9194)
wait 0
if and
   Model.Available(9204)
   Model.Available(9268)
   Model.Available(9479)
else_jump @SBF_01

:SBF_1
0001: wait 0 ms
00D6: if
  4@ == 0
004D: jump_if_false @SBF_50   
//jf @SBF_50
0002: jump @SBF_2

:SBF_2
0001: wait 0 ms
00D6: if
0583:   player $PLAYER_CHAR in_zone 'PLS' 
//  Player.InZone($PLAYER_CHAR, 'PLS')
//jf @SBF_3
004D: jump_if_false @SBF_3
0002: jump @SBF_40

:SBF_3
0001: wait 0 ms
00D6: if
0583:   player $PLAYER_CHAR in_zone 'MAR3'
//  Player.InZone($PLAYER_CHAR, 'MAR3')
//jf @SBF_2
004D: jump_if_false @SBF_4
0002: jump @SBF_40

:SBF_4
0001: wait 0 ms
00D6: if
0583:   player $PLAYER_CHAR in_zone 'SMB1'
//  Player.InZone($PLAYER_CHAR, 'MAR3')
//jf @SBF_2
004D: jump_if_false @SBF_5
0002: jump @SBF_40

:SBF_5
0001: wait 0 ms
00D6: if
0583:   player $PLAYER_CHAR in_zone 'SMB2'
//  Player.InZone($PLAYER_CHAR, 'MAR3')
//jf @SBF_2
004D: jump_if_false @SBF_4
0002: jump @SBF_40

:SBF_40
0001: wait 0 ms
0A8D: read_memory 2@ size 2 vp 0 store_to 3@
4@ = 1
0A8D: read_memory 0@ size 2 vp 0 store_to 05@
0A8C: write_memory 0@ size 2 val 7974 vp 0
0@ += 2
0A8D: read_memory 0@ size 2 vp 0 store_to 06@
0A8C: write_memory 0@ size 2 val 7977 vp 0    
0@ += 2
0A8D: read_memory 0@ size 2 vp 0 store_to 07@
0A8C: write_memory 0@ size 2 val 9194 vp 0
0@ += 2
0A8D: read_memory 0@ size 2 vp 0 store_to 08@
0A8C: write_memory 0@ size 2 val 9204 vp 0
0@ += 2
0A8D: read_memory 0@ size 2 vp 0 store_to 09@
0A8C: write_memory 0@ size 2 val 9268 vp 0
0@ += 2
0A8D: read_memory 0@ size 2 vp 0 store_to 010@
0A8C: write_memory 0@ size 2 val 9479 vp 0
0@ -= 18
0A8D: read_memory 1@ size 2 vp 0 store_to 8@
0A8C: write_memory 1@ size 2 val 499 vp 0
1@ -= 18
0237: set_gang 1 weapons_to 22 29 5 0
0746: set_acquaintance 4 of_actors_pedtype 8 to_actors_pedtype 0
0002: jump @SBF_41

:SBF_41
0001: wait 0 ms
0A8D: read_memory 2@ size 4 vp 0 store_to 11@
00D6: if
003B:   11@ == 3@ // (int)
//0085: 11@ = 3@ // (int)
004D: jump_if_false @SBF_50
//jf @SBF_50
0002: jump @SBF_41

:SBF_50
0001: wait 0 ms
00D6: if
  4@ == 1
004D: jump_if_false @SBF_2
4@ = 0
0A8C: write_memory 0@ size 2 val 05@ vp 0
0@ -= 6
0A8C: write_memory 0@ size 2 val 06@ vp 0
0@ -= 6
0A8C: write_memory 0@ size 2 val 07@ vp 0
0@ -= 6
0A8C: write_memory 0@ size 2 val 08@ vp 0
0@ -= 6
0A8C: write_memory 0@ size 2 val 09@ vp 0
0@ -= 6
0A8C: write_memory 0@ size 2 val 010@ vp 0
0@ -= 6
0A8C: write_memory 1@ size 2 val 8@ vp 0
1@ -= 6
0237: set_gang 1 weapons_to 22 22 22 0
0002: jump @SBF_1             

 

2 hours ago, aryaryan said:

Ok i think this is what you meant, here's the code:

Nope. You are missing something basic, perhaps because your mind is too focused on the future. You've taken a bad path and need to reset. I tried to make this part easy. It should make sense if you get a proper start. It might help to ask someone with a fresh perspective to read through the instructions; they don't even need to know anything about programming or gaming. 

20 minutes ago, OrionSR said:

Nope. You are missing something basic, perhaps because your mind is too focused on the future. You've taken a bad path and need to reset. I tried to make this part easy. It should make sense if you get a proper start. It might help to ask someone with a fresh perspective to read through the instructions; they don't even need to know anything about programming or gaming. 

ok is THIS what you meant? i can't understand why i can't understand you (lol)

{$CLEO .cs}

03A4: name_thread 'GLENPAR'
:GLENPAR_00 
0001: wait 100 ms 
0006: 0@ = 0xC0F358 // start of ped groups 
//000A: 0@ += 1890
000A: 0@ += 1764  // offset to gang peds group
0006: 1@ = 0xC0ED38 // start of cars groups 
//000A: 1@ += 966 
000A: 1@ += 828  // offset to gang cars group
0006: 2@ = 0xC0BC68  // pointer to current ZoneInfo
0002: jump @GLENPAR_159

:GLENPAR_159

Model.Load(17475)
Model.Load(17499)
Model.Load(17975)
Model.Load(17977)
wait 0
if and
   Model.Available(17475)
   Model.Available(17499)
   Model.Available(17975)
   Model.Available(17977)
else_jump @GLENPAR_159   

:GLENPAR_160
0001: wait 0 ms
00D6: if
    4@ == 0
004D: jump_if_false @GLENPAR_500
0002: jump @GLENPAR_161    

:GLENPAR_161
0001: wait 0 ms
00D6: if
0583:   player $PLAYER_CHAR in_zone 'VERO1' 
//004D: jump_if_false @GLENPAR_161 
004D: jump_if_false @GLENPAR_196
0002: jump @GLENPAR_233

:GLENPAR_196
0001: wait 0 ms
00D6: if
0583:   player $PLAYER_CHAR in_zone 'VERO2'
004D: jump_if_false @GLENPAR_161
jump @GLENPAR_233

:GLENPAR_233
0001: wait 0 ms
0A8D: read_memory 2@ size 2 vp 0 store_to 3@  // save current pointer 
0006: 4@ = 1 
0A8D: read_memory 0@ size 2 vp 0 store_to 5@
0A8C: write_memory 0@ size 2 val 17475 vp 0
//000E: 0@ -= 4 
000E: 0@ -= 6 
0A8D: read_memory 0@ size 2 vp 0 store_to 6@
0A8C: write_memory 0@ size 2 val 17499 vp 0
//000E: 1@ -= 4
000E: 1@ -= 6
0A8D: read_memory 0@ size 2 vp 0 store_to 7@
0A8C: write_memory 0@ size 2 val 17975 vp 0
//000E: 0@ -= 4 
000E: 0@ -= 6 
0A8D: read_memory 0@ size 2 vp 0 store_to 12@
0A8C: write_memory 0@ size 2 val 17977 vp 0
//000E: 1@ -= 4
000E: 1@ -= 6
0A8D: read_memory 1@ size 2 vp 0 store_to 8@
0A8C: write_memory 1@ size 2 val 585 vp 0
000E: 1@ -= 6
0237: set_gang 0 weapons_to 22  30 32 5 0  
jump @GLENPAR_234

:GLENPAR_234
0001: wait 0 ms
0A8D: read_memory 2@ size 4 vp 0 store_to 11@
00D6: if
003B:   11@ == 3@ // (int)
004D: jump_if_false @GLENPAR_500
0002: jump @GLENPAR_234

:GLENPAR_500
0001: wait 0 ms
00D6: if
    4@ == 1
004D: jump_if_false @GLENPAR_161
4@ = 0
0A8C: write_memory 0@ size 2 val 5@ vp 0
0@ -= 6
0A8C: write_memory 0@ size 2 val 6@ vp 0
0@ -= 6
0A8C: write_memory 0@ size 2 val 7@ vp 0
0@ -= 6
0A8C: write_memory 0@ size 2 val 12@ vp 0
1@ -= 6
0A8C: write_memory 1@ size 2 val 8@ vp 0
1@ -= 6 
0237: set_gang 0 weapons_to 5 5 5
0002: jump @GLENPAR_160      

 

31 minutes ago, aryaryan said:

ok is THIS what you meant? i can't understand why i can't understand you (lol)

Um... Much closer, but you've added stuff that wasn't specified and made changes to the zones and models. Don't overthink it.

 

I lost you on changing each -= 4 to -= 6 though. Don't change the += 2 lines. Those are correct and will persist in the next version of the script. But if you can get through this part I'll show you a way to skip the subtraction part so you won't need to do any more math when the script is modified.

 

Same thing with the addresses for 0@ and 1@. Hold off on making changes because the Ballas offsets are 0, they start at the beginning so the math is easier. Stick with me just a little longer and all you'll need to do is change a new variable set to the gang ID (something like, 30@ = 0 // Ballas) and you can just let the game figure out the proper address without any manual calculations.

 

Close enough, however, that I think it's worth the trouble to start writing a better script. Try again, you almost got it.

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
  • 0 User Currently Viewing
    0 members, 0 Anonymous, 0 Guests

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.