SetCameraShakeLevel: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "{{Client function}}__NOTOC__ {{Note|Not present in any version yet.}} {{New feature/item|3.0150|1.5|| Function sets the camera shake level. }} == Syntax == <syntaxhighlight lang="lua"> boo...")
 
(Updated and improved the page)
Line 1: Line 1:
{{Client function}}__NOTOC__
{{Client function}}
{{Note|Not present in any version yet.}}
__NOTOC__
{{New feature/item|3.0150|1.5||
{{New feature/item|3.0150|1.5|7344|
Function sets the camera shake level.
This function sets the camera shake level (as seen on the ''Are you going to San Fierro?'' singleplayer mission).}}
}}


== Syntax ==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool setCameraShakeLevel ( int shakeLevel )
bool setCameraShakeLevel ( int shakeLevel )
</syntaxhighlight>
</syntaxhighlight>


===Required Arguments===
===Required arguments===
*'''shakeLevel''': Integer between 0 - 255 which represent camera shake level
*'''shakeLevel''': an integer between 0 and 255, which represents the camera shake intensity level.


=== Returns ===
===Returns===
Returns ''true'' if camera shake level was changed, ''false'' otherwise.
Returns ''true'' if the camera shake level was changed, ''false'' if the required argument is incorrect or missing.


== Example ==  
==Example==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
addCommandHandler("camshake",
addCommandHandler( "camshake",
function( cmd, level )
    function( _, level )
if setCameraShakeLevel( tonumber(level) ) then
        local level = math.floor( tonumber( level ) )
outputChatBox( "Camera shake level updated." )
        if level then
else
            setCameraShakeLevel( level )
outputChatBox( "Camera shake level must be between 0 - 255." )
            outputChatBox( "Camera shake level updated to " .. level .. "." )
end
        else
end
            outputChatBox( "Camera shake level must be between 0 and 255." )
        end
    end
)
)
</syntaxhighlight>
</syntaxhighlight>


== See Also ==
==See also==
{{Client_camera_functions}}
{{Client_camera_functions}}

Revision as of 13:20, 11 July 2015

This function sets the camera shake level (as seen on the Are you going to San Fierro? singleplayer mission).

Syntax

bool setCameraShakeLevel ( int shakeLevel )

Required arguments

  • shakeLevel: an integer between 0 and 255, which represents the camera shake intensity level.

Returns

Returns true if the camera shake level was changed, false if the required argument is incorrect or missing.

Example

addCommandHandler( "camshake",
    function( _, level )
        local level = math.floor( tonumber( level ) )
        if level then
            setCameraShakeLevel( level )
            outputChatBox( "Camera shake level updated to " .. level .. "." )
        else
            outputChatBox( "Camera shake level must be between 0 and 255." )
        end
    end
)

See also