- Documentation
- Client events
- onClientPlayerMapToggle
Event
onClientPlayerMapToggle
The game map was opened or closed: from the ESC menu, by forcePlayerMap or with the ESC key.
Handler
addEventHandler("onClientPlayerMapToggle", root, function(visible) ... end)Parameters
visiblebooltrue= the map is open.
Source
source is the local player.
Example
addEventHandler("onClientPlayerMapToggle", localPlayer, function(visible)
showChat(not visible)
end)
See also
isPlayerMapVisibleChecks whether the player has the map open right now, from the ESC menu or from a script. On the server the state comes from the client, so it changes with a short delay after the map opens.forcePlayerMapOpens or closes the game map: the same map as in the ESC menu, with blips, the GPS target and the route. On the server it works for one player or everyone (root). On the client you can pass a screen rectangle: the map is then drawn only inside it, without the title, legend or background around it. This works well for a spawn selection screen, because clicks outside the map still go to scripts (onClientClick, GUI). The player closes the map with ESC or the "Back" button and goes straight back to the game. Bind it to a key (e.g. F11) withbindKey.