setFPSLimit | Multi Theft Auto: Wiki Skip to content

setFPSLimit

Client-side
Server-side
Shared
Needs checking

This function was partially migrated from the old wiki. Please review manually:

  • Missing section: Issues when increasing FPS
  • Missing section: Fix for climbing over certain objects

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 sets the maximum FPS (Frames per second) that players on the server can run their game at.

Note

When set client side, the actual limit used is the lowest of both the server and client set values. Starting from version [ r21313 ] and above fpsLimit range is 25-32767 . In older MTA releases it was 25-100 .

Syntax

setFPSLimit ( )

Code Examples

server
function fpsFunction(commandName, fpsLimit)
local newFPS = tonumber(fpsLimit)
if not newFPS then
outputChatBox("Syntax: /" .. commandName .. " [FPS] - to limit your own FPS.")
return false
end
if newFPS < minFPS or newFPS > maxFPS then
outputChatBox("Please enter a value between " .. minFPS .. " and " .. maxFPS .. ".")
return false
end
local currentLimit = getFPSLimit()
local setNewFPS = (newFPS ~= currentLimit)
if (setNewFPS) then
outputChatBox("Your FPS have been limited to: " .. newFPS .. ".")
setFPSLimit(newFPS)
end
end
addCommandHandler("fpslimit", fpsFunction)