SetCameraGoggleEffect: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
m (Much faster)
Line 19: Line 19:
<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>

Revision as of 01:00, 11 September 2016

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 )

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

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)

See Also