ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Client functions
  3. setPlayerCrosshairImage

Function

setPlayerCrosshairImage

New function!Added to Trilogy Hub on 11 Nov 2026.

ClientPlayersTrilogy Hub only

Sets a custom crosshair image at the screen centre and hides the original game reticle. The image is continuously visible while the "crosshair" HUD component is enabled; your script decides when to show it during aiming. The file must be available to the client, e.g. through <file src="crosshair.png" /> in meta.xml. Pass false to remove the image and restore the game reticle according to its visibility setting. Stopping the owning resource removes its image. Errors leave the previous image unchanged.

Syntax

bool setPlayerCrosshairImage(string/bool path [, float width = 32, float height = 32, int color = 4294967295])

Arguments

pathstring/bool
Resource image path or false.
widthfloat, optional = 32
Width in pixels, 1–512.
heightfloat, optional = 32
Height in pixels, 1–512.
colorint, optional = 4294967295
A tocolor tint, white by default.

Returns

true on success, false on error.

Example

setPlayerCrosshairImage("celownik.png", 24, 24, tocolor(255, 255, 255))
setPlayerHudComponentVisible("crosshair", false) -- schowaj
setPlayerHudComponentVisible("crosshair", true)  -- pokaz
-- setPlayerCrosshairImage(false) -- przywroc celownik gry

See also