SetFPSLimit: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
(Added information)
Line 1: Line 1:
{{Server client function}}
{{Server client function}}
__NOTOC__
__NOTOC__
{{New feature|3.0132|1.3.2|
The client side version of this function will only work from version 1.3.2 onwards
}}
This function sets 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 sets the maximum [http://en.wikipedia.org/wiki/Frame_rate 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}}
{{Note|When set client side, the actual limit used is the lowest of both the server and client set values}}
Line 12: 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 disabled.
*'''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). It is also recommended to set a conservative FPS limit (between 30-60), because high FPS can break some GTA internal calculations. The most obvious problems which occur with high FPS are a slower swimming and the impossibility to move sideways while aiming weapons. Also, driving is slightly affected.


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

Revision as of 09:47, 16 July 2014

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). It is also recommended to set a conservative FPS limit (between 30-60), because high FPS can break some GTA internal calculations. The most obvious problems which occur with high FPS are a slower swimming and the impossibility to move sideways while aiming weapons. Also, driving is slightly affected.

Returns

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

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