{$CLEO .cs}
{$USE cleo+}
nop
script_name 'GYMONLY'
wait 0
wait 0

if
    0AA2: load_dynamic_library "CLEO+.cleo" 31@
jf @ILoveMyGirlfriendJessica
if
    0AA4: get_dynamic_library_procedure "GetCleoPlusVersion" library 31@ 30@
then
    0AA7: call_function_return 30@ num_params 0 pop 0 29@
end
0AA3: free_dynamic_library 31@
if
    29@ >= 0x1020000
jf @ILoveMyGirlfriendJessica


float fMuscle = 1000000.0, f
int i

set_script_event_after_game_process 1 @CheckMuscle

while true
    wait 200
    if
        i == 1
    then
        wait 200
        show_update_stats 1
        i = 0
    end
end


:CheckMuscle
read_memory 0xB793DC size 4 virtual_protect 0 f
if
    f <> fMuscle
then
    if and
        f > fMuscle
        is_player_control_on $PLAYER_CHAR
    then
        show_update_stats 0           
        write_memory 0xB793DC size 4 value fMuscle virtual_protect 0
        clear_help
        i = 1          
    end
    fMuscle = f
end   
return_script_event




:ILoveMyGirlfriendJessica
TIMERA = 0

repeat
    wait 0
    0AD1: print_formatted_now "Gym-Only Muscles: CLEO+ 1.2.0 or newer required. It's a plugin for CLEO. Please download and install it." time 200
    if and
        09E7: is_player_control_on $PLAYER_CHAR
        816B: not get_fading_status
    jf @ILoveMyGirlfriendJessica
until TIMERA > 10000

terminate_this_custom_script