- Documentation
- Client functions
- setPlayerCrosshairImage
Function
setPlayerCrosshairImage
New function!Added to Trilogy Hub on 11 Nov 2026.
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
tocolortint, 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
getPlayerCrosshairImageReturns the path, width, height and tint of the image set bysetPlayerCrosshairImage. Returnsfalsewhen no custom image is set.setPlayerHudComponentVisibleShows or hides a game HUD component. Each component works independently."all"affects all components, including the radar and crosshair, and clears individual overrides. Components:ammo,armour(orarmor),breath,clock,health,money,weapon,wanted,area_name,vehicle_name,radio,radar,crosshair,all."crosshair"hides only the aiming reticle, including the sniper scope and camera reticle. The setting survives death and respawn; set it again after reconnecting (e.g. inonPlayerJoin).