DocsCrosshair

Exports and events

Client and server exports and events for other resources.

Not released yet. These pages are written from the code of manniche_crosshair and can change before the release.

Server exports

ExportReturnsWhat it does
GetPlayerData(source)table or nilThe player's stored data (active, profiles, weaponMap, settings, favorites). nil without an identifier, or on a cache miss with the MySQL driver.
SetPlayerActive(source, config)booleanSanitizes config, saves it as the active crosshair and syncs the client. false without an identifier.
EncodeProfile(profile)stringReturns an MNC- share code.
DecodeProfile(code)profile, or nil and an error keyDecodes a share code.
local code = exports['manniche_crosshair']:EncodeProfile(profile)

Client exports

ExportReturnsWhat it does
Open(page)-Opens the editor, optionally on a page.
Close()-Closes the editor.
IsOpen()booleanEditor open state.
GetActiveConfig()tableCopy of the active crosshair config.
GetRenderedConfig()tableCopy of the config currently rendered.
IsCrosshairVisible()booleanWhether the crosshair is visible.
GetWeaponCategory()stringCurrent weapon category.
SetActiveConfig(config)trueSanitizes and equips a crosshair, and saves it to the server.
SetEnabled(enabled)booleanTurns the crosshair on or off (anything except false is on) and saves the setting.
TriggerHit()booleanTriggers hit feedback for custom damage systems. Returns false if Config.EnableDamageFeedback is off or the call is throttled (40 ms).

Events

Client events registered by the resource:

EventWhat it does
manniche_crosshair:syncServer to client. Payload may contain profiles, weaponMap, settings, favorites, active.
manniche_crosshair:presetsServer to client. Replaces the preset list.
manniche_crosshair:responseInternal reply to editor requests.

The server event manniche_crosshair:request is internal. It allows 40 requests per 10 seconds per player and rejects large payloads. Use the exports instead.