GetCameraGoggleEffect: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (Wrong returning variable, fixed.)
m (Added example explanation. Added code indentation. Removed "Needs_example" category.)
Line 14: Line 14:


==Example==
==Example==
This example adds a command to enable or disable the nightvision effect.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function nightvision()
function nightvision()
if(getCameraGoggleEffect == "normal") then
    if(getCameraGoggleEffect == "normal") then
setCameraGoggleEffect("nightvision")
        setCameraGoggleEffect("nightvision")
else if(getCameraGoggleEffect == "nightvision") then
    else if(getCameraGoggleEffect == "nightvision") then
setCameraGoggleEffect("normal")
        setCameraGoggleEffect("normal")
end
    end
end
end


Line 28: Line 29:
==See Also==
==See Also==
{{Client camera functions}}
{{Client camera functions}}
[[Category:Needs_Example]]

Revision as of 18:27, 10 February 2011

This function returns what goggle effect is currently affecting the camera.

Syntax

string getCameraGoggleEffect (  )

Returns

Returns a string indicating the current camera goggle effect. Their meanings can be seen below.

  • normal: No camera goggle effect
  • nightvision: Nightvision camera
  • thermalvision: Infrared camera

Example

This example adds a command to enable or disable the nightvision effect.

function nightvision()
    if(getCameraGoggleEffect == "normal") then
        setCameraGoggleEffect("nightvision")
    else if(getCameraGoggleEffect == "nightvision") then
        setCameraGoggleEffect("normal")
    end
end

addCommandHandler("nightvision", nightvision)

See Also