SetFPSLimit: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
Line 9: Line 9:


===Required Arguments===  
===Required Arguments===  
*'''fpsLimit:''' An integer value representing the maximum FPS. This value may be between '''25''' and '''100''' FPS. 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).
*'''fpsLimit:''' An integer value representing the maximum FPS. This value may be between '''25''' and '''100''' FPS. 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 manually be changed via "fps_limit=0" in console or '''MTA San Andreas 1.5\MTA\config\coreconfig.xml''').


===Returns===
===Returns===

Revision as of 12:52, 15 April 2020

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

[[{{{image}}}|link=|]] Note: When set client side, the actual limit used is the lowest of both the server and client set values

Syntax

bool setFPSLimit ( int fpsLimit )         

Required Arguments

  • fpsLimit: An integer value representing the maximum FPS. This value may be between 25 and 100 FPS. 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 manually be changed via "fps_limit=0" in console or MTA San Andreas 1.5\MTA\config\coreconfig.xml).

Returns

Returns true if successful, or false if it was not possible to set the limit or an invalid value was passed.

Issues when increasing FPS

It is also recommended to set a conservative FPS limit (between 30-60 and 74 highest), because high FPS can break some GTA internal calculations. The higher the FPS the more of a problem these become:

  • Impossibility to move sideways while aiming certain weapons.
  • Speed of vehicles is effected, racers with a higher FPS will have an unfair advantage.
  • Pressing the horn button to turn on and off sirens gets really hard the higher the FPS.
  • Climbing over certain objects will result in instant death. Example at: 2520.108, -1681.407, 19.406, 266
  • Animations can randomly get messed up.
  • There were more issues like not being able to take off in Skimmer which MTA developers have fixed.
  • Satchels can be thrown ~10% less distance.

Example

This command sets the fps limit in a command handler.

Click to collapse [-]
Server
function fpsFunction( player, command, limit ) -- First define the function
  if hasObjectPermissionTo ( player, "function.setFPSLimit" ) and limit then 
    -- If the player has permission to set FPS limit and limit is submitted...
    setFPSLimit ( limit ) -- Set the fps.
  end
end 

addCommandHandler ( "setfps", fpsFunction ) -- Attach the setfps command to fpsFunction function.

See Also