SetFPSLimit: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 19: Line 19:
==Example==  
==Example==  
This command sets the fps limit in a command handler.
This command sets the fps limit in a command handler.
<section name="Server" class="server" show="true">
<syntaxhighlight lang="lua">function fpsFunction( player, command, limit ) -- First define the function
<syntaxhighlight lang="lua">function fpsFunction( player, command, limit ) -- First define the function
   if hasObjectPermissionTo ( player, "function.setFPSLimit" ) and limit then  
   if hasObjectPermissionTo ( player, "function.setFPSLimit" ) and limit then  
Line 28: Line 29:
addCommandHandler ( "setfps", fpsFunction ) -- Attach the setfps command to fpsFunction function.
addCommandHandler ( "setfps", fpsFunction ) -- Attach the setfps command to fpsFunction function.
</syntaxhighlight>
</syntaxhighlight>
</section>


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

Revision as of 14:50, 18 April 2013

The clientside version of this function does only work from version 1.4 onwards This function sets the maximum FPS (Frames per second) that players on the server can run their game at.

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 disabled.

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