guiGetScreenSize | Multi Theft Auto: Wiki Skip to content

guiGetScreenSize

Client-side
Server-side
Shared

This page is incomplete! Help wanted!

Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.


This function retrieves the local screen size according to the resolution they are using.

Syntax

guiGetScreenSize ( )

Code Examples

client

This example checks whether a player is using a low resolution, and warns them that GUI may appear incorrect.

--setup a function when the resource starts
function checkResolutionOnStart ()
local x,y = guiGetScreenSize() --get their screen size
if ( x <= 640 ) and ( y <= 480 ) then --if their resolution is lower or equal to 640x480
--warn them about GUI problems.
outputChatBox ( "WARNING: You are running on a low resolution. Some GUI may be placed or appear incorrectly." )
end
end
--attach the function to the event handler
addEventHandler ( "onClientResourceStart", resourceRoot, checkResolutionOnStart )

See Also

GUI Functions