GetCameraTarget: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 23: Line 23:
}}
}}


==Example==
MOJRM-511
This example checks whether a player's camera's target is another player, and returns true or false accordingly.
<section class="server" name="Server script" show="true">
<syntaxhighlight lang="lua">
function isTargetPlayer( thePlayer )
    local target = getCameraTarget ( thePlayer )
    if ( getElementType ( target ) == "player" ) then  -- If target is a player
        return true                                    -- Return true
    else
        return false                                    -- Otherwise, return false.
    end
end
</syntaxhighlight>
</section>


==See Also==
==See Also==
{{Camera functions}}
{{Camera functions}}

Revision as of 03:18, 2 June 2013

This function returns an element that corresponds to the current target of the specified player's camera (i.e. what it is following).

Syntax

Click to collapse [-]
Server
element getCameraTarget ( player thePlayer )

Required Arguments

  • thePlayer: The player whose camera you wish to receive the target of.
Click to collapse [-]
Client
element getCameraTarget ()

Returns

  • Returns an element of the target if the function was successful, or false if bad arguments were specified
  • Returns false if the camera is in Fixed mode and has no target.

MOJRM-511

See Also