{$CLEO .cs}
/*----------------------------Resume Last Play by Muhammad Herizal-------------------------------
You can change or modify anything, but.. don't reupload your modification without my permission,*/

thread 'RZL' 

:Resume
wait 1000
if
0AAB:   file_exists "cleo\ResumeLastPlay.ini"
then
else
0ACA: show_text_box "~h~The file ~r~ResumeLastPlay.ini ~h~not found, script ended"
end_thread
end
        if
        0AAB:   file_exists "cleo\ResumeLastPlay.rzl"
        then
        else
        goto @ResumeRecord
        end
0826: enable_hud 0
0581: enable_radar 0
player.CanMove(0,0)
0ADF: add_dynamic_GXT_entry "CHST" text "Resume The Last Play?"
0ADF: add_dynamic_GXT_entry "CHS1" text "Yes"
0ADF: add_dynamic_GXT_entry "CHS2" text "No"
0ADF: add_dynamic_GXT_entry "RZL_" text "~h~Mod By Muhammad Herizal"
08D4: 0@ = create_panel_with_title 'DUMMY' position 225.0 70.0 width 200.0 columns 1 interactive 1 background 1 alignment 0
08DB: set_panel 0@ column 0 header 'CHST' data 'CHS1' 'CHS2' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY'
0512: show_permanent_text_box 'RZL_'
    while true
    wait 0
        if
        00E1:   player 0 pressed_key 16
        then
        08D7: 1@ = panel 0@ active_row  
            if
            1@ == 0
            then
            08DA: remove_panel 0@
            gosub @ResumeLoad
            0ACB: show_styled_text "~y~Welcome back!" time 1000 style 2
            break
            else
                if
                1@ == 1
                then
                repeat
                wait 0
                until if 80E1:  not player 0 pressed_key 16
                08DA: remove_panel 0@                
                0826: enable_hud 1
                0581: enable_radar 1
                player.CanMove(0,1)
                camera.Restore_WithJumpCut()
                0AF1: write_int 1 to_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "FirstUse"                    
                break
                end
            end
        end
    end   
0AE0: remove_dynamic_GXT_entry "CHST"
0AE0: remove_dynamic_GXT_entry "CHS1"
0AE0: remove_dynamic_GXT_entry "CHS2"
0AE0: remove_dynamic_GXT_entry "RZL_"
03E6: remove_text_box

:ResumeRecord
while true
0AF0: 33@ = get_int_from_ini_file "cleo\ResumeLastPlay.ini" section "Main" key "SaveOnMission"
if
33@ == 1
then
else
repeat
wait 0
until if $ONMISSION == 0
end
    0AF0: 32@ = get_int_from_ini_file "cleo\ResumeLastPlay.ini" section "Main" key "DelayWriteSaveResume"
    wait 32@
    if or
    044B:   actor $PLAYER_ACTOR on_foot
    09AE:   actor $PLAYER_ACTOR driving_train
    then
    04C4: store_coords_to 1@ 2@ 3@ from_actor $PLAYER_ACTOR with_offset 0.0 0.0 -1.0
    0172: 4@ = actor $PLAYER_ACTOR Z_angle
    077E: get_active_interior_to 11@ 
    0AF1: write_int 0 to_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "UseVehicle"
    0AF3: write_float 1@ to_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "X"
    0AF3: write_float 2@ to_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "Y"
    0AF3: write_float 3@ to_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "Z"
    0AF3: write_float 4@ to_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "A"
    0AF1: write_int 11@ to_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "ActiveInterior"
    //0ACA: show_text_box "Save on Foot"
    else
        if or
        04A7:   actor $PLAYER_ACTOR driving_boat
        04C8:   actor $PLAYER_ACTOR driving_flying_vehicle        
        then
        0811: 0@ = actor $PLAYER_ACTOR used_car
        Car.StorePos(0@, 1@, 2@, 3@)
        0174: 4@ = car 0@ Z_angle
        5@ = Car.Model(0@)
        03F3: get_car 0@ primary_color_to 6@ secondary_color_to 7@ 
        0A12: get_car 0@ tertiary_color_to 8@ quaternary_color_to 9@ 
        077E: get_active_interior_to 11@ 
        0AF1: write_int 2 to_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "UseVehicle"
        0AF3: write_float 1@ to_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "X"
        0AF3: write_float 2@ to_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "Y"
        0AF3: write_float 3@ to_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "Z"
        0AF3: write_float 4@ to_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "A"
        0AF1: write_int 11@ to_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "ActiveInterior"
        0AF0: 12@ = get_int_from_ini_file "cleo\ResumeLastPlay.ini" section "Main" key "VehicleOwnerModel"
        0AF0: 13@ = get_int_from_ini_file "cleo\ResumeLastPlay.ini" section "Main" key "VehicleOwnerColor1"
        0AF0: 14@ = get_int_from_ini_file "cleo\ResumeLastPlay.ini" section "Main" key "VehicleOwnerColor2"
        0AF0: 15@ = get_int_from_ini_file "cleo\ResumeLastPlay.ini" section "Main" key "VehicleOwnerColor3"
        0AF0: 16@ = get_int_from_ini_file "cleo\ResumeLastPlay.ini" section "Main" key "VehicleOwnerColor4"
        0AF1: write_int 12@ to_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "VehicleModel"
        0AF1: write_int 13@ to_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "VehicleColor1"
        0AF1: write_int 14@ to_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "VehicleColor2"
        0AF1: write_int 15@ to_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "VehicleColor3"
        0AF1: write_int 16@ to_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "VehicleColor4"
        0AF1: write_int 5@ to_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "PlaneBoatModel"
        0AF1: write_int 6@ to_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "PlaneBoatColor1"
        0AF1: write_int 7@ to_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "PlaneBoatColor2"
        0AF1: write_int 8@ to_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "PlaneBoatColor3"
        0AF1: write_int 9@ to_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "PlaneBoatColor4"
        0AF1: write_int 0 to_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "FirstUse"
        car.RemoveReferences(0@)
        else
        0811: 0@ = actor $PLAYER_ACTOR used_car
        Car.StorePos(0@, 1@, 2@, 3@)
        0174: 4@ = car 0@ Z_angle
        5@ = Car.Model(0@)
        03F3: get_car 0@ primary_color_to 6@ secondary_color_to 7@ 
        0A12: get_car 0@ tertiary_color_to 8@ quaternary_color_to 9@ 
        077E: get_active_interior_to 11@ 
        0AF1: write_int 1 to_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "UseVehicle"
        0AF3: write_float 1@ to_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "X"
        0AF3: write_float 2@ to_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "Y"
        0AF3: write_float 3@ to_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "Z"
        0AF3: write_float 4@ to_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "A"
        0AF1: write_int 11@ to_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "ActiveInterior"
        0AF1: write_int 5@ to_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "VehicleModel"
        0AF1: write_int 6@ to_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "VehicleColor1"
        0AF1: write_int 7@ to_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "VehicleColor2"
        0AF1: write_int 8@ to_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "VehicleColor3"
        0AF1: write_int 9@ to_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "VehicleColor4"
        0AF1: write_int 0 to_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "FirstUse"
        car.RemoveReferences(0@)
        //0ACA: show_text_box "Save In Vehicle"
        end
    end
00BF: 1@ = current_time_hours, 2@ = current_time_minutes 
0AF1: write_int 1@ to_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "Hours"
0AF1: write_int 2@ to_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "Minutes"
end

:ResumeLoad
fade 0 100
wait 100
0AF2: 1@ = get_float_from_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "X"
0AF2: 2@ = get_float_from_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "Y"
0AF2: 3@ = get_float_from_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "Z"
0AF2: 4@ = get_float_from_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "A"
0AF0: 5@ = get_int_from_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "VehicleModel"
0AF0: 6@ = get_int_from_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "VehicleColor1"
0AF0: 7@ = get_int_from_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "VehicleColor2"
0AF0: 8@ = get_int_from_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "VehicleColor3"
0AF0: 9@ = get_int_from_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "VehicleColor4"
0AF0: 11@ = get_int_from_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "ActiveInterior"
0AF0: 33@ = get_int_from_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "UseVehicle"
0AF0: 32@ = get_int_from_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "FirstUse"
    if
    33@ == 0
    then
    04E4: refresh_game_renderer_at 1@ 2@
    03CB: set_rendering_origin_at 1@ 2@ 3@                                
    actor.PutAt($PLAYER_ACTOR, 1@, 2@, 3@)
    actor.Angle($PLAYER_ACTOR) = 4@
    0860: link_actor $PLAYER_ACTOR to_interior 11@ 
        if
        32@ == 0
        then
            if
            11@ == 0
            then
            Model.Load(5@)
            038B: load_requested_models
            04C4: store_coords_to 1@ 2@ 3@ from_actor $PLAYER_ACTOR with_offset 4.0 0.0 0.0
            10@ = Car.Create(5@, 1@, 2@, 3@)
            Car.Angle(10@) = 4@
            0229: set_car 10@ primary_color_to 6@ secondary_color_to 7@ 
            0A11: set_car 10@ tertiary_color_to 8@ quaternary_color_to 9@ 
            0840: link_car 10@ to_interior 11@ 
            Model.Destroy(5@)
            Car.RemoveReferences(10@)
            else
            end
        else
        end
    else
        if
        33@ == 1
        then
        Model.Load(5@)
        038B: load_requested_models
        04E4: refresh_game_renderer_at 1@ 2@
        03CB: set_rendering_origin_at 1@ 2@ 3@                                
        actor.PutAt($PLAYER_ACTOR, 1@, 2@, 3@)
        10@ = Car.Create(5@, 1@, 2@, 3@)
        Car.Angle(10@) = 4@
        0860: link_actor $PLAYER_ACTOR to_interior 11@ 
        0840: link_car 10@ to_interior 11@ 
        0229: set_car 10@ primary_color_to 6@ secondary_color_to 7@ 
        0A11: set_car 10@ tertiary_color_to 8@ quaternary_color_to 9@ 
        036A: put_actor $PLAYER_ACTOR in_car 10@ 
        Model.Destroy(5@)
        Car.RemoveReferences(10@)
        else
            if
            33@ == 2
            then
            0AF0: 5@ = get_int_from_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "PlaneBoatModel"
            0AF0: 6@ = get_int_from_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "PlaneBoatColor1"
            0AF0: 7@ = get_int_from_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "PlaneBoatColor2"
            0AF0: 8@ = get_int_from_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "PlaneBoatColor3"
            0AF0: 9@ = get_int_from_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "PlaneBoatColor4"
            Model.Load(5@)
            038B: load_requested_models
            04E4: refresh_game_renderer_at 1@ 2@
            03CB: set_rendering_origin_at 1@ 2@ 3@                                
            actor.PutAt($PLAYER_ACTOR, 1@, 2@, 3@)
            10@ = Car.Create(5@, 1@, 2@, 3@)
            Car.Angle(10@) = 4@
            0860: link_actor $PLAYER_ACTOR to_interior 11@ 
            0840: link_car 10@ to_interior 11@ 
            0229: set_car 10@ primary_color_to 6@ secondary_color_to 7@ 
            0A11: set_car 10@ tertiary_color_to 8@ quaternary_color_to 9@ 
            036A: put_actor $PLAYER_ACTOR in_car 10@ 
            Model.Destroy(5@)
            Car.RemoveReferences(10@)
            else
            end
        end
    end
04BB: select_interior 11@
0AF0: 1@ = get_int_from_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "Hours"
0AF0: 2@ = get_int_from_ini_file "cleo\ResumeLastPlay.rzl" section "Main" key "Minutes"
00C0: set_current_time_hours_to 1@ minutes_to 2@ 
camera.Restore_WithJumpCut()
0826: enable_hud 1
0581: enable_radar 1
player.CanMove(0,1)
fade 1 100
return
