{
  use macro (Ctrl+J) "headsa"
  to insert a file header      
}
{$VERSION 3.1.0000}

thread 'MAIN'
var              
 $PLAYER_CHAR: Player 
end // var
01F0: set_max_wanted_level_to 6 
set_wb_check_to 0 
00C0: set_current_time 8 0 
04E4: unknown_refresh_game_renderer_at 824.0641 -1794.8955 
Camera.SetAtPos(824.0641, -1794.8955, 13.8142)
$PLAYER_CHAR = Player.Create(#NULL, 824.0641, -1794.8955, 13.8142)
$PLAYER_ACTOR = Actor.EmulateFromPlayer($PLAYER_CHAR)
07AF: $PLAYER_GROUP = player $PLAYER_CHAR group
Camera.SetBehindPlayer
set_weather 0          
wait 0 ms                                
$PLAYER_CHAR.SetClothes("PLAYER_FACE", "HEAD", Head)
$PLAYER_CHAR.SetClothes("JEANSDENIM", "JEANS", Legs)
$PLAYER_CHAR.SetClothes("SNEAKERBINCBLK", "SNEAKER", Shoes)
$PLAYER_CHAR.SetClothes("VEST", "VEST", Torso)
$PLAYER_CHAR.Build
$PLAYER_CHAR.CanMove = True
fade 1 (out) 0 ms                     
select_interior 0
0629: change_stat 181 (islands unlocked) to 4
016C: restart_if_wasted at 2027.77 -1420.52 15.99 angle 137.0 town_number 0
016D: restart_if_busted at 1550.68 -1675.49 14.51 angle 90.0 town_number 0
0180: set_on_mission_flag_to $ONMISSION // Note: your missions have to use the variable defined here ($ONMISSION)
03E6: remove_text_box
// put your create_thread commands here

create_thread @CHEATER

end_thread

// put your mods (threads) here





:CHEATER
thread 'CHEATER'
{

  WHAT are the DIFFERENCES between v1.0 and v1.01 :

  - SCM BASE ADDRESS  (necessary for the variables position in the arrays and function parameters)
  - 0572 proc address (what we change to run the asm code)
  - CheatProc         (what we call with asm inject)

                v1.0       v1.1
       --------------------------------        
       SCM   0xA49960   0xA4BFE0  +9856
 CheatProc   0x438370   0x4383F0  +128
 0572 Addr   -429863    -431117   +1254

}


alloc($_cheatindex, 76)
alloc($_cheatproc, 77)
03C4: set_status_text_to $_cheatindex 0 'FEC_NMN'
 $_cheatindex = -1

 // TEST IF PLAYER PRESS AN ACTION KEY
 while true
  wait 250
  if and
    00E1:  key_pressed 0 4
    $_cheatindex <= 90
  then

    // KEY PRESSED

    // INC CHEAT NUMBER, CALL NEXT CHEAT
    inc($_cheatindex)
    
    // CHECK SA VERSION
    0@ = -429566
    if
      // ADDRESS THAT DIFFERS IN V1.0 AND V.1.01  
      &0(0@,1i) == 4611680
    then
      // VERSION 1.00

      // SET CHEAT PROC ADDRESS TO CALL
      $_cheatproc = 0x438370
      
      // SET 0572 ADDRESS TO ASM INJECT POSITION                 
      0@ = -429863
      &0(0@,1i) =  0xA49960
      &0(0@,1i) += @_cheatproc10
    else      
      // VERSION 1.01

      // SET CHEAT PROC ADDRESS TO CALL
      $_cheatproc = 0x4383F0

      // SET 0572 ADDRESS TO ASM INJECT POSITION
      0@ = -431117
      &0(0@,1i) =  0xA4BFE0
      &0(0@,1i) += @_cheatproc11    // set the injection v1.01 address    
    end

    // RUN 0572 PROC i.e. RUN ASM CODE
    0572: 1

    // CHEAT PROC DOESN'T SHOW THE MSG ITSELF, SO WE SHOW IT MANUALLY
    03E5: text_box 'CHEAT1'
    wait 1000
  end 
 end
:_cheatproc10
// ASM INJECTION FOR V.1.0
hex 
 FF 35 909AA400                     // push dword ptr [0xA49960+$_cheatindex*4] ScmBase+4*$
 FF 15 949AA400                     // call dword ptr [0xA49960+$_cheatproc*4]  ScmBase+4*$
 83 C4 04                           // add esp, 4
 C3                                 // return
end
:_cheatproc11
// ASM INJECTION FOR V.1.01
hex 
 FF 35 10C1A400                     // push dword ptr [0xA4BFE0+$_cheatindex*4] ScmBase+4*$
 FF 15 14C1A400                     // call dword ptr [0xA4BFE0+$_cheatproc*4]  ScmBase+4*$
 83 C4 04                           // add esp, 4
 C3                                 // return
end


//-------------Mission 0---------------
// put your missions here
