
//{$VERSION 3.1.0027}
{$CLEO .cs}

//-------------MAIN---------------
thread 'clonecs'

:NONAME_2
       wait 0

        if and
            00E1:   player 0 pressed_key 19
            00E1:   player 0 pressed_key 4 
            856D:   not actor 3@ defined
            8A0C:   not player $PLAYER_CHAR on_jetpack 
        then  
            060A: create_decision_maker_type 2 store_to 19@ // decision\allowed\m_.ped files
            06AE: create_group_decision_maker_type 0 store_to 20@ // decision\allowed\mission.grp
            0665: get_actor $PLAYER_ACTOR model_to 27@
            if
                80DF:   not actor $PLAYER_ACTOR driving
            then     
            0208: 0@ = random_float_in_ranges -2.0 2.0
            0208: 1@ = random_float_in_ranges 0.0 3.0 
            04C4: store_coords_to 0@ 1@ 2@ from_actor $PLAYER_ACTOR with_offset 0@ 1@ 5.0 
            0503: create_actor_on_rope_with_pedtype 26 model 27@ at 0@ 1@ 2@ handle_as 3@
            end
            if
                00DF:   actor $PLAYER_ACTOR driving                
            then
                03C0: 22@ = actor $PLAYER_ACTOR car
                009A: 3@ = create_actor_pedtype 26 model 27@ at 0.0 0.0 0.0 

                if
                    0431:  car 22@ passenger_seat_free 0
                then
                    0430: put_actor 3@ into_car 22@ passenger_seat 0  
                else
                    if
                        0431:  car 22@ passenger_seat_free 1
                    then
                        0430: put_actor 3@ into_car 22@ passenger_seat 1
                    else
                    if
                        0431:  car 22@ passenger_seat_free 3
                    then
                        0430: put_actor 3@ into_car 22@ passenger_seat 2
                    else
                        03E5: show_text_box 'CLFAIL'
                    end   
                end
            end
        end
        0470: 24@ = actor $PLAYER_ACTOR current_weapon
        01B2: give_actor 3@ weapon 24@ ammo 9999
        0226: 25@ = actor $PLAYER_ACTOR health 
        04DD: 26@ = actor $PLAYER_ACTOR armour 
        0A96: 6@ = actor $PLAYER_ACTOR struct
        6@ += 1348
        0AB3: var 1 = 3@
        060B: set_actor 3@ decision_maker_to 19@
        06AD: set_group $PLAYER_GROUP group_decision_maker_to 20@
        077A: set_actor 3@ acquaintance 0 to_actors_pedtype 0
        077A: set_actor 3@ acquaintance 1 to_actors_pedtype 8
        077A: set_actor 3@ acquaintance 0 to_actors_pedtype 13
        077A: set_actor 3@ acquaintance 1 to_actors_pedtype 14
        077A: set_actor 3@ acquaintance 2 to_actors_pedtype 18
        077A: set_actor 3@ acquaintance 2 to_actors_pedtype 19
        077A: set_actor 3@ acquaintance 3 to_actors_pedtype 6
        077A: set_actor 3@ acquaintance 4 to_actors_pedtype 7
        077A: set_actor 3@ acquaintance 4 to_actors_pedtype 9
        077A: set_actor 3@ acquaintance 3 to_actors_pedtype 10
        077A: set_actor 3@ acquaintance 3 to_actors_pedtype 11
        077A: set_actor 3@ acquaintance 3 to_actors_pedtype 12
        077A: set_actor 3@ acquaintance 4 to_actors_pedtype 15
        077A: set_actor 3@ acquaintance 4 to_actors_pedtype 16
        077A: set_actor 3@ acquaintance 4 to_actors_pedtype 17
        077A: set_actor 3@ acquaintance 4 to_actors_pedtype 20
        077A: set_actor 3@ acquaintance 4 to_actors_pedtype 21
        077A: set_actor 3@ acquaintance 4 to_actors_pedtype 23
        077A: set_actor 3@ acquaintance 4 to_actors_pedtype 24
        077A: set_actor 3@ acquaintance 4 to_actors_pedtype 25
        077A: set_actor 3@ acquaintance 2 to_actors_pedtype 26
        077A: set_actor 3@ acquaintance 4 to_actors_pedtype 27
        077A: set_actor 3@ acquaintance 4 to_actors_pedtype 28
        077A: set_actor 3@ acquaintance 4 to_actors_pedtype 29
        077A: set_actor 3@ acquaintance 4 to_actors_pedtype 30
        077A: set_actor 3@ acquaintance 4 to_actors_pedtype 31
        0746: set_acquaintance 1 of_actors_pedtype 8 to_actors_pedtype 26
        0746: set_acquaintance 4 of_actors_pedtype 6 to_actors_pedtype 26
        0746: set_acquaintance 2 of_actors_pedtype 13 to_actors_pedtype 26
        0746: set_acquaintance 2 of_actors_pedtype 14 to_actors_pedtype 26
        0746: set_acquaintance 3 of_actors_pedtype 23 to_actors_pedtype 26
        0746: set_acquaintance 3 of_actors_pedtype 24 to_actors_pedtype 26
        0746: set_acquaintance 3 of_actors_pedtype 25 to_actors_pedtype 26
        0746: set_acquaintance 3 of_actors_pedtype 27 to_actors_pedtype 26
        0746: set_acquaintance 3 of_actors_pedtype 28 to_actors_pedtype 26
        0746: set_acquaintance 3 of_actors_pedtype 29 to_actors_pedtype 26
        0746: set_acquaintance 3 of_actors_pedtype 30 to_actors_pedtype 26
        0746: set_acquaintance 3 of_actors_pedtype 31 to_actors_pedtype 26
        0746: set_acquaintance 4 of_actors_pedtype 7 to_actors_pedtype 26
        0746: set_acquaintance 4 of_actors_pedtype 9 to_actors_pedtype 26
        07DD: set_actor 3@ temper_to 100 // see pedstats.dat 
        04D8: set_actor 3@ drowns_in_water 0  
        02E2: set_actor 3@ weapon_accuracy_to 245
        060F: set_actor 3@ melee_accuracy_to 100.0
        02AB: set_actor 3@ immunities BP 0 FP 0 EP 0 CP 1 MP 0   
        035F: actor 3@ armour += 26@
        0223: set_actor 3@ health_to 25@ 
        0446: set_actor 3@ immune_to_headshots 0
        087E: set_actor 3@ weapon_droppable 1
        08F5: save_player_group 
        062F: 07AF: 11@ = player $PLAYER_CHAR group 
        07AF: $PLAYER_GROUP = player $PLAYER_CHAR group 
        0630: put_actor 3@ in_group 11@ as_leader 
        0631: put_actor 3@ in_group $PLAYER_GROUP
        08F6: restore_player_group 
        0568: set_actor 3@ targetable 1
        0245: set_actor 3@ walk_style_to "PLAYER" 
        03E5: show_text_box 'CLONE'
        065C: release_decision_maker 19@
        0390: load_txd_dictionary 'CLONE'
        038F: load_texture "clbar" as 1 // Load dictionary with 0390 first
        038F: load_texture "clbro" as 2
        038F: load_texture "cjcap" as 3
        038F: load_texture "carcap" as 4
        038F: load_texture "clbru" as 5
        03F0: enable_text_draw 1
        26@ = 4 
        27@ = 0
        19@ = 2
        29@ = 40.0
        32@ = 0
        33@ = 0
        21@ = 0.0 
end
   

// free vars 30@ 11@ 12@ 
//////////////////////////////actor creation and basic autonamy

////////////////////////if killed
if and
    056D:   actor 3@ defined
    0118:   actor 3@ dead
then 
    01B9: set_actor 3@ armed_weapon_to 0 
    034F: destroy_actor_with_fade 3@
    01C2: remove_references_to_actor 3@
    0391: release_txd_dictionary
    03F0: enable_text_draw 0  
    //20@ = 0 
    wait 2500
end 
/////////////////////  if left behind
if and
    056D:   actor 3@ defined
    4@ <> 1
    30@ == 0
    8118:   not actor 3@ dead
    86EE:   not actor 3@ in_group $PLAYER_GROUP 
then
    01B9: set_actor 3@ armed_weapon_to 0
    034F: destroy_actor_with_fade 3@
    01C2: remove_references_to_actor 3@
    0391: release_txd_dictionary
    03F0: enable_text_draw 0  
    wait 2500
end
////////////////////////woraround fix  
if or 
    00DD:   actor $PLAYER_ACTOR driving_car_with_model #RHINO
    00DD:   actor $PLAYER_ACTOR driving_car_with_model #SHAMAL
    00DD:   actor $PLAYER_ACTOR driving_car_with_model #NEVADA
    00DD:   actor $PLAYER_ACTOR driving_car_with_model #HYDRA
    00DD:   actor $PLAYER_ACTOR driving_car_with_model #RUSTLER
then 
    jump @wrkarndfix
end 
/////////////////////if otherwise destroyed/inactive
if
    856D:   not actor 3@ defined
then
    065C: release_decision_maker 19@
    //0237: set_gang 1 weapons_to 0 22 32
    0746: set_acquaintance 0 of_actors_pedtype 6 to_actors_pedtype 26
    0746: set_acquaintance 0 of_actors_pedtype 8 to_actors_pedtype 26 // see ped.dat
    0746: set_acquaintance 0 of_actors_pedtype 7 to_actors_pedtype 26
    0746: set_acquaintance 0 of_actors_pedtype 9 to_actors_pedtype 26
    0746: set_acquaintance 0 of_actors_pedtype 13 to_actors_pedtype 26
    0746: set_acquaintance 0 of_actors_pedtype 14 to_actors_pedtype 26
    0746: set_acquaintance 0 of_actors_pedtype 23 to_actors_pedtype 26
    0746: set_acquaintance 0 of_actors_pedtype 24 to_actors_pedtype 26
    0746: set_acquaintance 0 of_actors_pedtype 25 to_actors_pedtype 26
    0746: set_acquaintance 0 of_actors_pedtype 26 to_actors_pedtype 26
    0746: set_acquaintance 0 of_actors_pedtype 27 to_actors_pedtype 26
    0746: set_acquaintance 0 of_actors_pedtype 28 to_actors_pedtype 26
    0746: set_acquaintance 0 of_actors_pedtype 29 to_actors_pedtype 26
    0746: set_acquaintance 0 of_actors_pedtype 30 to_actors_pedtype 26
    0746: set_acquaintance 0 of_actors_pedtype 31 to_actors_pedtype 26 
    0AB3: var 1 = 0 
    if
        28@ > 0
    then
        0792: disembark_instantly_actor $PLAYER_ACTOR
        0465: remove_actor $PLAYER_ACTOR from_turret_mode
        015A: restore_camera 
        02AB: set_actor $PLAYER_ACTOR immunities BP 0 FP 0 EP 0 CP 0 MP 0 
        082A: set_player $PLAYER_CHAR able_to_use_crouch_button 1
        07CC: set_player $PLAYER_CHAR button_15 1 
    end    
    27@ = 0
    28@ = 0
    23@ = 0
    30@ = 0
end
////////////////destroy actor
if and
    056D:   actor 3@ defined
    80DF:   not actor $PLAYER_ACTOR driving  
    //8AAB:  not file_exists "cleo\explode.cs"
    0AB0:  key_pressed 0x4B
then
    0687: clear_actor 3@ task
    01B9: set_actor 3@dtype 26
    0746: set_acquaintance 0 of_actors_pedtype 29 to_actors_pedtype 26
    0746: set_acquaintance 0 of_actors_pedtype 30  
    wait 2500
    jump @NONAME_2
end
//////////////////////escort bugfixes 1
if and
    28@ > 0
    856D:   not actor 3@ defined 
then
    0465: remove_actor $PLAYER_ACTOR from_turret_mode
    0687: clear_actor $PLAYER_ACTOR task
    0792: disembark_instantly_actor $PLAYER_ACTOR
    017B: set_actor $PLAYER_ACTOR weapon 24@ ammo_to 7@  
    020A: set_car 22@ door_status_to 0
    07CC: set_player $PLAYER_CHAR button_15 1
    09B9: show_entered_car_name 1
    01C3: remove_references_to_car 22@
    28@ = 0
    23@ = 0 
end 

////////////////////mission incompatability fix
0AAA: 6@ = thread 'ZERO4' pointer
while 6@ <> 0
    0AAA: 6@ = thread 'ZERO4' pointer
    wait 100
end
6@ = 0
  
/////////////////////jump to next label
if
    056D:   actor 3@ defined
then
    jump @weapons
end    
jump @NONAME_2

:weapons
//if and
//    00DF:   actor $PLAYER_ACTOR driving 
//    0491:   actor $PLAYER_ACTOR has_weapon 37
//    856E:   not car 22@ defined 
//then
//    03C0: 22@ = actor $PLAYER_ACTOR car
//    02AC: set_car 22@ immunities BP 0 FP 1 EP 0 CP 0 MP 0
//end 
//if and
//    80DF:   not actor $PLAYER_ACTOR driving 
//    056E:   car 22@ defined
//then
//    01C3: remove_references_to_car 22@
//end
03F0: enable_text_draw 1
//////////////////////// if i die/am caught
if or
    0118:   actor $PLAYER_ACTOR dead                                                               
    0741:   actor $PLAYER_ACTOR busted 
then
    087E: set_actor 3@ weapon_droppable 0
    0321: kill_actor 3@
end
//////////////////////////////////////////////////////////////////////var declaration
if
    28@ == 0
then
    0470: 24@ = actor $PLAYER_ACTOR current_weapon
else
    if
        047A:   actor $PLAYER_ACTOR driving_bike
    then 
        08C6: set_actor 3@ stay_on_bike 1 
        08C6: set_actor $PLAYER_ACTOR stay_on_bike 1
    end
end
    //01C0: $PLAYER_WANTED_LEVEL = player $PLAYER_CHAR wanted_level
    
    //0AB3: var 6 = 27@
    0A96: 6@ = actor $PLAYER_ACTOR struct
    6@ += 1348
    0A8D: 6@ = read_memory 6@ size 4 virtual_protect 0   
    017B: set_actor 3@ weapon 24@ ammo_to 5000 
    0226: 9@ = actor 3@ health
    008F: 9@ = integer 9@ to_float 
    8@=100.0
    0073: 8@ /= 6@
    006b: 9@ *= 8@
    9@ *= 0.6
    //0090: $ZERO4_TIME = float $ZERO4_TIME to_integer 
    04DD: 10@ = actor 3@ armour
    008F: 10@ = integer 10@ to_float
    10@ *= 0.6
    /////////////////////////////////////////remove armour bar when it reaches zero / draw armour string/txd
074B: draw_texture 3 position 455.0 30.5 scale 10.0 20.0 angle 0.0 color_RGBA 255 255 255 255    
if and
    10@ > 0
    86B9:   not cutscene_data_loaded
then
//    0349: set_text_draw_font 3
//    0340: set_text_draw_RGBA 255 255 255 255
//    0343: set_text_draw_linewidth 1040.0
//    045A: draw_text_1number 390.5 25.5 GXT 'CARMOUR' number $ZERO4_Car_Health
    8@ = 450.5
    0087: 6@ = 10@
    6@ /= 2.0
    0063: 8@ += 6@ // (float)
    074B: draw_texture 5 position 420.5 25.5 scale 60.0 6.0 angle 0.0 color_RGBA 255 255 255 255
    074B: draw_texture 1 position 8@ 25.5 scale 10@ 6.0 angle 0.0 color_RGBA 255 255 255 255
    074B: draw_texture 2 position 420.5 25.5 scale 60.0 6.0 angle 0.0 color_RGBA 255 255 255 255
end 

if
    86B9:   not cutscene_data_loaded
then
//    0349: set_text_draw_font 3
//    0340: set_text_draw_RGBA 180 25 29 255        //B4191DFF
//    0343: set_text_draw_linewidth 1040.0
//    045A: draw_text_1number 390.5 35.5 GXT 'CHEALTH' number $ZERO4_TIME
//6@ += 390.5 
    8@ = 450.5
    0087: 6@ = 9@
    6@ /= 2.0
    0063: 8@ += 6@ // (float)

if
    10@ > 0
then
    074B: draw_texture 5 position 420.5 35.5 scale 60.0 6.0 angle 0.0 color_RGBA 255 255 255 255
    if
        0184:   actor 3@ health >= 10 
    then
        074B: draw_texture 1 position 8@ 35.5 scale 9@ 6.0 angle 0.0 color_RGBA 180 25 29 255
    else
        074B: draw_texture 1 position 8@ 35.5 scale 9@ 6.0 angle 0.0 color_RGBA 50 50 50 255
    end
    074B: draw_texture 2 position 420.5 35.5 scale 60.0 6.0 angle 0.0 color_RGBA 255 255 255 255
else
    074B: draw_texture 5 position 420.5 30.5 scale 60.0 6.0 angle 0.0 color_RGBA 255 255 255 255
    if
        0184:   actor 3@ health >= 10 
    then
        074B: draw_texture 1 position 8@ 30.5 scale 9@ 6.0 angle 0.0 color_RGBA 180 25 29 255
    else
        074B: draw_texture 1 position 8@ 30.5 scale 9@ 6.0 angle 0.0 color_RGBA 0 0 0 255
    end
    074B: draw_texture 2 position 420.5 30.5 scale 60.0 6.0 angle 0.0 color_RGBA 255 255 255 255
end
//074B: draw_texture 5 position 0@ 35.5 scale 10.0 10.0 angle 0.0 color_RGBA 255 255 255 122 

end

if
    28@ > 0
then
    0AB6: store_target_marker_coords_to 0@ 1@ 2@ // IF and SET
end
if and
    28@ > 0
    30@ == 0
    17@ > 0 
    04C8:   actor 3@ driving_flying_vehicle 
    8AB6: not store_target_marker_coords_to 0@ 1@ 2@
then
    if
        04A9:   actor 3@ driving_heli    
    then
        0208: 0@ = random_float_in_ranges -3.0 3.0
        005B: 0@ += 21@
        0407: store_coords_to 0@ 1@ 2@ from_car 22@ with_offset 0@ 35.0 0.0
        02CE: 2@ = ground_z_at 0@ 1@ 2@
        //02C1: store_to 0@ 1@ 2@ car_path_coords_closest_to 0@ 1@ 2@ 
        //02CE: 2@ = ground_z_at 0@ 1@ 2@ 
    end 
    if
        04AB:   actor 3@ driving_plane     
    then
    
        0494: get_joystick 0 data_to 0@ 1@ 6@ 6@ //first stick, horizontal vertical, secondstick, horizontal vertical
        if
            0@ == 0 
        then
            0208: 0@ = random_float_in_ranges -7.0 7.0
            005B:0@ += 21@
        else
            008F: 0@ = integer 0@ to_float
        end 
        0407: store_coords_to 0@ 1@ 2@ from_car 22@ with_offset 0@ 50.0 0.0
        02CE: 2@ = ground_z_at 0@ 1@ 2@
    end 
end    
if
    80DF:   not actor 3@ driving
then    
    09E8: 18@ = actor 3@ active_interior
    //0AAA: 14@ = thread 'PARACH' pointer
    //0@ = 27@ 1@=28@ 2@=29@
    // 7@=23@ 8@=24@ 9@=25@
end    
if //or
    28@ > 0
    //30@ > 1
then 
    0227: 10@ = car 22@ health
    0014: 10@ /= 10
    008F: 10@ = integer 10@ to_float
    10@ *= 0.6
    8@ = 450.5
    0087: 6@ = 10@
    6@ /= 2.0
    0063: 8@ += 6@ // (float)
    074B: draw_texture 5 position 420.5 60.5 scale 60.0 6.0 angle 0.0 color_RGBA 255 255 255 255
    if
        0185:   car 22@ health >= 250 
    then
        074B: draw_texture 1 position 8@ 60.5 scale 10@ 6.0 angle 0.0 color_RGBA 180 25 29 255
    else
        074B: draw_texture 1 position 8@ 60.5 scale 10@ 6.0 angle 0.0 color_RGBA 50 50 50 255
    end
    074B: draw_texture 4 position 455.5 55.5 scale 10.0 20.0 angle 0.0 color_RGBA 255 255 255 255
    074B: draw_texture 2 position 420.5 60.5 scale 60.0 6.0 angle 0.0 color_RGBA 255 255 255 255
//    0349   then
    
        0494: get_joystick 0 data_to 0@ 1@ 6@ 6@ //first stick, horizontal vertical, secondstick, horizontal vertical
        if
            0@ == 0 
60.5 GXT 'CLRHTH' number $DANCE_SCORE
end 

if and
    28@ > 0
    30@ == 0
    04A9:   actor 3@ driving_heli
    86B9:   not cutscene_data_loaded 
then
    0819: 25@ = actor 3@ distance_from_ground
    04A2: set_heli 22@ fly_to 0@ 1@ 2@ altitude_between 0.0 and 17@
    8@ = 450.5
    0087: 6@ = 17@
    6@ /= 2.0 
    6@ *= 0.6
    0087: 10@ = 6@
    10@ *= 0.5
    0063: 8@ += 10@ // (float)
    074B: draw_texture 5 position 420.5 50.5 scale 60.0 6.0 angle 0.0 color_RGBA 255 255 255 255
    074B: draw_texture 1 position 8@ 50.5 scale 6@ 6.0 angle 0.0 color_RGBA 255 255 255 255
    074B: draw_texture 2 position 420.5 50.5 scale 60.0 6.0 angle 0.0 color_RGBA 255 255 255 255
    
//    0088: $7424 = 17@ // (float) 
//    0015: $7424 /= 2.0 
//    008C: $7424 = float 10@ to_integer
//    0349: set_text_draw_font 3
//    0340: set_text_draw_RGBA 255 255 255 255
//    0343: set_text_draw_linewidth 1040.0
//    045A: draw_text_1number 390.5 60.5 GXT 'DRVALT' number $7424
end
if and
    28@ > 0
    04AB:   actor 3@ driving_plane
    86B9:   not cutscene_data_loaded  
then
    04D2: set_plane 22@ fly_autopilot_around_point 0@ 1@ 2@ altitude_between 0.0 and 17@
    8@ = 450.5
    0087: 6@ = 17@
    6@ /= 5.0 
    6@ *= 0.6
    0087: 10@ = 6@
    10@ *= 0.5
    0063: 8@ += 10@ // (float)
    074B: draw_texture 5 position 420.5 50.5 scale 60.0 6.0 angle 0.0 color_RGBA 255 255 255 255
    074B: draw_texture 1 position 8@ 50.5 scale 6@ 6.0 angle 0.0 color_RGBA 255 255 255 255
    074B: draw_texture 2 position 420.5 50.5 scale 60.0 6.0 angle 0.0 color_RGBA 255 255 255 255
      
//    0088: $7424 = 17@ // (float) 
//    0015: $7424 /= 5.0 
//    008C: $7424 = float 17@ to_integer
//    0349: set_text_draw_font 3
//    0340: set_text_draw_RGBA 255 255 255 255
//    0343: set_text_draw_linewidth 1040.0
//    045A: draw_text_1number 390.5 60.5 GXT 'DRVALT' number $7424
end
if and
    28@ > 0
    84C8:   not actor 3@ driving_flying_vehicle
    86B9:   not cutscene_data_loaded
then   
    if and
        19@ == 4
        23@ == 1
    then
        00A7: car 22@ drive_to 0@ 1@ 2@
    end
    if and
        19@ == 2
        23@ == 1
    then
        0704: car 22@ drive_to 0@ 1@ 2@ 
    end
    {if
        19@ == 4
    then
        00A9: set_car 22@ to_normal_driver
    end}
//    0088: $7424 = 29@ // (float)
//    0015: $7424 /= 0.6 
//    008C: $7424 = float $7424 to_integer
//    0349: set_text_draw_font 3
//    0340: set_text_draw_RGBA 255 255 255 255
//    0343: set_text_draw_linewidth 1040.0
//    045A: draw_text_1number 390.5 60.5 GXT 'DRVSPD' number $7424
    8@ = 450.5
    0087: 6@ = 29@ 
    6@ /= 2.0
    0087: 10@ = 6@
    10@ /= 2.0
    0063: 8@ += 10@ // (float)
    074B: draw_texture 5 position 420.5 50.5 scale 60.0 6.0 angle 0.0 color_RGBA 255 255 255 255
    074B: draw_texture 1 position 8@ 50.5 scale 6@ 6.0 angle 0.0 color_RGBA 255 255 255 255
    074B: draw_texture 2 position 420.5 50.5 scale 60.0 6.0 angle 0.0 color_RGBA 255 255 255 255
end
//////////////get car to follow
if and
    00DF:   actor 3@ driving
    //0AB0:   key_pressed 118
    84C8:   not actor 3@ driving_flying_vehicle
    23@ == 0
    28@ > 0
then    
    04C4: store_coords_to 14@ 15@ 16@ from_actor 3@ with_offset 0.0 15.0 0.0
    073E: get_car_in_sphere 14@ 15@ 16@ radius 8.0 model -1 handle_as 20@
end
////////////////interiors    
if and
    80DF:   not actor 3@ driving
    803C:   not  $ACTIVE_INTERIOR == 18@
    86B9:   not cutscene_data_loaded 
then
    wait 2500
    04C4: store_coords_to 0@ 1@ 2@ from_actor $PLAYER_ACTOR with_offset 0.5 -0.7 0.0
    02CE: 2@ = ground_z_at 0@ 1@ 2@ 
    0860: link_actor 3@ to_interior $ACTIVE_INTERIOR 
    00A1: put_actor 3@ at 0@ 1@ 2@ 
end    

////////////////////////////////////////set clone hitman 
//
//if
//    $5272 == 1                             
//then
//    081A: set_actor 3@ weapon_skill_to 2
//else
//    081A: set_actor 3@ weapon_skill_to 1
//end
0470: 8@ = actor 3@ current_weapon
if and
    8@ < 32
    8@ > 21
then
    8@ += 47 
    0653: 9@ = float_stat 8@
    if
        9@ > 999.0
    then 
        081A: set_actor 3@ weapon_skill_to 2
    else
        081A: set_actor 3@ weapon_skill_to 1
    end
end
if
    8@ == 32
then
    0653: 9@ = float_stat 76
    if
        9@ > 999.0
    then 
        081A: set_actor 3@ weapon_skill_to 2
    else
        081A: set_actor 3@ weapon_skill_to 1
    end
end
/////////////////////////////////////////don't drop guns if killed on purpose
if or
    0118:   actor $PLAYER_ACTOR dead
    051A:   actor 3@ damaged_by_actor $PLAYER_ACTOR
then
    087E: set_actor 3@ weapon_droppable 0
END

/////////////////////////////////////////statchel charge bugfix

if and
    8118:   not actor 3@ dead
    0491:   actor 3@ has_weapon 40
    27@ <> 1
then 
    0555: remove_weapon 40 from_actor 3@
    01B2: give_actor $PLAYER_ACTOR weapon 40 ammo 1
    //01B9: set_actor $PLAYER_ACTOR armed_weapon_to 40 
end 

////////////////////////////////////////////////////////////////////////////////////////////weapon updating/switching/locking
/////////updating
if and
    8118:   not actor 3@ dead
    //8491:   not actor 3@ has_weapon 24@
    82D8:   not actor $PLAYER_ACTOR current_weapon == 40
    80DF:   not actor $PLAYER_ACTOR driving 
    89DE:   not actor $PLAYER_ACTOR entering_car
    27@ <> 1
    28@ == 0
then
    01B2: give_actor 3@ weapon 24@ ammo 9999
end 
/////////switching  
if and
    8118:   not actor 3@ dead
    0491:   actor 3@ has_weapon 24@
    80DF:   not actor $PLAYER_ACTOR driving 
    89DE:   not actor $PLAYER_ACTOR entering_car
    82D8:   not actor $PLAYER_ACTOR current_weapon == 40
    27@ <> 1
    28@ == 0
then
    01B9: set_actor 3@ armed_weapon_to 24@
    017B: set_actor 3@ weapon 24@ ammo_to 9999  
end
////////////////////////////////////////satchel charge bugfix bugfix
if and
    056D:   actor 3@ defined
    02D8:   actor $PLAYER_ACTOR current_weapon == 40     
    0491:   actor 3@ has_weapon 39
then
    01B9: set_actor 3@ armed_weapon_to 39
end
if and
    056D:   actor 3@ defined
    82D8:   not actor 3@ current_weapon == 39     
then
    02AB: set_actor 3@ immunities BP 0 FP 0 EP 0 CP 1 MP 0
end 
if and
    056D:   actor 3@ defined
    02D8:   actor 3@ current_weapon == 39     
then
    02AB: set_actor 3@ immunities BP 1 FP 1 EP 1 CP 1 MP 1
end   
///////////locking
if and
    00E1:   player 0 pressed_key 19
    00E1:   player 0 pressed_key 4 
    80E1:   not player 0 pressed_key 1
    80E1:   not player 0 pressed_key 0
    28@ == 0
then
    if and
        27@ == 1
        32@ > 1000
        80DF:   not actor $PLAYER_ACTOR driving
        89DE:   not actor $PLAYER_ACTOR entering_car 
    //    00E1:   player 0 pressed_key 16
    //    80E1:   not player 0 pressed_key 1
    //    80E1:   not player 0 pressed_key 0
    then
        27@ = 0 
        03E5: show_text_box 'UNLKCLN'
        //wait 1000
        //0AB3: var 6 = 27@
        32@ = 0
    end

    if and
        27@ == 0
        32@ > 1000
        80DF:   not actor $PLAYER_ACTOR driving
        89DE:   not actor $PLAYER_ACTOR entering_car 
    then
        27@ = 1
        03E5: show_text_box 'LOCKCLN'
        //0AB3: var 6 = 27@
        32@ = 0
    end
end
///////////////////////////////////////////////////select ped
//if
//    056D:   actor 30@ defined 
//then
//    04C4: store_coords_to 0@ 1@ 2@ from_actor 30@ with_offset 0.0 0.0 0.0 
//    09E5: create_flash_light_at 0@ 1@ 2@ RGB_mask 255 255 255 radius 10.0 
//end

       
//////////////////////////////////////////////////switch seats
if and
    056D:   actor 3@ defined
    00DF:   actor $PLAYER_ACTOR driving
    0449:   actor 3@ in_a_car 
    00E1:   player 0 pressed_key 11
    30@ == 0
    28@ <> 1
    32@ > 1000
then
    03C0: 22@ = actor $PLAYER_ACTOR car
    09B9: show_entered_car_name 0 
    0792: disembark_instantly_actor $PLAYER_ACTOR  
    0687: clear_actor 3@ task
    036A: put_actor 3@ in_car 22@ 
    //072B: put_actor $PLAYER_ACTOR into_car 22@ passengerseat -1
    if or
        0137:   car 22@ model == #STRETCH
        0137:   car 22@ model == #STAFFORD
        056C:   actor 3@ driving_police_car 
        0137:   car 22@ model == #MAVERICK
        0137:   car 22@ model == #POLMAV
        0602:   actor 3@ driving_taxi
    then
        if
            0431:  car 22@ passenger_seat_free 2                                                              
        then
            072B: put_actor $PLAYER_ACTOR into_car 22@ passengerseat 2
        else
            if
                0431:  car 22@ passenger_seat_free 3
            then
                072B: put_actor $PLAYER_ACTOR into_car 22@ passengerseat 3
            else
                072B: put_actor $PLAYER_ACTOR into_car 22@ passengerseat -1
            end
        end 
    else
        072B: put_actor $PLAYER_ACTOR into_car 22@ passengerseat -1    
    end   
    04B8: get_weapon_data_from_actor $PLAYER_ACTOR weapon_group 5 weapon 24@ ammo 7@ model 6@ 
    017B: set_actor $PLAYER_ACTOR weapon 24@ ammo_to 200000    
    020A: set_car 22@ door_status_to 4   
    00AE: set_car 22@ traffic_behaviour_to 19@ //2 pass, mission paths // 1 ram traffic //4 merge w/ traffic
    07CC: set_player $PLAYER_CHAR button_15 0
    29@ = 25.0
    17@ = 70.0
    00AD: set_car 22@ max_speed_to 29@
        03E5: show_text_box 'CDRIVE1'
    if or
        047A:   actor $PLAYER_ACTOR driving_bike 
        00DD:   actor $PLAYER_ACTOR driving_car_with_model #QUAD 
    then
        08C6: set_actor 3@ stay_on_bike 1 
        08C6: set_actor $PLAYER_ACTOR stay_on_bike 1
    end 
    if
        0602:   actor 3@ driving_taxi
    then
        0216: enable_taxi 22@ light 1 
    end
    28@ = 1
    32@ = 0
    jump @reset
end
///////////////////////////////////////////////switch back
if and
    056D:   actor 3@ defined
    0449:   actor $PLAYER_ACTOR in_a_car
    00DF:   actor 3@ driving  
    00E1:   player 0 pressed_key 11
    28@ == 1
    32@ > 1000
then
    0687: clear_actor $PLAYER_ACTOR task
    0687: clear_actor 3@ task
    0792: disembark_instantly_actor 3@
    036A: put_actor $PLAYER_ACTOR in_car 22@
    0430: put_actor 3@ into_car 22@ passenger_seat -1
    0631: put_actor 3@ in_group $PLAYER_GROUP 
    //04B8: get_weapon_data_from_actor $PLAYER_ACTOR weapon_group 5 weapon 24@ ammo 6@ model 6@
    017B: set_actor $PLAYER_ACTOR weapon 24@ ammo_to 7@
    020A: set_car 22@ door_status_to 0
        if
        04C8:   actor $PLAYER_ACTOR driving_flying_vehicle 
    then
        03E5: show_text_box 'Cfly'
    else  
        03E5: show_text_box 'CDRIVE2'
    end
    01C3: remove_references_to_car 22@
    09B9: show_entered_car_name 1
    07CC: set_player $PLAYER_CHAR button_15 1
    if
        0602:   3@ driving_taxi
    then
        0216: enable_taxi 22@ light 0 
    end 
    28@ = 0
    23@ = 0
    32@ = 0
    jump @planefix
end
///////////////////////////////////////////////exit when passenger
if and
    056D:   actor 3@ defined
    00DF:   actor 3@ driving 
    84AB:   not actor $PLAYER_ACTOR driving_plane 
    80DD:   not actor 3@ driving_car_with_model #RHINO
    $ACTIVE_INTERIOR == 0
    00E1:   player 0 pressed_key 15
    28@ > 0
    32@ > 1000
then
    0465: remove_actor $PLAYER_ACTOR from_turret_mode 
    if or
        0137:   car 22@ model == #STRETCH
        0137:   car 22@ model == #STAFFORD
        056C:   actor $PLAYER_ACTOR driving_police_car 
        0137:   car 22@ model == #MAVERICK
        0137:   car 22@ model == #POLMAV
        0602:   actor $PLAYER_ACTOR driving_taxi 
    then
    if
        80DF:   not actor $PLAYER_ACTOR driving 
    then
        if
            0431:  car 22@ passenger_seat_free 3
        then
            072B: put_actor $PLAYER_ACTOR into_car 22@ passengerseat 3
        else
            if
                0431:  car 22@ passenger_seat_free 2
            then
                072B: put_actor $PLAYER_ACTOR into_car 22@ passengerseat 2
            else
                072B: put_actor $PLAYER_ACTOR into_car 22@ passengerseat -1
            end
        end
    end 
    else
        072B: put_actor $PLAYER_ACTOR into_car 22@ passengerseat -1    
    end
    if
        0602:   3@ driving_taxi
    then
        0216: enable_taxi 22@ light 0 
    end
    082A: set_player $PLAYER_CHAR able_to_use_crouch_button 1
    02AB: set_actor $PLAYER_ACTOR immunities BP 0 FP 0 EP 0 CP 0 MP 0 
    017B: set_actor $PLAYER_ACTOR weapon 24@ ammo_to 7@ 
    00AD: set_car 22@ max_speed_to 0.0 
    wait 500
    0687: clear_actor 3@ task  
    0633: AS_actor 3@ exit_car
    0633: AS_actor $PLAYER_ACTOR exit_car
    020A: set_car 22@ door_status_to 0
    09B9: show_entered_car_name 1
    0631: put_actor 3@ in_group $PLAYER_GROUP 
    07CC: set_player $PLAYER_CHAR button_15 1
    28@ = 0 
    23@ = 0
    //0792: disembark_instantly_actor $PLAYER_ACTOR
    01C3: remove_references_to_car 22@   
end
/////for planes
if and
    056D:   actor 3@ defined
    00DF:   actor 3@ driving 
    04AB:   actor $PLAYER_ACTOR driving_plane 
    00E1:   player 0 pressed_key 15
    28@ > 0
    32@ > 1000
then
    model.load(#GUN_PARA)
    while not model.Available(#GUN_PARA)
    wait 0
    end
    082A: set_player $PLAYER_CHAR able_to_use_crouch_button 1
    02AB: set_actor $PLAYER_ACTOR immunities BP 0 FP 0 EP 0 CP 0 MP 0 
    017B: set_actor $PLAYER_ACTOR weapon 24@ ammo_to 7@ 
    020A: set_car 22@ door_status_to 0
    09B9: show_entered_car_name 1
    0631: put_actor 3@ in_group $PLAYER_GROUP 
    07CC: set_player $PLAYER_CHAR button_15 1
    28@ = 0 
    23@ = 0
    0792: disembark_instantly_actor $PLAYER_ACTOR
    01B2: give_actor $PLAYER_ACTOR weapon 46 ammo 1 
    01C3: remove_references_to_car 22@
end     
//////////////////////////////////////////////intermitent driveby
if and
    28@ == 1
    $ACTIVE_INTERIOR == 0
then
    if or
        00E1:   player 0 pressed_key 17
        00E1:   player 0 pressed_key 2
        00E1:   player 0 pressed_key 3  
        //28@ == 1
    then
        0713: actor $PLAYER_ACTOR driveby_actor -1 car -1 point 0 0 0 radius 900.0 4 0 firing_rate 100
        33@ = 0
    end
    if and
       00E1:   player 0 pressed_key 6
       8AB0:  not key_pressed 0x11
    then
        0713: actor $PLAYER_ACTOR driveby_actor -1 car -1 point 0 0 0 radius 900.0 4 0 firing_rate 100
        33@ = 899
    end
    if
        33@ > 900
    then
        0687: clear_actor $PLAYER_ACTOR task
    end 
end
//////////////////////////////////////////switch drveby weap
if and
    28@ == 1
    32@ > 700 
    33@ > 950
    00E1:   player 0 pressed_key 4
then
0470: 24@ = actor $PLAYER_ACTOR current_weapon
8@ = 0  
while 8@ < 8
    if
        26@ == 9
    then
        26@ = 2     
    else
        000A: 26@ += 1
    end 
    0A96: 13@ = actor $PLAYER_ACTOR struct
    000A: 13@ += 1816
    017B: set_actor $PLAYER_ACTOR weapon 24@ ammo_to 7@
    0A8C: write_memory 13@ size 1 value 26@ virtual_protect 0
    26@ += 1
    04B8: get_weapon_data_from_actor $PLAYER_ACTOR weapon_group 26@ weapon 24@ ammo 7@ model 6@
    017B: set_actor $PLAYER_ACTOR weapon 24@ ammo_to 200000
    26@ -= 1
    32@ = 0 
    if
        82D8:   not actor $PLAYER_ACTOR current_weapon == 0
    then
        8@ = 8
    end
    8@ += 1
end
end
//////////////////////////////////////////switch drive modes
if and 
    28@ > 0
    23@ == 0
    32@ > 700 
    856E:   not car 20@ defined
    00E1:   player 0 pressed_key 10
    84C8:   not actor 3@ driving_flying_vehicle
then
    if
        19@ == 2
    then
        19@ = 4
        03E5: show_text_box 'tfcmrg'
    else
        19@ = 2 
        03E5: show_text_box 'tfcpas'
    end 
    00AE: set_car 22@ traffic_behaviour_to 19@ //2 pass, mission paths // 1 ram traffic //4 merge w/ traffic   
    32@ = 0
end 
//////////////////////////////////////////driveby driver of nearest car
//if and
//    056E:   car 20@ defined 
//    0AB0:   key_pressed 118
//    00DF:   actor 3@ driving
//    84C8:   not actor 3@ driving_flying_vehicle
//    28@ == 0
//    32@ > 1000
//then 
//    046C: 18@ = car 20@ driver
//    32@ = 0
//    jump @forceshoot 
//end
//////////////////////////////////////////car follow car
if and
    056E:   car 20@ defined 
    84C8:   not actor 3@ driving_flying_vehicle
    28@ > 0
    23@ < 2
    32@ > 900
then
    if
        00E1:   player 0 pressed_key 10
    then
        07F8: car 22@ follow_car 20@ radius 15.0
        00AE: set_car 22@ traffic_behaviour_to 2
        19@ = 2
        03E6: remove_text_box
        03E5: show_text_box 'DRVFOLW' 
        23@ = 2
        32@ = 0 
    end
end
///////////////////////////////////////reset path
if and 
    0AB0:  key_pressed 0x4B
    84C8:   not actor 3@ driving_flying_vehicle
    28@ > 0
    23@ == 0
then
    03E5: show_text_box 'DRVRST' 
    32@ = 0
    jump @reset
end 
///////////////////////////////////////follow bugfix
if
    23@ == 0
then
    01C3: remove_references_to_car 20@
end 
//////////////////////////////////////lost/killed car
if and
    23@ == 2
    856E:   not car 20@ defined
then
    if
        04A9:   actor 3@ driving_heli
    then
        06B2: destroy_searchlight 15@
    end
    03E5: show_text_box 'FOLWLST'
    23@ = 0
    jump @reset
end 
if and
    23@ == 2
    0119:   car 20@ wrecked 
then
    if
        04A9:   actor 3@ driving_heli
    then
        06B2: destroy_searchlight 15@
    end    
    03E5: show_text_box 'FLWKIL1'
    23@ = 0
    jump @reset
end    
//////////////////////////////////////////clone drive to target marker
if and   
    0AB6: store_target_marker_coords_to 0@ 1@ 2@ // IF and SET
    28@ > 0
    30@ == 0
    23@ == 0
then
    if
        84C8:   not actor 3@ driving_flying_vehicle
    then
        0687: clear_actor 3@ task
        00A7: car 22@ drive_to 0@ 1@ 2@ 
    end
    if
        04AB:   actor 3@ driving_plane
    then
        04D2: set_plane 22@ fly_autopilot_around_point 0@ 1@ 2@ altitude_between 0.0 and 17@   
    end
    if
        04A9:   actor 3@ driving_heli
    then
        04A2: set_heli 22@ fly_to 0@ 1@ 2@ altitude_between 0.0 and 17@   
    end
    03E5: show_text_box 'DRVTAR'
    23@ = 1  
end
//////////////////////////////////////////stop following
if and
    00E1:   player 0 pressed_key 10 
    84AB:   not actor 3@ driving_plane  
    28@ > 0
    23@ == 2
    32@ > 900
then
    03E5: show_text_box 'DRVPTH'
    23@ = 0
    32@ = 0
    jump @reset
end
/////////////////////////////////////////abandon destination   
if and 
    //0AB0:   key_pressed 118 
    8AB6: not store_target_marker_coords_to 0@ 1@ 2@ // IF and SET    
    28@ > 0
    23@ == 1 
then
    03E5: show_text_box 'DRVPTH'
    jump @reset
end 
///////////////////////////////////////////1 seater workaround
if and
    80DF:   not actor 3@ driving
    00DF:   actor $PLAYER_ACTOR driving
    28@ == 0
then
    jump @putcar
end
/////////////////////////////////////////////////actor must leave car
if and
    80DF:   not actor $PLAYER_ACTOR driving
    89DE:   not actor $PLAYER_ACTOR entering_car 
    00DF:   actor 3@ driving 
    28@ == 0
then
    if or
        00E1:   player 0 pressed_key 8
        30@ == 0
    then
        //0630: put_actor $PLAYER_ACTOR in_group $PLAYER_GROUP as_leader  
        0633: AS_actor 3@ exit_car
        0631: put_actor 3@ in_group $PLAYER_GROUP 
        01C3: remove_references_to_car 22@
        30@ = 0
        jump @leavecar
    end 
end
/////////solo driving
if
    30@ > 0
then
    if
        856E:   not car 5@ defined
    then
        0687: clear_actor 3@ task
        //0630: put_actor $PLAYER_ACTOR in_group $PLAYER_GROUP as_leader
        0631: put_actor 3@ in_group $PLAYER_GROUP 
        30@ = 0
        jump @noname_2
    end
    if and
        00DF:   actor 3@ driving
        84A9:   not actor 3@ driving_heli
    then
        //00AE: set_car 5@ traffic_behaviour_to 2
        09F6: set_actor 3@ unjackable_through_driver_seat 1
        car.SetDriverBehaviour(5@, 2) 
        30@ = 2 
    end
    if and
        30@ == 1
        04A9:   actor 3@ driving_heli
    then
        0407: store_coords_to 0@ 1@ 2@ from_car 5@ with_offset 0.0 0.0 3.0 
        00AB: put_car 5@ at 0@ 1@ 2@
        0825: set_helicopter 5@ instant_rotor_start
        //0780: heli 5@ hover_above actor $PLAYER_ACTOR car -1 altitude 0.0 150.0 
        0726: heli 5@ follow_actor $PLAYER_ACTOR follow_car -1 radius 13.0 
        //0726: heli 5@ follow_actor $PLAYER_ACTOR follow_car -1 radius 13.0
        //00AD: set_car 5@ max_speed_to 100.0
        30@ = 2 
    end
    if and
        00F4:   actor 3@ near_actor $PLAYER_ACTOR radius 5.0 5.0 0 in_car
        00E1:   player 0 pressed_key 15  
        30@ == 2
    then
        05CA: AS_actor $PLAYER_ACTOR enter_car 5@ passenger_seat -1 10000 ms
        30@ = 3
        32@ = 0
    end 
    if and
        30@ = 3
        actor.InCar($PLAYER_ACTOR, 5@)
    then
        0792: disembark_instantly_actor 3@
        01C3: remove_references_to_car 5@
        03C0: 22@ = actor $PLAYER_ACTOR car
        0687: clear_actor 3@ task
        //0631: put_actor 3@ in_group $PLAYER_GROUP        
        036A: put_actor 3@ in_car 22@
        //00A9: set_car 22@ to_normal_driver 
        //0526: set_actor 3@ stay_in_car 1
        car.SetDriverBehaviour(22@, 1)
        09F6: set_actor 3@ unjackable_through_driver_seat 0
        04B8: get_weapon_data_from_actor $PLAYER_ACTOR weapon_group 5 weapon 24@ ammo 7@ model 6@ 
        017B: set_actor $PLAYER_ACTOR weapon 24@ ammo_to 200000    
        020A: set_car 22@ door_status_to 4   
        00AE: set_car 22@ traffic_behaviour_to 19@ //2 pass, mission paths // 1 ram traffic //4 merge w/ traffic
        07CC: set_player $PLAYER_CHAR button_15 0
        29@ = 25.0
        17@ = 70.0
        00AD: set_car 22@ max_speed_to 29@
        03E5: show_text_box 'CDRIVE1'
        30@ = 0
        28@ = 1
        jump @noname_2
   end
    if 
        00E1:   player 0 pressed_key 8
    then
        if
            00DF:   actor $PLAYER_ACTOR driving 
        then
            30@ = 0
            0633: AS_actor 3@ exit_car
            0622: AS_actor 3@ bail_car -1 
            jump @noname_2
        else
            0687: clear_actor 3@ task
            0631: put_actor 3@ in_group $PLAYER_GROUP 
        end
    end
    if and
        00DF:   actor $PLAYER_ACTOR driving
        84A9:   not actor 3@ driving_heli 
    then
        if
            8207:   not actor $PLAYER_ACTOR near_car 5@ radius 8.0 8.0 8.0 flag 0 in_car
        then 
            00AD: set_car 5@ max_speed_to 100.0
        else
            03C0: 8@ = actor $PLAYER_ACTOR car    
            02E3: 8@ = car 8@ speed 
            00AD: set_car 5@ max_speed_to 8@ 
        end     
    else
        if
            8206:   not actor $PLAYER_ACTOR near_car 5@ radius 5.0 5.0 3.0 flag 0 on_foot
        then 
            00AD: set_car 5@ max_speed_to 12.0
        else
            00AD: set_car 5@ max_speed_to 0.0
        end 
    end        

end   
////////////////////////////////////////////////automatic bail
//if and
//    28@ > 0
//    $ZERO4_Car_Health < 25 
//then
//    jump @leavecar2 
//end
//////////////////////////////////////////control car in passenger mode
if and
    84C8:   not actor $PLAYER_ACTOR driving_flying_vehicle
    09E7:   player $PLAYER_CHAR not_frozen 
    28@ > 0
    33@ > 900
    28@ <> 2
then
    0494: get_joystick 0 data_to 8@ 9@ 6@ 6@ //first stick, horizontal vertical, secondstick, horizontal vertical
    if 
        8@ < 0
    then 
        0477: set_car 22@ animation 7 time 1
    end 
    if 
        8@ > 0
    then 
        0477: set_car 22@ animation 8 time 1
    end
    if
        9@ < 0
    then 
        0477: set_car 22@ animation 9 time 1
    end      
    if
        9@ > 0
    then 
        0477: set_car 22@ animation 3 time 1
    end

//    if or
//        0AB0:  key_pressed 0x20
//        0AB0:  key_pressed 0x11
//    then 
//        0477: set_car 22@ animation 6 time 1
//    end 
end
////////////////////////////////////////////////////speed adjustment
if and
    29@ < 120.0
    28@ > 0
    //0AB0:  key_pressed 0x55
    00E1:   player 0 pressed_key 16
    84C8:   not actor 3@ driving_flying_vehicle
    32@ > 15 
then
    000B: 29@ += 1.0 
    00AD: set_car 22@ max_speed_to 29@
    32@ = 0
end
if and
    29@ > 1.0
    28@ > 0
    //0AB0:  key_pressed 0x4a
    00E1:   player 0 pressed_key 14
    84C8:   not actor 3@ driving_flying_vehicle
    32@ > 15 
then
    000F: 29@ -= 1.0  
    00AD: set_car 22@ max_speed_to 29@
    32@ = 0
end 
////////////////////////////////////////////////////exclusions and altitude adjustment
if and
    28@ == 1
    29@ < 170.0
    04C8:   actor 3@ driving_flying_vehicle
then
    29@ = 170.0
    00AD: set_car 22@ max_speed_to 29@
    //0151: remove_status_text $7424
    //04F7: status_text $7424 type 1 line 3 GXT 'DRVALT'
end 
{if and
    28@ == 1
    17@ <> 1
    09AE:   actor 3@ driving_train 
then
    17@ = 1
    00AD: set_car 22@ max_speed_to 29@
    0151: remove_status_text $ZERO4_Car_Health
    0151: remove_status_text $7424
    04F7: status_text $7424 type 1 line 3 GXT 'DRVSPD'
end }
//////////////////////////////////heli 
if and
    17@ < 200.0
    28@ > 0
    00E1:   player 0 pressed_key 16
    04A9:   actor 3@ driving_heli 
    32@ > 15 
then
    000B: 17@ += 1.0 
    04A2: set_heli 22@ fly_to 0@ 1@ 2@ altitude_between 0.0 and 17@ 
    32@ = 0
end
if and
    17@ > 10.0
    28@ > 0
    00E1:   player 0 pressed_key 14
    04A9:   actor 3@ driving_heli
    32@ > 15 
then
    000F: 17@ -= 1.0  
    04A2: set_heli 22@ fly_to 0@ 1@ 2@ altitude_between 0.0 and 17@
    32@ = 0
end
////////////land heli 
if and
    23@ > 0
    04A9:   actor 3@ driving_heli
    00FE:   actor 3@ sphere 0 in_sphere 0@ 1@ 2@ radius 15.0 15.0 250.0
    17@ > 0.0
    8A2A:   not text_box 'hlilnd' displayed
then
    0512: show_permanent_text_box 'hlilnd'
end
if and
    28@ > 0
    04A9:   actor 3@ driving_heli
    17@ > 0.0
    00FE:   actor 3@ sphere 0 in_sphere 0@ 1@ 2@ radius 15.0 15.0 250.0
    //00E1:   player 0 pressed_key 5
    00E1:   player 0 pressed_key 10 
then
    03E6: remove_text_box
    02E3: 8@ = car 22@ speed 
    0017: 8@ /= 1.8 
    car.SetSpeedInstantly(22@, 8@)  
    17@ = 0.0
    04A2: set_heli 22@ fly_to 0@ 1@ 2@ altitude_between 0.0 and 0.0
    0441: 8@ = car 22@ model
    07E4: get_model 8@ dimensions_cornerA_to 6@ 6@ 10@ dimensions_cornerB_to 8@ 9@ 6@
    000F: 9@ -= 0.6
    000B: 10@ += 0.75 
    06C1: create_searchlight 15@ on_car 22@ with_offset 0.0 9@ 10@ radius 0.15 target 0@ 1@ 2@ radius 13.0
    0087: 8@ = 1@ // (float) 
    000B: 1@ += 4.0
    000F: 8@ -= 4.0
    06B4: set_searchlight 15@ path_between 0@ 1@ 2@ and 0@ 8@ 2@ speed 0.1 
    //car.SetSpeedInstantly(22@, 6.0)
    03E5: show_text_box 'abtlnd'
end
if and
    23@ > 0
    04A9:   actor 3@ driving_heli
    80FE:   not actor 3@ sphere 0 in_sphere 0@ 1@ 2@ radius 15.0 15.0 250.0
    0A2A:   text_box 'hlilnd' displayed
then
    03E6: remove_text_box
end
//if and
//    23@ < 1
//    0A2A:   text_box 'hlilnd' displayed
//then
//    03E6: remove_text_box
//end
if
    06B3:   searchlight 15@ active
then
    if or
        25@ < 4.0     
        28@ == 0
        //23@ == 0
        17@ > 0.0
    then
        06B2: destroy_searchlight 15@
        02E3: 8@ = car 22@ speed 
        0017: 8@ /= 3.0 
        car.SetSpeedInstantly(22@, 8@) 
    end
end
/////////////////////////////////plane
if and
    17@ < 500.0
    28@ > 0
    00E1:   player 0 pressed_key 16
    04AB:   actor 3@ driving_plane
    32@ > 10 
then
    000B: 17@ += 2.0 
    04D2: set_plane 22@ fly_autopilot_around_point 0@ 1@ 2@ altitude_between 0.0 and 17@ 
    32@ = 0
end
if and
    17@ > 10.0
    28@ > 0
    00E1:   player 0 pressed_key 14
    04AB:   actor 3@ driving_plane 
    32@ > 10 
then
    000F: 17@ -= 2.0  
    04D2: set_plane 22@ fly_autopilot_around_point 0@ 1@ 2@ altitude_between 0.0 and 17@
    32@ = 0
end  
//////////////////////////////land plane ///flag = 11@
//if and
//    11@ = 0
//    04AB:   actor $PLAYER_ACTOR driving_plane
//    00E1:   player 0 pressed_key 18
//then
//    07C0: load_path 43
//    while 87C1:   not path 43 available
//        wait 0
//    end
//    05EB: assign_car 22@ to_path 43
//end 
////////////////////////////////////////////////////turret mode 
if and
    28@ == 1
    32@ > 700
    //$LS_FINAL_TOTAL_PASSED_MISSIONS > 0
    00E1:   player 0 pressed_key 18 
    847A:   not actor $PLAYER_ACTOR driving_bike
    84AB:   not actor $PLAYER_ACTOR driving_plane 
    80DD:   not actor $PLAYER_ACTOR driving_car_with_model #QUAD
    82D8:   not actor $PLAYER_ACTOR current_weapon == 43 

then
    000A: 26@ += 1
    04B8: get_weapon_data_from_actor $PLAYER_ACTOR weapon_group 26@ weapon 24@ ammo 6@ model 6@
    000E: 26@ -= 1  
    0441: 8@ = car 22@ model
    082A: set_player $PLAYER_CHAR able_to_use_crouch_button 0
    02AB: set_actor $PLAYER_ACTOR immunities BP 1 FP 1 EP 1 CP 1 MP 1 
//    if and
//        04AB:   $PLAYER_ACTOR driving_plane
//        80DD:   not actor $PLAYER_ACTOR driving_car_with_model #AT400
//    then
//        07E4: get_model 8@ dimensions_cornerA_to 6@ 6@ 6@ dimensions_cornerB_to 6@ 9@ 10@
//        8@ = 1.7
//        000F: 9@ -= 2.7
//        10@ = 0.5
//    end
//    if
//        00DD:   actor $PLAYER_ACTOR driving_car_with_model #AT400
//    then
//        07E4: get_model 8@ dimensions_cornerA_to 6@ 6@ 6@ dimensions_cornerB_to 6@ 9@ 10@
//        8@ = 1.6
//        000F: 9@ -= 4.0
//        000F: 10@ -= 12.5
//    end   
    if and
        04A9:   actor $PLAYER_ACTOR driving_heli
        80DD:   not actor $PLAYER_ACTOR driving_car_with_model #MAVERICK
        80DD:   not actor $PLAYER_ACTOR driving_car_with_model #POLMAV
    then
        07E4: get_model 8@ dimensions_cornerA_to 6@ 6@ 10@ dimensions_cornerB_to 8@ 9@ 6@
        000F: 9@ -= 1.7 
        000B: 10@ += 1.5 
    end
    if or
        
        00DD:   actor $PLAYER_ACTOR driving_car_with_model #MAVERICK
        00DD:   actor $PLAYER_ACTOR driving_car_with_model #POLMAV
    then
        07E4: get_model 8@ dimensions_cornerA_to 6@ 6@ 10@ dimensions_cornerB_to 8@ 9@ 6@
        000F: 9@ -= 3.5 
        000B: 10@ += 1.5 
    end 
    if
        84C8:   not actor $PLAYER_ACTOR driving_flying_vehicle
    then
        07E4: get_model 8@ dimensions_cornerA_to 6@ 6@ 6@ dimensions_cornerB_to 8@ 9@ 10@
        if or
            0137:   car 22@ model == #STAFFORD
            056C:   actor 3@ driving_police_car 
            0602:   actor 3@ driving_taxi 
        then
            000F: 9@ -= 3.7
        else
            if
                0137:   car 22@ model == #STRETCH
            then
                000F: 9@ -= 5.3
            else   
                000F: 9@ -= 2.7
            end
        end
        000F: 10@ -= 0.5 
    end 
    0687: clear_actor $PLAYER_ACTOR task
    0792: disembark_instantly_actor $PLAYER_ACTOR                 
    if 
      24@ == 35
    then 
        Camera.OnPed($PLAYER_ACTOR, 8, 2)
        if
            84A9:   not actor $PLAYER_ACTOR driving_heli 
        then
            000B: 10@ += 0.8
        end 
        0464: put_actor $PLAYER_ACTOR into_turret_on_car 22@ at_car_offset 8@ 9@ 10@ position 0 shooting_angle_limit 360.0 with_weapon 35
    end
    if 
       24@ == 36
    then 
        Camera.OnPed($PLAYER_ACTOR, 51, 2)
        if
            84A9:   not actor $PLAYER_ACTOR driving_heli 
        then
            000B: 10@ += 0.8
        end 
        0464: put_actor $PLAYER_ACTOR into_turret_on_car 22@ at_car_offset 8@ 9@ 10@ position 0 shooting_angle_limit 360.0 with_weapon 36
    end
    if and 
       24@ <> 36
       24@ <> 35
    then  
        0464: put_actor $PLAYER_ACTOR into_turret_on_car 22@ at_car_offset 8@ 9@ 10@ position 0 shooting_angle_limit 360.0 with_weapon 24@
    end   
    28@ = 2
    32@ = 0
    //8@ = 0
    //9@ = 0
end
///////////////////////////////////////////////// exit turret
if and
    00E1:   player 0 pressed_key 18
    28@ == 2
    32@ > 700
then
    0687: clear_actor $PLAYER_ACTOR task        
    if or
        0137:   car 22@ model == #STRETCH
        0137:   car 22@ model == #STAFFO    00E1:   player 0 pressed_key 18
    28@ == 2
    32@ > 700
then
    0687: clear_actor $PLAYER_ACTOR task        
    if or
        0137:   car 22@ model == #STRETCH
        0137:   car 22@ model == #STAFFO    00E1:   player 0 pressed_
        then
            0465: remove_actor $PLAYER_ACTOR from_turret_mode
            0792: disembark_instantly_actor $PLAYER_ACTOR 
            072B: put_actor $PLAYER_ACTOR into_car 22@ passengerseat 2
        else
            if
                0431:  car 22@ passenger_seat_free 3
            then
                0465: remove_actor $PLAYER_ACTOR from_turret_mode
                0792: disembark_instantly_actor $PLAYER_ACTOR 
                072B: put_actor $PLAYER_ACTOR into_car 22@ passengerseat 3
            end
        end 
    else
        0465: remove_actor $PLAYER_ACTOR from_turret_mode
        0792: disembark_instantly_actor $PLAYER_ACTOR 
        072B: put_actor $PLAYER_ACTOR into_car 22@ passengerseat -1    
    end
    082A: set_player $PLAYER_CHAR able_to_use_crouch_button 1
    02AB: set_actor $PLAYER_ACTOR immunities BP 0 FP 0 EP 0 CP 0 MP 0
    01B2: give_actor $PLAYER_ACTOR weapon 24@ ammo 200000 
    015A: restore_camera 
    wait 100
    0A96: 13@ = actor $PLAYER_ACTOR struct
    000A: 13@ += 1816
    0A8C: write_memory 13@ size 1 value 26@ virtual_protect 0
    28@ = 1
    32@ = 0
end
//if or
//    24@ == 35
//    24@ == 36
//then
//    if and
//        00E1:   player 0 pressed_key 6
//        28@ == 2
//        32@ > 700
//    then
//        0687: clear_actor $PLAYER_ACTOR task
//        0465: remove_actor $PLAYER_ACTOR from_turret_mode
//        0430: put_actor $PLAYER_ACTOR into_car 22@ passenger_seat -1
//        082A: set_player $PLAYER_CHAR able_to_use_crouch_button 1
//        02AB: set_actor $PLAYER_ACTOR immunities BP 0 FP 0 EP 0 CP 0 MP 0
//        01B2: give_actor $PLAYER_ACTOR weapon 24@ ammo 200000
//        015A: restore_camera 
//        wait 20
//        0A96: 13@ = actor $PLAYER_ACTOR struct
//        000A: 13@ += 1816
//        0A8C: write_memory 13@ size 1 value 26@ virtual_protect 0
//        28@ = 1
//        32@ = 0
//    end 
//end
/////////////////////////////////////////select from environment
//if and
//        80DF:   not actor $PLAYER_ACTOR driving 
//        00E1:   player 0 pressed_key 11
//        //32@ > 700  
//    then
//        14@ = 1
//        0107: 12@ = create_object -1 at -2224.8616 678.4423 134.6111
//        070A: AS_actor $PLAYER_ACTOR attach_to_object 12@ offset 0.0 0.0 0.0 on_bone 6 16 perform_animation "NULL" IFP_file "NULL" time -1  
//        while 14@ > 19
//            03E5: show_text_box 'LOCKCLN'
//            wait 1
//            0400: store_coords_to 7@ 8@ 9@ from_object 21@ with_offset 0.0 0.0 0.0
//            0085: 8@ = 14@ // (int) 
//            8@ *= 5
//            008F: 8@ = integer 8@ to_float   
//            08E5: get_actor_in_sphere 7@ 8@ 9@ radius 5.0 handle_as 21@
//            if
//                056D:   actor 21@ defined 
//                //056E:   car 31@ defined
//            then
//                14@ = 20
//                0187: 30@ = create_marker_above_actor 21@
//                32@ = 0
//                14@ = 19
//            else
//                30@ = -1 
//            end 
//            14@ += 1
//        end
//        0108: destroy_object 12@ 
//     end 
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////onfoot stuff
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////rc clone
//////////////actor steal car
//if and
//    80DF:   not actor 3@ driving 
//    80DF:   not actor $PLAYER_ACTOR driving
//    0AB0:  key_pressed 0x4a
//    30@ == 0
//    32@ > 1000
//    $PLAYER_WANTED_LEVEL == 0
//then
//    model.load(#bmx)
//    038B: load_requested_models 
//    0AB5: store_actor $PLAYER_ACTOR closest_vehicle_to 22@ closest_ped_to 6@
//    05D2: AS_actor 3@ run_to_and_hijack_car -1 max_search_radius 20.0 traffic_behavior 0
//    $onmission = 1 
//    30@ = 1
//    03E5: show_text_box 'clnRCF'
//    32@ = 0 
//end
//////initiate rc mode
//if and
//    89DE:   not actor 3@ entering_car 
//    30@ == 1
//    00DB:   actor 3@ in_car 22@
//    00DF:   actor 3@ driving 
//    0449:   actor 3@ in_a_car
//then
//    03C0: 22@ = actor 3@ car 
//    04C4: store_coords_to 0@ 1@ 2@ from_actor $PLAYER_ACTOR with_offset 0.0 0.0 0.0 
//    0362: remove_actor 3@ from_car_and_place_at 0@ 1@ 2@ 
//    0687: clear_actor 3@ task 
//    04D7: set_actor 3@ locked 1 
//    072A: put_actor $PLAYER_ACTOR into_car 22@ driverseat
//    0187: 25@ = create_marker_above_actor 3@  
//    07E0: set_marker 21@ type_to 1
//    0165: set_marker 21@ color_to 1
//    0168: show_on_radar 21@ 1
//end


///B6FB54 // targeted ped adress

//01E4: show_text_1number_lowpriority GXT 'number' number 30@ time 1 flag 1

if and    
    00E1:   player 0 pressed_key 4 
    00E1:   player 0 pressed_key 8
    80DF:   not actor 3@ driving 
    80DF:   not actor $PLAYER_ACTOR driving
then
    04C4: store_coords_to 0@ 1@ 2@ from_actor 3@ with_offset 0.0 0.0 0.0
    02CE: 2@ = ground_z_at 0@ 1@ 2@
    2@ += 0.1
    0007: 10@ = 2@ 
    10@ += 10.0
    //06D5: 15@ = create_racing_checkpoint_at 0@ 1@ 2@ point_to 0@ 1@ 10@ type 3 radius 1.0 
    //015F: set_camera_position 0@ 1@ 10@ rotation 0.0 0.0 0.0 
    00A1: put_actor 3@ at 0@ 1@ 2@
    067C: put_camera_on_actor 3@ with_offset 0.0 0.0 15.0 rotation 0.0 0.0 0.0 0.0 2  
    03BF: set_player $PLAYER_CHAR ignored_by_everyone 1
    01B4: set_player $PLAYER_CHAR can_move 0 
    015D: set_gamespeed 0.1
    00BB: show_text_lowpriority GXT 'manacq' time 200 flag 1
    32@ = 0
    while true
        wait 10
        0494: get_joystick 0 data_to 8@ 9@ 6@ 6@ //first stick, horizontal vertical, secondstick, horizontal vertical
        04C4: store_coords_to 0@ 1@ 2@ from_actor 3@ with_offset 0.0 0.0 0.0
        if
            8@ < 0
        then
            0@ -= 0.25
        end
        if
            8@ > 0
        then
            0@ += 0.25
        end
        if
            9@ < 0
        then
            1@ += 0.25
        end
        if
            9@ > 0
        then
            1@ -= 0.25
        end
//        06D6: disable_racing_checkpoint 15@ 
        2@ += 1.0
        02CE: 2@ = ground_z_at 0@ 1@ 2@
        2@ += 0.1
        0007: 10@ = 2@ 
        10@ += 10.0
        04C4: store_coords_to 8@ 9@ 10@ from_actor 3@ with_offset 0.0 0.0 0.0
        050A: 6@ = distance_between_XYZ 0@ 1@ 2@ and_XYZ 8@ 9@ 10@
        if and
            06BD:   no_obstacles_between 0@ 1@ 2@ and 8@ 9@ 10@ solid 1 car 1 actor 0 object 1 particle 0 
            6@ < 5.0
            //803C:   not  $ACTIVE_INTERIOR == 0
        then
             00A1: put_actor 3@ at 0@ 1@ 2@
        end 
//        06D5: 15@ = create_racing_checkpoint_at 0@ 1@ 2@ point_to 0@ 1@ 10@ type 3 radius 1.0 
        //015F: set_camera_position 0@ 1@ 10@ rotation 0.0 0.0 0.0 
        //0160: set_camera_point_at 0@ 1@ 2@ mode 2      
        0AB5: store_actor 3@ closest_vehicle_to 5@ closest_ped_to 31@
        if and
            056D:   actor 31@ defined
            32@ > 50 
        then
            //00BB: show_text_lowpriority GXT 'manact' time 10 flag 1    
            if and
                00E1:   player 0 pressed_key 17
                00F3:   actor 3@ near_actor 31@ radius 3.0 3.0 0 on_foot 
            then
                089F: get_actor 31@ pedtype_to 7@ 
                077A: set_actor 3@ acquaintance 4 to_actors_pedtype 7@
                01E4: show_text_1number_lowpriority GXT 'manh8' number 7@ time 50 flag 1
                32@ = 0
            end
            if and
                00E1:   player 0 pressed_key 14
                00F3:   actor 3@ near_actor 31@ radius 3.0 3.0 0 on_foot
            then
                089F: get_actor 31@ pedtype_to 7@ 
                077A: set_actor 3@ acquaintance 1 to_actors_pedtype 7@
                01E4: show_text_1number_lowpriority GXT 'manlik' number 7@ time 50 flag 1
                32@ = 0
            end
            if and
                00E1:   player 0 pressed_key 16
                00F3:   actor 3@ near_actor 31@ radius 3.0 3.0 0 on_foot
            then
                if and
                    06EE:   actor 31@ in_group $PLAYER_GROUP
                    32@ > 50
                then
                    06C9: remove_actor 31@ from_group 
                    0631: put_actor 31@ in_group 11@
                    00BB: show_text_lowpriority GXT 'clngrp' time 50 flag 1
                    32@ = 0
                end
                if and
                    32@ > 50
                    06EE:   actor 31@ in_group 11@
                then
                    06C9: remove_actor 31@ from_group 
                    0631: put_actor 31@ in_group $PLAYER_GROUP 
                    00BB: show_text_lowpriority GXT 'plrgrp' time 50 flag 1
                    32@ = 0 
                end
                if and
                    86EE:   not actor 31@ in_group $PLAYER_GROUP
                    86EE:   not actor 31@ in_group 11@
                then    
                    05E2: AS_actor 3@ kill_actor 31@
                    00BB: show_text_lowpriority GXT 'mankill' time 50 flag 1 
                    32@ = 0
                end 
            end
        end
        if and
            00E1:   player 0 pressed_key 15
            056E:   car 5@ defined
        then
            0441: 6@ = car 5@ model 
            if and
                0206:   actor 3@ near_car 5@ radius 5.0 5.0 3.0 flag 0 on_foot 
                881F:   not model 6@ plane 
            then
                //0630: put_actor 3@ in_group $PLAYER_GROUP as_leader
                05D2: AS_actor 3@ run_to_and_hijack_car 5@ max_search_radius 20.0 traffic_behavior 2
                07F6: get_group 11@ number_of_leaders_to 6@ number_of_members_to 8@ 
//                if
//                    8@ > 0
//                then
//                    while 8@ > 0
//                        092B: 6@ = group $PLAYER_GROUP member 8@ 
//                        05CA: AS_actor 6@ enter_car 5@ passenger_seat 0 10000 ms
//                        8@ -= 1
//                    end
//                end 
                30@ = 1
                break 
            end
            01C3: remove_references_to_car 5@
        end    
        if and
            32@ > 50
            00E1:   player 0 pressed_key 4
        then
            00BB: show_text_lowpriority GXT 'manret' time 700 flag 1
            break
        end
    end
    //06D6: disable_racing_checkpoint 15@
    015A: restore_camera 
    03BF: set_player $PLAYER_CHAR ignored_by_everyone 0
    01B4: set_player $PLAYER_CHAR can_move 1 
    015D: set_gamespeed 1.0 
end
//
//    

///////////////////////mission pedtype contextual hate
if and
    $onmission == 1
    80DF:   not actor 3@ driving
    8AAB:  not file_exists "CLEO\pedfollows_off.cs"
then
    0AB5: store_actor 3@ closest_vehicle_to 6@ closest_ped_to 31@
    actor.EmulateFromPlayer($PLAYER_ACTOR, $PLAYER_CHAR)
    jump @acquaintence
end 
////////////////////////////////////////////////////escort bugfixes   
if
    28@ == 1
then 
    jump @BUGFIX
end       
jump @NONAME_2
///////////////////////////////////////fixes nasty bug caused by escort function in plane 
:planefix
if or
    00DD:  actor $PLAYER_ACTOR driving_car_with_model #DODO
    00DD:  actor $PLAYER_ACTOR driving_car_with_model #BEAGLE
then 
    //0A30: repair_car 22@
    08E6: set_plane 22@ landing_gear 0   
end
if
    28@ == 0
then
    01C3: remove_references_to_car 22@ 
end
jump @NONAME_2
//////////////////////////////////////////driveby actor when instructed
:forceshoot
if
    056D:   actor 18@ defined 
then
    0713: actor 3@ driveby_actor 18@ car -1 point 0 0 0 radius 900.0 8 1 firing_rate 100
    03E5: show_text_box 'CLDRVBY'
end
jump @NONAME_2
///////////////////////////////////////////reset destination                                                               
:reset
    //0687: clear_actor 3@ task 
    //0792: disembark_instantly_actor 3@
    //03A2: set_car 22@ action 4 
    036A: put_actor 3@ in_car 22@
    00A8: set_car 22@ to_psycho_driver
    00AE: set_car 22@ traffic_behaviour_to 19@ // 2
    //00AF: set_car 22@ driver_behaviour_to 4
    00AD: set_car 22@ max_speed_to 29@
    //00A8: set_car 22@ to_psycho_driver
    01C3: remove_references_to_car 20@ 
    23@ = 0 
    jump @planefix 
jump @NONAME_2
////////////////////////////////////////////bugfixes for escort
:BUGFIX
if
    00E1:   player 0 pressed_key 15
then
if or
    80DF:   not actor 3@ driving
    80DF:   not actor $PLAYER_ACTOR driving 
then
    0687: clear_actor $PLAYER_ACTOR task
    017B: set_actor $PLAYER_ACTOR weapon 24@ ammo_to 7@ 
    0792: disembark_instantly_actor $PLAYER_ACTOR 
    0792: disembark_instantly_actor 3@
    015A: restore_camera 
    0631: put_actor 3@ in_group $PLAYER_GROUP 
    07CC: set_player $PLAYER_CHAR button_15 1
    07CC: set_player $PLAYER_CHAR button_15 1
    09B9: show_entered_car_name 1
    28@ = 0
    23@ = 0
end 
end     
jump @NONAME_2



/////////////////////////////////////////////////////////////////1 seater workaround 2
:putcar
i   //0687: clear_actor 3@ task 
    //0792: disembark_instantly_actor 3@
    //03A2: set_car 22@ action 4 
    036A: put_actor 3@ in_car 22@
    00A8: set_car 22@ to_psycho_driver
    00AE: set_car 22@ traffic_behaviour_to 19@ // 2
    //00AF: set_carRA
    00DD:   actor $PLAYER_ACTOR driving_car_with_model #RUSTLER
    00DD:   actor $PLAYER_ACTOR driving_car_with_model #AT400
then 
    03C0: 22@ = actor $PLAYER_ACTOR car
    0687: clear_actor 3@ task
    0430: put_actor 3@ into_car 22@ passenger_seat -1
    01C3: remove_references_to_car 22@
end 
jump @NONAME_2

////////////////////////////////////////////////////////////exit after workaround
:leavecar
if or 
    00DD:   actor 3@ driving_car_with_model #RHINO
    00DD:   actor 3@ driving_car_with_model #SHAMAL
    00DD:   actor 3@ driving_car_with_model #NEVADA
    00DD:   actor 3@ driving_car_with_model #HYDRA
    00DD:   actor 3@ driving_car_with_model #RUSTLER
then 
    0792: disembark_instantly_actor 3@ 
    0687: clear_actor 3@ task
    0465: remove_actor 3@ from_turret_mode     
    0631: put_actor 3@ in_group $PLAYER_GROUP 
end
jump @NONAME_2

////////////////////////////////////////////////////////////automatic bail w/ workaround fix
:leavecar2
if or 
    00DD:   actor 3@ driving_car_with_model #RHINO
    00DD:   actor 3@ driving_car_with_model #SHAMAL
    00DD:   actor 3@ driving_car_with_model #NEVADA
    00DD:   actor 3@ driving_car_with_model #HYDRA
    00DD:   actor 3@ driving_car_with_model #RUSTLER
    //00DD:   actor 3@ driving_car_with_model #AT400
then 
    0687: clear_actor 3@ task 
    036A: put_actor 3@ in_car 22@
    0633: AS_actor 3@ exit_car
    0631: put_actor 3@ in_group $PLAYER_GROUP
    0792: disembark_instantly_actor $PLAYER_ACTOR
    0465: remove_actor $PLAYER_ACTOR from_turret_mode
    082A: set_player $PLAYER_CHAR able_to_use_crouch_button 1
    02AB: set_actor $PLAYER_ACTOR immunities BP 0 FP 0 EP 0 CP 0 MP 0
    28@ = 0
    23@ = 0
else
    0687: clear_actor 3@ task 
    036A: put_actor 3@ in_car 22@
    0633: AS_actor 3@ exit_car
    0631: put_actor 3@ in_group $PLAYER_GROUP
    0465: remove_actor $PLAYER_ACTOR from_turret_mode
    015A: restore_camera  
    if or
        0137:   car 22@ model == #STRETCH
        0137:   car 22@ model == #STAFFORD
        0137:   car 22@ model == #FBIRANCH
        0137:   car 22@ model == #MAVERICK
        0137:   car 22@ model == #POLMAV
    then
        if
            0431:  car 22@ passenger_seat_free 2
        then
            072B: put_actor $PLAYER_ACTOR into_car 22@ passengerseat 2
        else
            if
                0431:  car 22@ passenger_seat_free 3
            then
                072B: put_actor $PLAYER_ACTOR into_car 22@ passengerseat 3
            end
        end 
    else
        072B: put_actor $PLAYER_ACTOR into_car 22@ passengerseat -1    
    end
    05CD: AS_actor $PLAYER_ACTOR exit_car 22@
    
        if
            0431:  car 22@ passenger_seat_free 2
        then
            072B: put_actor $PLAYER_ACTOR into_car 22@ passengerseat 2 
    082A: set_player $PLAYER_CHAR able_to_use_crouch_button 1
    02AB: set_actor $PLAYER_ACTOR immunities BP 0 FP 0 EP 0 CP 0 MP 0
    07CC: set_player $PLAYER_CHAR button_15 1
    //04F7: status_text $ZERO4_Car_Health type 0 line 4 GXT 'CLONEH'
    //04F7: status_text $7424 type 1 line 3 GXT 'CLONEA'
    28@ = 0
    23@ = 0 
end
jump @NONAME_2


:wrkarndfix
//////////////////////////////////////////workaround fix
if and
    28@ == 1
    02BF:   car 22@ sunk  
then
    0792: disembark_instantly_actor $PLAYER_ACTOR 
    28@ = 0
    23@ = 0 
end 
if and
    28@ > 0
    0119:   car 22@ wrecked
then
    0321: kill_actor $PLAYER_ACTOR
    28@ = 0
    23@ = 0 
end 
if and
    8118:   not actor 3@ dead
    06EE:   actor 3@ in_group $PLAYER_GROUP  
    056D:   actor 3@ defined 
then
    jump @weapons
end
jump @NONAME_2

:acquaintence
//////////////////////////////////////////////////////////////////////////////auto-acquaintence
if
    056D:   actor 31@ defined 
then
    if or
        02F2:   actor 31@ model == #BALLAS1
        02F2:   actor 31@ model == #BALLAS2
        02F2:   actor 31@ model == #BALLAS3
        02F2:   actor 31@ model == #LSV1 
        02F2:   actor 31@ model == #LSV2
        02F2:   actor 31@ model == #LSV3
        02F2:   actor 31@ model == #DNB1
    then
        089F: get_actor 31@ pedtype_to 31@ 
        077A: set_actor 3@ acquaintance 4 to_actors_pedtype 31@
        jump @NONAME_2
    end
    if or
        02F2:   actor 31@ model == #DNB2
        02F2:   actor 31@ model == #DNB3
        02F2:   actor 31@ model == #SFR1
        02F2:   actor 31@ model == #SFR2 
        02F2:   actor 31@ model == #SFR3
        02F2:   actor 31@ model == #MAFFA
        02F2:   actor 31@ model == #MAFFB
    then
        089F: get_actor 31@ pedtype_to 31@ 
        077A: set_actor 3@ acquaintance 4 to_actors_pedtype 31@
        jump @NONAME_2
    end
    if or
        02F2:   actor 31@ model == #WMYCR
        02F2:   actor 31@ model == #SWAT
        02F2:   actor 31@ model == #BMYCG
        02F2:   actor 31@ model == #HMYCM
        02F2:   actor 31@ model == #WFYCRK
        02F2:   actor 31@ model == #MAFBOSS
        02F2:   actor 31@ model == #BMYCR
    then
        089F: get_actor 31@ pedtype_to 31@ 
        077A: set_actor 3@ acquaintance 4 to_actors_pedtype 31@
        jump @NONAME_2
    end
    if or
        02F2:   actor 31@ model == #FAM1
        02F2:   actor 31@ model == #FAM2
        02F2:   actor 31@ model == #FAM3
        02F2:   actor 31@ model == #BFYPRO
        0611:   actor 31@ performing_animation "CRCKIDLE4" 
        0611:   actor 31@ performing_animation "CRCKIDLE3"
        0611:   actor 31@ performing_animation "CRCKIDLE2"
    then
        089F: get_actor 31@ pedtype_to 31@ 
        077A: set_actor 3@ acquaintance 0 to_actors_pedtype 31@
        jump @NONAME_2
    end
end
if
    056D:   actor $Actor_Sweet defined
then
    089F: get_actor $Actor_Sweet pedtype_to 31@ 
    077A: set_actor 3@ acquaintance 1 to_actors_pedtype 31@
end     
if
    056D:   actor $Actor_Smoke defined
then
    0AAA: 6@ = thread 'FINALEA' pointer
    089F: get_actor $Actor_Smoke pedtype_to 31@
    if
        6@ == 0
    then 
        077A: set_actor 3@ acquaintance 1 to_actors_pedtype 31@
    else
        077A: set_actor 3@ acquaintance 4 to_actors_pedtype 31@
    end
    6@ = 0 
end
if
    056D:   actor $Actor_Ryder defined
then
    089F: get_actor $Actor_Ryder pedtype_to 31@ 
    077A: set_actor 3@ acquaintance 1 to_actors_pedtype 31@
end
if
    056D:   actor $Actor_Cesar defined
then                                                                  
    089F: get_actor $Actor_Cesar pedtype_to 31@                          
    077A: set_actor 3@ acquaintance 1 to_actors_pedtype 31@
end
if
    056D:   actor $Actor_OG_Loc defined
then
    089F: get_actor $Actor_OG_Loc pedtype_to 31@ 
    077A: set_actor 3@ acquaintance 1 to_actors_pedtype 31@
end
if
    056D:   actor $Actor_truth defined
then
    089F: get_actor $Actor_truth pedtype_to 31@ 
    077A: set_actor 3@ acquaintance 1 to_actors_pedtype 31@
end
if
    056D:   actor $Actor_Catalina defined
then
    089F: get_actor $Actor_Catalina pedtype_to 31@ 
    077A: set_actor 3@ acquaintance 1 to_actors_pedtype 31@
end
0AAA: 6@ = thread 'CASINO6' pointer
if
    6@ <> -1
then
    077A: set_actor 3@ acquaintance 1 to_actors_pedtype 23
end
jump @NONAME_2
//3267  SAMsite

//player + 71C = gamepad target
// +79c = mouse target
//
return