Resource icon

Untagged Release Radar Control: Reposition, Resize, and Zoom GTASA Radar

Status
Not open for further replies.

ajom

Well-known member
Joined
Apr 14, 2020
Messages
389
Solutions
2
Reaction score
268
Location
Pluto
Works on Both Single Player and SAMP.

Script Features:
  1. Change the Radar's Positions.
  2. Change the Radar's Dimensions.
  3. Zoom In/Out Radar.
  4. Configurable Keys.
  5. Screenshot Protection.

Installation:
  1. Download the Attachment Below.
  2. Put both Radar Control.cs and Radar Control.ini at your cleo\ directory.

Usage:
  • Toggle the Radar Zoom by pressing both L and K keys.
  • Zoom Out the Radar by holding both L and Plus(+) keys.
  • Zoom In the Radar by holding both L and Minus(-) keys.
  • Pressing both F8 or PrintScreen Key will temporarily deactivate this script, temporarily reverting the radar to its original appearance.
  • Configure the Script Settings by editing Radar Control.ini

Known Bugs:
  • Radar Zooming does not work on Airplaines. There are no documentaries out there that could fix it, if there are any clever Einstein out here who can fix it, I would be glad to see your post regarding with an idea of fixing it.
  • Radar Zooming reverts back to the Default Zoom when the vehicle reaches its maximum speed.
  • Zooming out exaggeratedly does not load some part of the map in the radar. This happens when your draw distance is too low. To fix this, there are two known methods:
    1. Increase your draw distance in a way that your game will stream/load farther than normal.
    2. Download Load Whole Map MOD together with Project2DFX. This will stream the whole map, Please be aware of what these two mods will do to your GTA SA by reading whole post on those sites.

PHP:
{
    Radar Controller by AJOM
        Open Sourced at www.ugbase.eu

    Related Links:
        - https://gtaforums.com/topic/575614-move-radar/?do=findComment&comment=1063020501
        - http://13.sannybuilder.com/files/SA/CLEO/sources/zoom.txt

    Credits:
        - AJOM as Script's Prime Author
        - Parazitas - Radar Zooming Pointer
        - Wesser for his Radar Information Memory Pointers
        - SilentPL for his Radar Zoom Source Code
        - gtaforums community for documentaries
        - ugbase community for documentaries
}

{$CLEO}
03A4: script_name 'RdrCtrl'

CONST
    SCRIPTFLAGS            = 31@
        // SCRIPTFLAGS bit map
    SCREENSHOTPROTECTION    = 0
    ZOOM_ISENABLED            = 1
    REPOSITION                = 2
    REZOOM                    = 3
    SHOWNOTIFICATIONS        = 4
        //
      
    POSITION_X                = 30@
    POSITION_Y                = 29@
    WIDTH                    = 28@
    HEIGHT                    = 27@

    ZOOM_CURRENTVALUE        = 26@
    ZOOM_DELTAVALUE            = 25@
    ZOOMCAR_CURRENTVALUE    = 24@

    KEY_REQUIREDTOPRESS        = 23@
    KEY_ZOOMOUT                = 22@
    KEY_ZOOMIN                = 21@
    KEY_TOGGLEZOOM            = 20@

    ADDRESS_fForceRadarZoom    = 0x586C9B
    ADDRESS_iForceRadarZoom    = 0x586C7F
END
var
    SCRIPTFLAGS: int
    POSITION_X: float
    POSITION_Y: float
    WIDTH: float
    HEIGHT: float
    ZOOM_CURRENTVALUE: float
    ZOOM_DELTAVALUE: float
    KEY_REQUIREDTOPRESS: int
    KEY_ZOOMOUT: int
    KEY_ZOOMIN: int
    KEY_TOGGLEZOOM: int
end

    // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~initialize default settings
if 8AF0: not KEY_REQUIREDTOPRESS = read_int_from_ini_file "cleo\Radar Control.ini" section "KEYS" key "RequiredToPress"
then KEY_REQUIREDTOPRESS = 76 // VK_L
end
if 8AF0: not KEY_ZOOMOUT = read_int_from_ini_file "cleo\Radar Control.ini" section "KEYS" key "ZoomOut"
then KEY_ZOOMOUT = 187 // VK_OEM_PLUS
end
if 8AF0: not KEY_ZOOMIN = read_int_from_ini_file "cleo\Radar Control.ini" section "KEYS" key "ZoomIn"
then KEY_ZOOMIN = 189 // VK_OEM_MINUS
end
if 8AF0: not KEY_TOGGLEZOOM = read_int_from_ini_file "cleo\Radar Control.ini" section "KEYS" key "ToggleZoom"
then KEY_TOGGLEZOOM = 75 // VK_K
end
if 0AF0: 0@ = read_int_from_ini_file "cleo\Radar Control.ini" section "GENERAL" key "ScreenshotProtection"
then
    if 0@ == true
    then 08BD: set SCRIPTFLAGS bit SCREENSHOTPROTECTION
    else 08C3: clear SCRIPTFLAGS bit SCREENSHOTPROTECTION
    end
else 08C3: clear SCRIPTFLAGS bit SCREENSHOTPROTECTION
end
if 0AF0: 0@ = read_int_from_ini_file "cleo\Radar Control.ini" section "GENERAL" key "ShowNotifications"
then
    if 0@ == true
    then 08BD: set SCRIPTFLAGS bit SHOWNOTIFICATIONS
    else 08C3: clear SCRIPTFLAGS bit SHOWNOTIFICATIONS
    end
else 08C3: clear SCRIPTFLAGS bit SHOWNOTIFICATIONS
end
if 0AF0: 0@ = read_int_from_ini_file "cleo\Radar Control.ini" section "ZOOM" key "DefaultEnabled"
then
    if 0@ == true
    then 08BD: set SCRIPTFLAGS bit ZOOM_ISENABLED
    else 08C3: clear SCRIPTFLAGS bit ZOOM_ISENABLED
    end
else 08BD: set SCRIPTFLAGS bit ZOOM_ISENABLED
end

0AC6: 0@ = label @DefaultSettings pointer
0A8D: 1@ = read_memory 0x85A994 size 4 virtual_protect 0
0A8C: write_memory 0@ size 4 value 1@ virtual_protect 0
if 8AF2: not ZOOM_CURRENTVALUE = read_float_from_ini_file "cleo\Radar Control.ini" section "ZOOM" key "StartingValue"
then 0087: ZOOM_CURRENTVALUE = 1@
end
if 8AF2: not ZOOM_DELTAVALUE = read_float_from_ini_file "cleo\Radar Control.ini" section "ZOOM" key "DeltaValue"
then ZOOM_DELTAVALUE = 200.0
end
0@ += 4
0A8D: ZOOMCAR_CURRENTVALUE = read_memory 0x866B88 size 4 virtual_protect 0
0A8C: write_memory 0@ size 4 value ZOOMCAR_CURRENTVALUE virtual_protect 0
0@ += 4
0AC6: 2@ = label @IniSettings pointer
0A8D: 1@ = read_memory 0x858A10 size 4 virtual_protect 0
0A8C: write_memory 0@ size 4 value 1@ virtual_protect 0
if 0AF2: POSITION_X = read_float_from_ini_file "cleo\Radar Control.ini" section "GENERAL" key "PositionX"
then 0A8C: write_memory 2@ size 4 value POSITION_X virtual_protect 0
else 0087: POSITION_X = 1@
end
0A8C: write_memory 2@ size 4 value POSITION_X virtual_protect 0
0@ += 4
2@ += 4
0A8D: 1@ = read_memory 0x866B70 size 4 virtual_protect 0
0A8C: write_memory 0@ size 4 value 1@ virtual_protect 0
if 0AF2: POSITION_Y = read_float_from_ini_file "cleo\Radar Control.ini" section "GENERAL" key "PositionY"
then 0A8C: write_memory 2@ size 4 value POSITION_Y virtual_protect 0
else 0087: POSITION_Y = 1@
end
0A8C: write_memory 2@ size 4 value POSITION_Y virtual_protect 0
0@ += 4
2@ += 4
0A8D: 1@ = read_memory 0x866B78 size 4 virtual_protect 0
0A8C: write_memory 0@ size 4 value 1@ virtual_protect 0
if 0AF2: WIDTH = read_float_from_ini_file "cleo\Radar Control.ini" section "GENERAL" key "Width"
then 0A8C: write_memory 2@ size 4 value WIDTH virtual_protect 0
else 0087: WIDTH = 1@
end
0A8C: write_memory 2@ size 4 value WIDTH virtual_protect 0
0@ += 4
2@ += 4
0A8D: 1@ = read_memory 0x866B74 size 4 virtual_protect 0
0A8C: write_memory 0@ size 4 value 1@ virtual_protect 0
if 0AF2: HEIGHT = read_float_from_ini_file "cleo\Radar Control.ini" section "GENERAL" key "Height"
then 0A8C: write_memory 2@ size 4 value HEIGHT virtual_protect 0
else 0087: HEIGHT = 1@
end
0A8C: write_memory 2@ size 4 value HEIGHT virtual_protect 0
    // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    // I experience a bug where all GTA SA HUD dissapears when I directly patch the main pointer of fRadarPosX,fRadarPosY,fRadarWidth,fRadarHeight
    // So I'll be Patching all Reference Pointers of Radar Informations by Wesser - https://gtaforums.com/topic/575614-move-radar/?do=findComment&comment=1063020501
0AC7: 0@ = var POSITION_X pointer
0A8C: write_memory 0x5834D4 size 4 value 0@ virtual_protect 1 // Left Map and sprites position relative to the radar rectangle.
0A8C: write_memory 0x58A469 size 4 value 0@ virtual_protect 1 // Left Radar ring plane rectangle.
0A8C: write_memory 0x58A79B size 4 value 0@ virtual_protect 1 // Left Upper-left radar disc rectangle.
0A8C: write_memory 0x58A836 size 4 value 0@ virtual_protect 1 // Left Upper-right radar disc rectangle.
0A8C: write_memory 0x58A8E9 size 4 value 0@ virtual_protect 1 // Left Lower-left radar disc rectangle.
0A8C: write_memory 0x58A98A size 4 value 0@ virtual_protect 1 // Left Lower-right radar disc rectangle.
0AC7: 0@ = var POSITION_Y pointer
0A8C: write_memory 0x583500 size 4 value 0@ virtual_protect 1 // Top Map and sprites position relative to the radar rectangle.
0A8C: write_memory 0x58A499 size 4 value 0@ virtual_protect 1 // Top Radar ring plane rectangle.
0A8C: write_memory 0x58A7C7 size 4 value 0@ virtual_protect 1 // Top Upper-left radar disc rectangle.
0A8C: write_memory 0x58A868 size 4 value 0@ virtual_protect 1 // Top Upper-right radar disc rectangle.
0A8C: write_memory 0x58A913 size 4 value 0@ virtual_protect 1 // Top Lower-left radar disc rectangle.
0A8C: write_memory 0x58A9C7 size 4 value 0@ virtual_protect 1 // Top Lower-right radar disc rectangle.
0AC7: 0@ = var WIDTH pointer
0A8C: write_memory 0x5834C2 size 4 value 0@ virtual_protect 1 // Width Map and sprites position relative to the radar rectangle.
0A8C: write_memory 0x58A449 size 4 value 0@ virtual_protect 1 // Width Radar ring plane rectangle.
0A8C: write_memory 0x58A7E9 size 4 value 0@ virtual_protect 1 // Width Upper-left radar disc rectangle.
0A8C: write_memory 0x58A840 size 4 value 0@ virtual_protect 1 // Width Upper-right radar disc rectangle.
0A8C: write_memory 0x58A943 size 4 value 0@ virtual_protect 1 // Width Lower-left radar disc rectangle.
0A8C: write_memory 0x58A99D size 4 value 0@ virtual_protect 1 // Width Lower-right radar disc rectangle.
0A8C: write_memory 0x58781B size 4 value 0@ virtual_protect 1 // Width Radar searchlight maximum width?
0AC7: 0@ = var HEIGHT pointer
0A8C: write_memory 0x5834F6 size 4 value 0@ virtual_protect 1 // Height Map and sprites position relative to the radar rectangle.
0A8C: write_memory 0x58A47D size 4 value 0@ virtual_protect 1 // Height Radar ring plane rectangle.
0A8C: write_memory 0x58A801 size 4 value 0@ virtual_protect 1 // Height Upper-left radar disc rectangle.
0A8C: write_memory 0x58A8AB size 4 value 0@ virtual_protect 1 // Height Upper-right radar disc rectangle.
0A8C: write_memory 0x58A921 size 4 value 0@ virtual_protect 1 // Height Lower-left radar disc rectangle.
0A8C: write_memory 0x58A9D5 size 4 value 0@ virtual_protect 1 // Height Lower-right radar disc rectangle.
    // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    // I experience a bug where the camera glitch on random times, and the hand of all peds gets bend(their quaternions gets messed up) in a weird way, so I'll patch radar zoom reference pointers instead
0AC7: 0@ = var ZOOMCAR_CURRENTVALUE pointer
0A8C: write_memory 0x586C60 size 4 value 0@ virtual_protect 1 // reference pointer of the car radar zoom, which has a value of 0x866B88(the pointer towards the car zoom value)
    // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

08BD: set SCRIPTFLAGS bit REZOOM
WHILE TRUE
    WAIT 0

    if 08B7: test SCRIPTFLAGS bit SCREENSHOTPROTECTION
    then
        if or
            0AB0: is_key_pressed 44 // PrintScreen Key
            0AB0: is_key_pressed 119 // F8 Key = SAMP ScreenShot
        then
            gosub @setdefaultradar
                // wait for the screenshot to finish
            while true
                if or
                    0AB0: is_key_pressed 44 // PrintScreen Key
                    0AB0: is_key_pressed 119 // F8 Key = SAMP ScreenShot
                then wait 0
                else break
                end
            end
                //
            08BD: set SCRIPTFLAGS bit REPOSITION
            08BD: set SCRIPTFLAGS bit REZOOM
        end
    end

    if or
        KEY_REQUIREDTOPRESS == -1 // no extra key requirement
        0AB0: is_key_pressed KEY_REQUIREDTOPRESS
    then
        if 0AB0: is_key_pressed KEY_TOGGLEZOOM
        then
            if 08B7: test SCRIPTFLAGS bit ZOOM_ISENABLED
            then
                gosub @setdefaultzoom
                08C3: clear SCRIPTFLAGS bit REZOOM
                08C3: clear SCRIPTFLAGS bit ZOOM_ISENABLED
                if 08B7: test SCRIPTFLAGS bit SHOWNOTIFICATIONS
                then 0ACD: show_text_highpriority "~y~Radar Zoom: ~r~Disabled" time 1000
                end
            else
                08BD: set SCRIPTFLAGS bit REZOOM
                08BD: set SCRIPTFLAGS bit ZOOM_ISENABLED
                if 08B7: test SCRIPTFLAGS bit SHOWNOTIFICATIONS
                then 0ACD: show_text_highpriority "~y~Radar Zoom: ~g~Enabled" time 1000
                end
            end
            repeat
                wait 0
            until 8AB0: not is_key_pressed KEY_TOGGLEZOOM
        else if 08B7: test SCRIPTFLAGS bit ZOOM_ISENABLED
        then
            if 0AB0: is_key_pressed KEY_ZOOMOUT
            then
                gosub @DeltaSecondToDeltaFrame // makes the zooming smoother
                005B: ZOOM_CURRENTVALUE += 0@
                08BD: set SCRIPTFLAGS bit REZOOM
                if 08B7: test SCRIPTFLAGS bit SHOWNOTIFICATIONS
                then 0AD1: show_formatted_text_highpriority "~g~Radar Zooming Out:~n~~y~%f" time 1000 ZOOM_CURRENTVALUE
                end
            else if 0AB0: is_key_pressed KEY_ZOOMIN
            then
                gosub @DeltaSecondToDeltaFrame // makes the zooming smoother
                0063: ZOOM_CURRENTVALUE -= 0@
                08BD: set SCRIPTFLAGS bit REZOOM
                if 08B7: test SCRIPTFLAGS bit SHOWNOTIFICATIONS
                then 0AD1: show_formatted_text_highpriority "~r~Radar Zooming In:~n~~y~%f" time 1000 ZOOM_CURRENTVALUE
                end
            else
            end
            end
        end
        end
    end

    if 08B7: test SCRIPTFLAGS bit REPOSITION
    then // one time set radar positioning values
        0AC6: 0@ = label @IniSettings pointer
        0A8D: POSITION_X = read_memory 0@ size 4 virtual_protect 0
        0@ += 4
        0A8D: POSITION_Y = read_memory 0@ size 4 virtual_protect 0
        0@ += 4
        0A8D: WIDTH = read_memory 0@ size 4 virtual_protect 0
        0@ += 4
        0A8D: HEIGHT = read_memory 0@ size 4 virtual_protect 0
        08C3: clear SCRIPTFLAGS bit REPOSITION
    end

    IF 08B7: test SCRIPTFLAGS bit ZOOM_ISENABLED
    THEN
        if 08B7: test SCRIPTFLAGS bit REZOOM
        then // one time set radar zoom values
            0AC7: 0@ = var ZOOM_CURRENTVALUE pointer
0A8C: write_memory 0x586C66 size 4 value 0@ virtual_protect 1 // reference pointer of the non-car radar zoom, which has a value of 0x85A994(the pointer towards the non-car zoom value)
            ZOOMCAR_CURRENTVALUE = 0
                // force the zoom to happen
            0A8C: write_memory ADDRESS_fForceRadarZoom size 4 value ZOOM_CURRENTVALUE virtual_protect 0
            0092: 0@ = float ZOOM_CURRENTVALUE to_integer
            0A8C: write_memory ADDRESS_iForceRadarZoom size 4 value 0@ virtual_protect 0
                //
            08C3: clear SCRIPTFLAGS bit REZOOM
        end
            // Make sure there is a zone/vehicle name to display
        0A8D: 0@ = read_memory 0xBAB1D0 size 4 virtual_protect 0 // is zone displayed?
        IF 0@ <> 0
        THEN
            0A8C: write_memory 0xBAA930 size 4 value true virtual_protect 0 // Zone Name State
            0A8C: write_memory 0xBAA930 size 4 value 1500 virtual_protect 0 // Zone Name Timer
        END
        0A8C: write_memory 0xBAA448 size 4 value true virtual_protect 0 // Vehicle name state
        0A8C: write_memory 0xBAA450 size 4 value 1500 virtual_protect 0 // Vehicle name timer
            //
    END
END

:DeltaSecondToDeltaFrame
        // per second to per frame converter
    0A8D: 1@ = read_memory 0xB7CB5C size 4 virtual_protect 0 // get average frame time for smooth dragging
    1@ /= 50.0
    0087: 0@ = ZOOM_DELTAVALUE
    006B: 0@ *= 1@
        //
return

:setdefaultzoom
    0A8C: write_memory 0x586C66 size 4 value 0x85A994 virtual_protect 1 // reference pointer towards the non-car zoom pointer
    0AC6: 0@ = label @DefaultSettings pointer
    0A8D: 1@ = read_memory 0@ size 4 virtual_protect 0
    0A8C: write_memory ADDRESS_fForceRadarZoom size 4 value 1@ virtual_protect 0
    0092: 1@ = float 1@ to_integer
    0A8C: write_memory ADDRESS_iForceRadarZoom size 4 value 1@ virtual_protect 0
    0@ += 4
    0A8D: ZOOMCAR_CURRENTVALUE = read_memory 0@ size 4 virtual_protect 0
return

:setdefaultradar
    gosub @setdefaultzoom
    0@ += 4
    0A8D: POSITION_X = read_memory 0@ size 4 virtual_protect 0
    0@ += 4
    0A8D: POSITION_Y = read_memory 0@ size 4 virtual_protect 0
    0@ += 4
    0A8D: WIDTH = read_memory 0@ size 4 virtual_protect 0
    0@ += 4
    0A8D: HEIGHT = read_memory 0@ size 4 virtual_protect 0
return

:IniSettings
hex
    00 00 00 00 {fRadarPosX}
    00 00 00 00 {fRadarPosY}
    00 00 00 00 {fRadarWidth}
    00 00 00 00 {fRadarHeight}
end

:DefaultSettings
hex
    00 00 00 00 {fRadarZoom}
    00 00 00 00 {fRadarCarZoom}
    00 00 00 00 {fRadarPosX}
    00 00 00 00 {fRadarPosY}
    00 00 00 00 {fRadarWidth}
    00 00 00 00 {fRadarHeight}
end

PHP:
[GENERAL]

    # In Game Screen Coordinate System Format
    # PositionX and Width must be within 0.0 to 640.0
    # PositionY and Height must be within 0.0 to 448.0
PositionX = 5.5 # Default: 40.0
PositionY = 104.0 # Default: 104.0
Width = 112.8 # Default: 94.0
Height = 91.2 # Default: 76.0

    # the script will temporary not work and will revert to default settings everytime you are holding F8 or PrintScreen Key
ScreenshotProtection = 1

    # informs you when zooming in/out, and toggling zoom state
ShowNotifications = 1

[ZOOM]
    # automatically activate the custom zoom feature on startup?
DefaultEnabled = 1

    # Must be a Positive decimal number
    # Lower Value will Zoom-In the Radar
    # Higher Value will Zoom-Out the Radar
StartingValue = 500.0 # .ini Default: 500.0 , InGame Default: 180.0

    # Amount of Current Zoom Value's Change per second when pressing the ZoomIn or ZoomOut
DeltaValue = 200.0 # Default: 200.0

[KEYS]
    # If "RequiredToPress" Value is not "-1" then You need to press this button, together with any keys below to activate them
    #    Example: RequiredToPress + ZoomOut     ~    To Zoom Out Radar
RequiredToPress = 76 # Default: 76 = VK_L

ZoomOut = 187 # Default: 187 = VK_OEM_PLUS
ZoomIn = 189 # Default: 189 = VK_OEM_MINUS

    # enable/disable custom radar zoom feature
ToggleZoom = 75 # Default: 75 = VK_K

    # To know the Virtual Key Code of a certain key, visit:
    # https://cherrytree.at/misc/vk.htm
 

Attachments

  • Radar Control.zip
    7.7 KB · Views: 188
Last edited:
Status
Not open for further replies.
Top