SetCameraTarget: Difference between revisions

From Wiki G1R-MP G1 Remake Multiplayer
Jump to navigation Jump to search
Automatyczna aktualizacja dokumentacji funkcji
 
Complete Lua function catalog
 
Line 33: Line 33:
* Call <code>resetCamera</code> to return control to the player's normal camera.
* Call <code>resetCamera</code> to return control to the player's normal camera.


[[Category:Lua Functions]]
[[Category:Server Functions]]
[[Category:Server Functions]]
[[Category:Camera Functions]]
[[Category:Camera Functions]]
[[Category:Experimental Lua API]]
[[Category:Experimental Lua API]]

Latest revision as of 09:54, 15 August 2026

setCameraTarget

Requests that one player's camera follows another connected player.

Syntax

bool setCameraTarget(int playerId, int targetPlayerId)

Parameters

Name Type Required Description
playerId int yes The connected player identifier.
targetPlayerId int yes The connected player that should become the camera target.

Returns

Returns true when the validated camera request is accepted and queued; otherwise returns false.

Examples

Temporarily spectate another player:

if setCameraTarget(playerId, targetPlayerId) then
    setTimer(resetCamera, 5000, 1, playerId)
end

Notes

  • Available only in server-side resource scripts.
  • Experimental: this is a narrow target-follow request, not an arbitrary cinematic camera API.
  • Call resetCamera to return control to the player's normal camera.