- Documentation
- Client functions
- getWorldPositionFromPlayerMap
Function
getWorldPositionFromPlayerMap
Converts a screen point on the open map to a world point. It works the same as the coordinates from onClientPlayerMapClick.
Syntax
float getWorldPositionFromPlayerMap(float x, float y)Arguments
xfloat- Screen X in pixels.
yfloat- Screen Y in pixels.
Returns
World x, y, or false when the map is closed.
Example
local cx, cy = getCursorPosition()
local sw, sh = guiGetScreenSize()
if cx then
local x, y = getWorldPositionFromPlayerMap(cx * sw, cy * sh)
if x then outputChatBox(("Kursor nad %.0f, %.0f"):format(x, y)) end
end
See also
getPlayerMapPositionFromWorldConverts a world point to a screen point on the open map. The map is slightly tilted, so the conversion accounts for perspective. The result can fall outside the visible rectangle; check it againstgetPlayerMapArea.onClientPlayerMapClickThe player clicked the open map. The left button arrives on release, only if the map was not dragged; the right button arrives straight away. World coordinates are already converted from the map view.