SetCameraShakeLevel: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Added explanation of what the example does)
mNo edit summary
 
(6 intermediate revisions by 5 users not shown)
Line 1: Line 1:
__NOTOC__
{{Client function}}
{{Client function}}
__NOTOC__
{{Deprecated|setCameraDrunkLevel|Deprecated as of 1.6.0 r21795.}}
{{New feature/item|3.0150|1.5|7344|
{{New feature/item|3.0150|1.5|7343|This function sets the camera shake level (as seen on the ''Are you going to San Fierro?'' singleplayer mission).}}
This function sets the camera shake level (as seen on the ''Are you going to San Fierro?'' singleplayer mission).}}


==Syntax==  
==Syntax==  
Line 21: Line 21:
     function( _, level )
     function( _, level )
         local level = math.floor( level )
         local level = math.floor( level )
         if level then
         if level and level >=0 and level <= 255 then
             setCameraShakeLevel( level )
             setCameraShakeLevel( level )
             outputChatBox( "Camera shake level updated to " .. level .. "." )
             outputChatBox( "Camera shake level updated to " .. level .. "." )
Line 33: Line 33:
==See also==
==See also==
{{Client_camera_functions}}
{{Client_camera_functions}}
[[hu:setCameraShakeLevel]]
[[RO:setCameraShakeLevel]]

Latest revision as of 14:28, 11 June 2023

Emblem-important.png This function is deprecated. This means that its use is discouraged and that it might not exist in future versions.

Please use setCameraDrunkLevel instead. Deprecated as of 1.6.0 r21795.

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

This example adds a /camshake command which allows any player to manually change its camera shake level.

addCommandHandler( "camshake",
    function( _, level )
        local level = math.floor( level )
        if level and level >=0 and level <= 255 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