How the API is named
Every function follows the same rules, so you can guess a name before looking it up:
| Word | Used for | Examples |
|---|---|---|
Get / Set / Is / Has | Read, change, ask | GetPlayer, SetClock, IsDead, HasLicense |
Register | A definition that lives as long as the server: items, jobs, commands, usable items, stashes, job actions, key actions | RegisterItem, RegisterCommand, RegisterStash |
Add / Remove | Something placed in the world or in a list, taken back later | AddPoint, AddTarget, AddProp, AddPed, AddRecipe, AddCron |
Show / Hide | Something on screen | ShowTextUI, ShowTimer, ShowKeyHints |
Open / Close | A window | OpenMenu, OpenInventory, OpenStash, OpenDialog |
Start / Stop, Play / Stop | Something that runs; an animation, a sound, an effect | StartRoute, PlayCamera, PlayAudio, StopAudio |
Player in the name | Acts on a player's character, given by source | GetPlayerCoords, SetPlayerCoords, FreezePlayer, SetPlayerInvincible, SetPlayerInstance, IsPlayerAfk |
- Server and client. On the server, a function about a player takes their
sourcefirst. The same name on the client acts on the local player:RLX.GetClosestPlayer(coords, maxDistance)on the server,RLX.GetClosestPlayer(maxDistance)on the client. - Results. A function returns its value, or
nil(orfalse) and the reason. Its module turned off:nil, "module_disabled:<module>". - Other names.
RLX.GetPlayerFromId=RLX.GetPlayer,RLX.GetPlayerFromIdentifier=RLX.GetPlayerFromCitizenId,RLX.ShowNotification=RLX.Notify.