SetCameraGoggleEffect: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
(13 intermediate revisions by 8 users not shown)
Line 5: Line 5:
==Syntax==
==Syntax==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool setCameraGoggleEffect ( string goggleEffect )
bool setCameraGoggleEffect ( string goggleEffect [, bool noiseEnabled = true ] )
</syntaxhighlight>
</syntaxhighlight>
 
{{OOP||Camera.setGoggleEffect|goggleEffect|getCameraGoggleEffect}}
===Required Arguments===
===Required Arguments===
*'''goggleEffect''': The goggle effect you wish to set
*'''goggleEffect:''' the goggle effect you wish to set
{{Camera goggle modes}}
{{Camera goggle modes}}
{{New feature/item|3.0156|1.5.5|13999|
*'''noiseEnabled:''' whether or not there should be a fuzzy noise effect
}}


===Returns===
===Returns===
Returns ''true'' if the effect was set correctly, ''false'' otherwise.
* ''true'' if the effect was set correctly.
* ''false'' otherwise.


==Example==
==Example==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function nightvision()
function nightvision()
    if (getCameraGoggleEffect() == "normal") then
  local effect = (getCameraGoggleEffect() == "normal") and "nightvision" or "normal"
        setCameraGoggleEffect("nightvision")
  setCameraGoggleEffect(effect)
    elseif (getCameraGoggleEffect() == "nightvision") then
        setCameraGoggleEffect("normal")
    end
end
end
addCommandHandler("nightvision", nightvision)
addCommandHandler("nightvision", nightvision)
</syntaxhighlight>
</syntaxhighlight>
==Changelog==
{{ChangelogHeader}}
{{ChangelogItem|1.5.5-9.13999|Added noiseEnabled argument}}


==See Also==
==See Also==
{{Client camera functions}}
{{Client camera functions}}
[[hu:setCameraGoggleEffect]]
[[RO:setCameraGoggleEffect]]

Latest revision as of 15:24, 2 November 2023

This function allows you to set the camera's current goggle effect. This means you can activate nightvision or infrared effects by script

Syntax

bool setCameraGoggleEffect ( string goggleEffect [, bool noiseEnabled = true ] )

OOP Syntax Help! I don't understand this!

Method: Camera.setGoggleEffect(...)
Variable: .goggleEffect
Counterpart: getCameraGoggleEffect


Required Arguments

  • goggleEffect: the goggle effect you wish to set
  • normal: No camera goggle effect
  • nightvision: Nightvision camera
  • thermalvision: Infrared camera
  • noiseEnabled: whether or not there should be a fuzzy noise effect

Returns

  • true if the effect was set correctly.
  • false otherwise.

Example

function nightvision()
   local effect = (getCameraGoggleEffect() == "normal") and "nightvision" or "normal"
   setCameraGoggleEffect(effect)
end
addCommandHandler("nightvision", nightvision)

Changelog

Version Description
1.5.5-9.13999 Added noiseEnabled argument

See Also