Skip to content

Start

Good to know ​

  • Copies. What you get from RLX is a copy: changing xPlayer.job changes nothing, call setJob.
  • Threads. Functions that wait (database, vehicles, companies, offline, menus and inputs, SavePlayer) are called from a handler (lsmp.on, lsmp.onClient, lsmp.onCall, an RLX command, an RLX point) or lsmp.createThread, never directly in a setTimeout. Otherwise they return nil, "not in a coroutine".
  • Client. Never trust what a client sends: check on the server (RLX.GetPlayer(source), amounts, distances). Server points do it for you.
  • Saving. Every Config.SaveIntervalSeconds, a few seconds after a money or item change, on disconnection and on stop.
  • Blips. On the client, LS:MP cannot delete a blip (removeBlip has no effect): client RLX.RemoveBlip hides it and reuses it. On the server, they are real server blips, really deleted.
  • Proximity queries. Go through RLX.GetClosestVehicle, RLX.GetEntitiesInRadius and RLX.IsSpotFree rather than lsmp.getClosestEntity and lsmp.getEntitiesInRadius: they take any position form and keep working when LS:MP changes them.
  • The player's vehicle (client). Under LS:MP, getVehiclePedIsIn(ped, false) also returns the last vehicle, even on foot. Check isPedInAnyVehicle(ped, false) first, or use RLX.GetCurrentVehicle().
  • Picker types. lsmp.selection may report a vehicle as "object" and a map object without a type: ask the game (getEntityType, isModelAVehicle), as rlx_target does.
  • Minimap. GTA draws it in a 16:9 zone in the center of the screen, even on ultrawide, and neither GTA nor LS:MP can move it. The RLX HUD aligns itself on it.
  • GTA replay. LS:MP's Rockstar Editor grabs keys (F5/F6, Alt shows its help). Its natives (REPLAY, RECORDING) are blocked for resources, and disabling its controls has no effect: only LS:MP can turn it off.
  • Native names. LS:MP uses the current names of the natives, for example getControlInstructionalButtonsString.
  • Natives that do not exist. GetVehicleFuelLevel, SetVehicleFuelLevel, GetVehicleCurrentRpm... are not GTA natives, so LS:MP does not have them. rlx_fuel fuel is kept by the script (entity meta rlx:fuel).
  • Deleting an entity. lsmp.deleteEntity returns a boolean; the reason of a failure is read with lsmp.getLastError() (permission: the resource lacks the entities.foreign capability).
  • Lua 5.5. A for loop variable cannot be reassigned, and global is a reserved word.