Calling an export
Opening and closing
The legend
Markers
Postal numbers
The player card and tabs
The page exports are described separately in Pages.
Views
Described separately in Views.
Custom settings
Described separately in Custom settings.
World exceptions
See Keeping entities in sight.
The world under the map
See Changing the world while the server runs.
Exports
Opening
Open and Toggle take an optional view id, registered beforehand with RegisterView, and the
parameters that view is to be shown with. Omitting the id uses the default view, which is the
standard map unless SetDefaultView said otherwise. An id that was never registered opens nothing
and says so in the console.
SwitchView puts another view on the open map. When the map is up, or a page is open over it, the
map stays open: the camera flies from where it is to where the new view opens, and only
el:pausemenu:view:leave and el:pausemenu:view:enter are raised. Over the settings, or on the
game’s own map, it closes the map and opens it again on the new view. When that view is not
registered, refuses the parameters or refuses to open, the map on screen stays as it is. Open on an open map
does nothing, because the two views are two maps and one’s camera flight and markers are not the
other’s.
UpdateView and RemoveView act only on a view the calling resource registered.
SetViewParams, PatchView and RefreshView act on the view that is on screen and do nothing when
the map is closed. Another resource follows a view through the el:pausemenu:view:* events, and
can stop one from opening with the beforeOpen hook, registered with RegisterHook.
See Following a view from another resource.
Open does nothing when the map is already open, while it is opening or closing, or when the player
cannot see it: during the pause menu, while the screen is faded, and when the player is not loaded
or is dead. Without a framework, “loaded” and “dead” are read from the game itself: the map opens
for a connected player whose character is spawned and alive. A map that is open when the player dies
closes, together with any page or settings screen on it.
SetEnabled turns the map on and off. While disabled, Toggle, Open and the toggle command do
nothing, and a map that is open closes. IsEnabled reports the current state; the map starts
enabled. While the map is disabled the game’s own pause menu works again, so a player is never left
without one.
Choosing the map
SetMapMode chooses which map the Map tab is for this player: "3d" for this menu’s own, or
"vanilla" for the game’s full-screen map, with the settings screen and pages unchanged. It starts
at mapMode in Menu, which also describes how the menu
behaves with each. A menu that is open when the mode changes closes; the next open uses the new
mode. Anything other than the two names is refused: it returns false and the mode stays as it was.
GetMapMode reports the current mode.
The mode lives on the client and is back to mapMode when the resource restarts, so set it when the
player spawns, for example from an event your server sends:
Open, Toggle, Close and IsOpen work as with the 3D map, and the
events carry the id of the view that was opened. Views belong to the 3D map: a view id passed to
Open must still be registered and willing to open, and the game’s map is shown in its place.
Moving the map
FocusMap flies the open map over a point, for example to show the player where a call came from.
height is metres above the ground there; left out, the camera keeps the height it is at.
seconds is how long the move takes; left out, it takes as long as a click on a marker does
(focus.panDuration in Camera). The point is
kept inside the area the map can be dragged over, and the height inside its limits.
It returns false and does nothing when there is no map on screen to move: the menu is closed,
still opening or closing, or showing the game’s own map. While the camera moves, the player’s own
drag and zoom wait for it to land. Calling it again before then takes over from the first move.
The advanced legend
SetLegendMode chooses the legend for this player: "default", the game’s list, or "advanced",
with a search, headings and a switch on every row. It starts at legendMode in
Menu, which describes what the player can do with
it. An open menu changes at once. GetLegendMode reports the current mode.
A heading is a category your resource registers with RegisterLegendCategory: an id you place
blips by, the label the player reads, and an order, lowest first (0 when left out). Headings
with the same order are sorted by label. Registering an id again changes its label and order.
The id "other" is taken: it is where every blip nobody placed goes, last.
Blips are placed three ways, from the most specific:
SetBlipLegendCategoryplaces one blip: a game blip handle, fromAddBlipForCoordor any other blip native, or the id this menu’sAddBlipreturned. On the 3D map the blip gets a row of its own under that heading. On the game’s map the game decides the rows, so the whole row the blip is listed in moves.SetNameLegendCategoryplaces every blip with that name, without case.*stands for anything, so"*Depot"covers"Garbage Depot"and"Cypress Flats Depot". A name written out wins over a pattern that also covers it.SetSpriteLegendCategoryplaces every blip with that sprite.
SetLegendCategoryHidden switches a whole heading off or on for the player, as its switch does,
and IsLegendCategoryHidden reads it. With rememberLegend on, the change is kept with the
player’s own.
Keeping entities in sight
WithhideWorld on, the map hides every ped and vehicle except the player, the vehicle they are in
and whoever is inside it. AddWorldException keeps something else in sight on every view; for one
view only, use its show field.
A target names exactly one of these:
and optionally:
AddWorldException returns the exception’s id, or nil when the target does not read, with the
reason in the console. It takes effect at once, on an open map too.
An exception belongs to the resource that added it. Only that resource can remove it, and
ClearWorldExceptions removes only that resource’s own. When the resource stops, its exceptions go
with it. ListWorldExceptions returns every exception and the resource that owns it.
These are client exports. To decide on the server who sees whom, send the list to the client and add
the exceptions there:
Changing the world while the server runs
SetWorldConfig changes the settings of World
without editing configs/map-world.jsonc: the colour grade, the time and the weather, what is hidden
and the detail distance. It takes any of that file’s keys, laid over what is set key by key, so
{ time = { hour = 20 } } changes the hour and leaves time.lock as it was. It applies to every
view, at once, on an open map too. A view’s own world still has the last word over it.
A patch with a key the file does not have, a value of the wrong kind, or an hour that is not a whole
one from 0 to 23 changes nothing: SetWorldConfig answers false and the reason is in the
console. GetWorldConfig returns the settings in force, the file’s with every change laid over
them, and ResetWorldConfig goes back to the file.
Nothing is saved: the changes last until the resource restarts, and they are this client’s only.
Any resource can make them, and the last change wins.
AddBlip options
Only coords is required.
Position and appearance
Labels and the legend
Categories
A category is a whole number from0 to 255, the same values the game’s SetBlipCategory takes.
A marker with no category counts as 255. These change how the row reads, as they do on the game’s
own map:
Name a category from
12 to 133 with the game’s text entry BLIP_CAT_<number>:
2, 7 or 10 to 254 shows the name, icon and
colour of the one you are on as you step through it. For 7, 10 and 11 the words in front of the
name are the game’s own, in the language the game is set to. Distances follow the game’s measurement
setting.
Behaviour
Shapes
A marker with
radius or areaWidth is a shape: it cannot be clicked or hovered, and it is never
listed in the legend.
Vision cone
Every configured default above is listed in Markers.
UpdateBlip
Changes a marker your resource added with AddBlip, in place: the fields the patch names, with the
meanings above, and nothing else. A moving unit, a drop that is done or a robbery that stops
flashing keeps its id and its row in the legend, where RemoveBlip followed by AddBlip would make
it a new marker.
false for a marker that is gone and for one another resource added: each resource
changes only its own.
SetBlipMeta
Attaches map information to a marker another resource created with the game’s own functions, so that
marker gains a legend name, an icon, a cone and the rest.
handle is the marker handle the game returned. meta accepts name, icon, category,
hiddenOnLegend, routeColor, radius, radiusEdge, cone, coneColor, coneFov, coneRange,
flashSpeed, number, tick, goldTick, headingIndicator, outline, friendIndicator,
crewIndicator, priority, areaWidth, areaHeight, scale, stretch, rgb and bright, with
the meanings above. On a marker the game created, rgb is its secondary colour: the colour of the
marker itself while its colour index is 84, and of its outline and crew mark whatever its colour. Calls are merged, so setting name and later setting category keeps both.
The integration fills most of these in on its own from the game’s functions: a marker given
SetRadiusBlipEdge, SetBlipScaleTransformation, a flash that runs for a set time with
SetBlipFlashTimer, or a tick, a heading pointer, an outline, a friend or a crew mark with the game’s
Show…OnBlip functions shows on the map as it does on the game’s, and PulseBlip pulses it there too.
A marker you coloured with SetBlipSecondaryColour is picked up on its own (the integration watches
that function) and its colour is used while the marker’s colour index is 84
(BLIP_COLOUR_USE_COLOUR32), which is the same rule the game draws by. rgb here is for a marker
whose colour the game never saw.
This reaches only markers the map can see, which is what the integration is for. See Markers do
not appear.
The player card
SetProfile replaces any of the three fields and leaves the others as they are.
The player card can be turned off entirely. See Map.
Pages
RegisterPage adds a tab beside the map’s own and the screen behind it. id must be unique;
registering your own id again replaces the first, and order decides the position. A page is
changed and removed only by the resource that registered it.
The map draws the page from the content you registered, and reports what the player does with it.
Everything a page can contain is in Pages.
Opening the settings
OpenSettings opens the menu on the Settings tab, on the category your resource registered with
RegisterSettings under that id. Left out, or naming a category that is not registered, it opens on
the first category, as the tab does. An open menu moves to the settings; one already on them moves
to that category. A view that does not offer the Settings tab is left as it is.
The start tab
SetStartTab chooses the tab the menu opens on, in place of startTab in
Menu: "map", "settings" or a page id.
The second argument replaces startCamera: whether the camera flies up before that tab is shown.
Leaving either argument out goes back to the configured value. It applies from the next time the
menu opens.
OpenPage is not affected by either: it opens the menu on the page it names, without the camera
unless its own second argument is true.
What they return
ClearBlips removes only the markers your resource added through AddBlip. Markers other
resources added, the player’s own marker and markers mirrored from the game’s are not affected.
When your resource stops, the markers it added are removed with it.
Errors
Coordinates without numericx and y raise an error naming the product, and so does calling
AddBlip with no coordinates or no options at all:
z is not an error: it defaults to 0.0.
Calling any export before element_3d_pausemenu has started does nothing, because the export does not exist
yet. Wait for el:pausemenu:ready. See Events.
RemoveBlip with an unknown id, and Close while the map is closed, do nothing.