[How-To] Load CayoPerico minimap all of the time

Hello all :wave:,

As I have talked about it a bit two weeks ago in with some posts in this topic : [Releases] [Free] Cayo Perico Improvements Freeroam 4.1.9

I found a way to load the Cayo Perico minimap all of the time without breaking every other interiors minimap. I think that this can have it’s own topic so that people will be able to find it easily.
You can find the original post here :

He is the snippet with some comments :

---Will be true if the player is close to cayo perico
[email protected] boolean
local _isCloseToCayo = false

---Will be true if the minimap is loaded with SetToggleMinimapHeistIsland
[email protected] boolean
local _isCayoMinimapLoaded = false

---Checks coords to know if the player is close enough to cayo perico to be in need to load the minimap with SetToggleMinimapHeistIsland
Citizen.CreateThread(function()
    while true do
        ---Wether the player is actually close to cayo perico or not
        [email protected] boolean
        local isCloseToCayo<const> = #(GetEntityCoords(PlayerPedId()) - vector3(4858.0, -5171.0, 2.0)) < 2200.0

        if _isCloseToCayo ~= isCloseToCayo then
            -- If the player is now close to cayo perico and was not, or vice versa
            -- Then we init our variables and unload the minimap
            _isCloseToCayo = isCloseToCayo
            _isCayoMinimapLoaded = isCloseToCayo

            -- switch radar interior
            SetToggleMinimapHeistIsland(_isCloseToCayo)
        end

        Wait(5000)
    end
end)

---Handle the minimap loading and unloading
CreateThread(function()
    while true do
        ---We don't need to do something every frame in every cases
        [email protected] integer
        local wait = 500

        if IsPauseMenuActive() and not IsMinimapInInterior() then
            -- If the player is in the pause menu and not looking at an interior minimap
            if _isCayoMinimapLoaded then
                -- If the minimap was loaded with SetToggleMinimapHeistIsland, then we disable it
                _isCayoMinimapLoaded = false
                SetToggleMinimapHeistIsland(false)
            end
            -- We force load the cayo perico minimap
            SetRadarAsExteriorThisFrame()
            SetRadarAsInteriorThisFrame(GetHashKey("h4_fake_islandx"), 4700.0, -5145.0, 0, 0)
            wait = 0

        elseif not _isCayoMinimapLoaded and _isCloseToCayo then
            -- If the minimap is not loaded with SetToggleMinimapHeistIsland and the player is close to cayo perico, then we load it
            _isCayoMinimapLoaded = true
            SetToggleMinimapHeistIsland(true)
        end
        Wait(wait)
    end
end)

Resmon goes from 0.00ms idle, to 0.02ms when it has to load the minimap on the pause menu.


Here is what it will look like and with the ms consumptions :
Default minimap and radars are used.


Here is the really small resource that I used for these screenshots :
cayo_map.zip (1.3 KB)
So that you can test it easily and anybody have an example of how to use the snippet


There are two slight issues that I couldn’t find a way to fix :

  • Once you have changed the view from inside an interior to see the whole map, you can’t go back to the interior minimap without closing and opening your pause menu

  • I couldn’t move the radar border, so we can’t go further to the right and bottom when the map is opened.
    To fix this, you need to set a blip in the far bottom right corner.
    See more informations here : [How-To] Load CayoPerico minimap all of the time - #3 by DarkProd
    Thanks to @DarkProd for the information <3

If somebody knows how to fix any of these, I would be pleased to learn about it. :smiley:


I hope you guys liked it and that it will be useful to anybody :smiley:

2 Likes

At least players can put a waypoint on the airport runway :fire::sunglasses::ok_hand:

2 Likes

To fix this:

I couldn’t move the radar border, so we can’t go further to the right and bottom when the map is opened

you could just make a blip in the far right bottom corner with a scale of 0.0 and that’s it

Like this:

local cayoFixBlip = AddBlipForCoord(5943.0, -6272.0, 0)
SetBlipSprite(cayoFixBlip, 575)
SetBlipDisplay(cayoFixBlip, 4)
SetBlipScale(cayoFixBlip, 0.0)
SetBlipColour(cayoFixBlip, 0)
SetBlipAsShortRange(cayoFixBlip, true)
BeginTextCommandSetBlipName("STRING")
AddTextComponentString("Cayo Perico")
EndTextCommandSetBlipName(cayoFixBlip)
4 Likes

Nice work, thanks for sharing :slight_smile:

3 Likes

Thank you :smiley:

2 Likes

Oh wow, I never thought that this could fix it so easily ! Thank you a lot !

3 Likes

I mentioned you in the main topic. :slight_smile:
Thanks again ! :smiley:

3 Likes

When I run cayo perico, I shoot a video on rockstar editor, and I have a crash. Is there a solution to this problem?

1 Like

Hello, sorry but this is not related to this topic at all.
However you can find more informations here : New FiveM Update - Crashes Rockstar Editor

3 Likes

I’ll eventually get round to fixing this Rockstar Editor nonsense but right now, I’m not exactly coding and bothered by it. Maybe someone from the community who isn’t drunk on power and money making schemes, can help me out with a PR :man_shrugging:t2::stuck_out_tongue:

1 Like

FiveM have pushed a fix, simply open FiveM and it’ll update. Record a clip in Cayo Perico and access Rockstar Editor While in the server and it should be fine

@Smallo any idea how you’d fix this:

1 Like