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
Manual Review Required
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
bool setFPSLimit ( int fpsLimit )Required Arguments
- fpsLimit: An integer value representing the maximum FPS. Refer to the note above for possible values. You can also pass 0 or false , in which case the FPS limit will be the one set in the client settings (by default 100 FPS and the client fps limit should also be manually changed via " fps_limit=0 " in console or MTA San Andreas\MTA\config\coreconfig.xml ).
Returns
- bool: value
Returns true if successful, or false if it was not possible to set the limit or an invalid value was passed.
Code Examples
shared
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) endendaddCommandHandler("fpslimit", fpsFunction)See Also
Utility Functions
- addDebugHook
- bitAnd
- bitArShift
- bitExtract
- bitLRotate
- bitLShift
- bitNot
- bitOr
- bitReplace
- bitRRotate
- bitRShift
- bitTest
- bitXor
- createTrayNotification
- debugSleep
- decodeString
- deref
- downloadFile
- encodeString
- fromJSON
- generateKeyPair
- getColorFromString
- getDevelopmentMode
- getDistanceBetweenPoints2D
- getDistanceBetweenPoints3D
- getEasingValue
- getFPSLimit
- getKeyboardLayout
- getLocalization
- getNetworkStats
- getNetworkUsageData
- getPerformanceStats
- getProcessMemoryStats
- getRealTime
- getServerIp
- getTickCount
- getTimerDetails
- getTimers
- gettok
- getUserdataType
- getVersion
- hash
- inspect
- interpolateBetween
- iprint
- isOOPEnabled
- isShowCollisionsEnabled
- isShowSoundEnabled
- isTimer
- isTimerPaused
- isTransferBoxAlwaysVisible
- isTransferBoxVisible
- isTrayNotificationEnabled
- killTimer
- md5
- passwordHash
- passwordVerify
- pregFind
- pregMatch
- pregReplace
- ref
- removeDebugHook
- resetTimer
- setClipboard
- setDevelopmentMode
- setFPSLimit
- setTimer
- setTimerPaused
- setTransferBoxVisible
- setWindowFlashing
- sha256
- showCol
- showSound
- split
- teaDecode
- teaEncode
- tocolor
- toJSON
- utfChar
- utfCode
- utfLen
- utfSeek
- utfSub