Skip to content

Reference

Statuses, licenses, weapons ​

  • Statuses (Config.Status): every interval, decay is removed; an empty status (or full, if it is inverse like stress) costs damage health points. /feed, /setstatus.
  • Licenses (Config.Licenses): xPlayer.addLicense("driver"), hasLicense… /givelicense, /removelicense.
  • Weapons: see below. /giveweapon, /clearweapons.

Weapons as items ​

Config.Weapons.mode = "items" (default): everything is an item.

  • A gun is a unique item (weapon_pistol...) with its own metadata: { serial = "KXR482913", ammo = 12, durability = 87.5, components = { "COMPONENT_AT_PI_SUPP_02" }, tint = 0 }. ammo is what its magazine holds (clip per weapon in shared/weapons.lua).
  • Spare rounds are items (ammo_pistol, ammo_smg, ammo_rifle, ammo_mg, ammo_shotgun, ammo_sniper...): 1 item = 1 round, sold, given, stored and found like anything else. R (or using the ammo item) reloads the gun in hand from them; an empty magazine reloads on the trigger.
  • Throwables (molotov, grenade, smoke, tear gas, flare...) are stackable items: 1 item = 1 throw; in hand, the count follows the inventory.
  • Melee and tools (knife, bat, taser, extinguisher, petrol can): no count.
  • In hand: using the weapon (inventory, or keys 1 to 5) takes it in hand; using it again puts it away, and only that: an empty magazine does not put it away (GTA's automatic swap and reload are off), the trigger reloads it. The character only ever holds that weapon: the game's weapon wheel and weapon switching are off (on foot and in vehicles), a weapon from elsewhere is removed. Config.Weapons.equipInVehicle: "passengers" (default: the driver takes it in hand before getting in), "always", "never".
  • Durability (Config.Weapons.durability, true by default; false: never): each shot wears the gun (wear per weapon); at 0 it cannot be taken in hand. xPlayer.repairWeapon(slot).
  • Serial numbers and the registry: a realistic serial (Config.Weapons.serialFormat, "LLLNNNNNN"), and no name on the weapon: who owns it is in the weapon registry (table rlx_weapon_registry), for the police: RLX.GetWeaponRegistration(serial) → { serial, item, citizenid, name, registered }. New guns are registered under their owner (Config.Weapons.registry; addWeapon(name, ammo, { register = false }): an unregistered gun, black market). RLX.RegisterWeaponSerial(serial, citizenid, item), RLX.UnregisterWeaponSerial(serial).
  • The loadout methods still work on top of the items: xPlayer.addWeapon("pistol", 24) (the magazine filled, the rest as ammo items; returns true, serial), hasWeapon, getWeaponAmmo (the magazine), setWeaponAmmo, addWeaponAmmo (ammo items), removeWeapon, removeAllWeapons, getLoadout: every resource written for the loadout works unchanged.
  • xPlayer.getWeapons() ({ name, item, slot, kind, serial, ammo, clip, durability, components, tint, equipped }), getEquippedWeapon(), equipWeapon(slot), unequipWeapon(), setWeaponDurability(slot, v), repairWeapon(slot), addWeaponComponent(slot, "COMPONENT_..."), removeWeaponComponent, setWeaponTint(slot, n). RLX.RegisterWeapon("weapon_x", { label, weight, kind = "gun", ammo = "ammo_pistol", clip = 12, wear = 0.1 }); a weapon given by name that the list does not know is added as a tool (no count) with a warning. RLX.GetWeaponList().
  • Hook equipWeapon (source, item, serial, slot: cancel). Events rlx:weaponEquipped (source, item, serial), rlx:weaponUnequipped, rlx:weaponBroken.
  • For a HUD (client): RLX.GetWeaponState() and the local event rlx:weaponState: { weapon, label, kind, ammo, clip, spare } (spare: the gun's ammo items in the inventory) or false. GTA's own counter shows "12 / 38" (magazine / spare rounds): the game gets the ammo items as the gun's reserve, reloads by itself (R, or the trigger on an empty magazine), and what is left in the gun is reported: the rounds used come out of the ammo items. HudConfig.ammo = true: rlx_hud shows its own counter instead. In the inventory, a gun's stack has ammoType (its ammo item).
  • Messages: RLX does not narrate what the player sees (weapon put away, no rounds left, item dropped, seatbelt, range...): only refusals and what cannot be seen. A resource adds its own with RLX.Notify.
  • Switching from "loadout" to "items": the weapons characters already had become items at their next connection (magazine filled, the rest as ammo items).

Config.Weapons.mode = "loadout": a list of weapons beside the inventory (saved, given back on spawn, ammo reported).

GTA's own world ​

Config.World: what the game does by itself, switched on or off in one place. By default, for roleplay:

  • wantedLevel = false: no wanted stars (nor the chase that comes with them).
  • dispatch = { police, ambulance, fire, army, gangs }, all false: the game sends none of its own services (police cars, helicopters, roadblocks, ambulances, fire trucks, army, gang backup).
  • randomCops = false (no police patrolling), distantSirens = false.
  • npcDropWeapons = false, npcDropMoney = false: NPCs killed or robbed drop neither weapons nor cash. vehicleRewards = false: no weapons found in police cars.
  • aggressiveNpcs = true (GTA): gangs, guards and the army attack on sight; false: they leave players alone unless attacked.
  • healthRegen (nil: the game's; 0: none), idleCamera = false.
  • enabled = false: RLX does not touch GTA's world. Pedestrians and traffic are LS:MP's (server.cfg: Population, PopulationPedDensity, PopulationVehicleDensity...).

Characters asleep ​

Config.Sleepers (on by default): when a player disconnects, their character stays in the world where they left it, asleep (an animation of Config.Sleepers.anim), dressed as they were, with "Zzz" above them, until they come back: then it wakes up, and they play from that very place. Kept across restarts of the server (hours: removed after 72 h; 0: never). onLogout: also when going back to the character screen. invincible by default.

Your own persistence: Config.Modules.sleepers = false, or the hook sleeper (source, citizenid, coords): return false for no sleeper, or change coords.

It is an RLX NPC (id sleeper:<citizenid>, data.sleeper = citizenid). To act on sleepers (search a sleeping player, carry them...): an option on the RLX NPCs, RLX.AddTarget({ id = "search_sleeper", type = "ped", meta = { key = "rlx:ped" }, label = "Search" }, fn), whose function checks that RLX.GetPedFromEntity(info.netId) starts with sleeper:. RLX.GetSleepers(), RLX.GetSleeper(citizenid), RLX.RemoveSleeper(citizenid); events rlx:sleeperAdded, rlx:sleeperRemoved (citizenid, why). The appearance is applied by the skin resource (local event rlx:applySkinTo with a ped handle, a skin and a sex: part of the skin contract).