GetFPSLimit: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
(Update example and fps range.)
 
(6 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Server client function}}
{{Server client function}}
__NOTOC__
__NOTOC__
This function retrieves the maximum [http://en.wikipedia.org/wiki/Frame_rate FPS (Frames per second)] that players on the server can run their game at.
This function retrieves the maximum [http://en.wikipedia.org/wiki/Frame_rate FPS (Frames per second)] that players on the server can run their game at.
{{Note|
* Starting from version [[https://buildinfo.mtasa.com/?Revision=21313&Branch r21313]] and above '''fpsLimit''' range is '''25-32767'''. In older MTA releases it was '''25-100'''.
}}


==Syntax==  
==Syntax==  
Line 9: Line 12:


===Returns===
===Returns===
Returns an integer between '''25''' and '''100''' of the maximum FPS that players can run their game at.
Returns an integer between '''25''' and '''32767''' (refer to the note above) of the maximum FPS that players can run their game at.


==Example==  
==Example==  
This example displays a message in the chatbox showing the current fps limit.
This example displays a message in the chatbox showing the current FPS limit.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function fpsLim()
function checkFPSLimit()
        outputChatBox ( "The FPS limit is: " .. tostring( getFPSLimit () ) ) --function returns an int so we must convert it to a string
local fpsLimit = getFPSLimit()
end                                                 


-- Add console command "fpslimit" which calls the function fpsLim
outputChatBox("The FPS limit is: "..fpsLimit)
addCommandHandler ( "fpslimit", fpsLim )
end
addCommandHandler("checkfpslimit", checkFPSLimit) -- Add command "checkfpslimit" which calls the function checkFPSLimit
</syntaxhighlight>
</syntaxhighlight>
[[pl:getFPSLimit]]
[[ru:getFPSLimit]]


==See Also==
==See Also==
{{Server functions}}
{{Server functions}}

Latest revision as of 22:03, 22 May 2023

This function retrieves the maximum FPS (Frames per second) that players on the server can run their game at.

[[{{{image}}}|link=|]] Note:
  • Starting from version [r21313] and above fpsLimit range is 25-32767. In older MTA releases it was 25-100.

Syntax

int getFPSLimit ()         

Returns

Returns an integer between 25 and 32767 (refer to the note above) of the maximum FPS that players can run their game at.

Example

This example displays a message in the chatbox showing the current FPS limit.

function checkFPSLimit()
	local fpsLimit = getFPSLimit()

	outputChatBox("The FPS limit is: "..fpsLimit)
end
addCommandHandler("checkfpslimit", checkFPSLimit) -- Add command "checkfpslimit" which calls the function checkFPSLimit

See Also