- Documentation
- Client functions
- getPlayerMapArea
Function
getPlayerMapArea
Returns where the open map is on screen: the rectangle the terrain is drawn in. Useful for drawing your own markers and a frame around a map embedded with forcePlayerMap.
Syntax
float getPlayerMapArea()Returns
x, y, width, height in pixels and true when the map is embedded in a rectangle; false when the map is closed.
Example
addEventHandler("onClientRender", root, function()
local x, y, w, h = getPlayerMapArea()
if x then
dxDrawRectangle(x - 4, y - 4, w + 8, 4, tocolor(255, 200, 0))
end
end)
See also
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.getPlayerMapBoundingBoxOn the server returns the world rectangle visible on the player's open map (the client reports it at most once a second). On the client returns where the whole map (the world from -3000 to 3000) is on screen: the top-left and bottom-right corners in pixels.