Instances
An instance is a private copy of the world (an apartment, a race, an interior), built on LS:MP dimensions. RLX hands out free ones so two resources never share one.
lua
local id = RLX.CreateInstance({ name = "apartment_12", population = false, temporary = true })
RLX.SetPlayerInstance(source, id) -- the vehicle they drive goes with them (false: alone)
RLX.LeaveInstance(source) -- back to the normal world (0)population = false: no traffic and no pedestrians.clientEntities = false: players cannot create entities there.temporary = true: deleted once empty.dimension = 25: a fixed number.RLX.GetPlayerInstance(source),RLX.GetInstancePlayers(id),RLX.GetInstance(id)returns{ id, name, players, ... },RLX.GetInstances(),RLX.DeleteInstance(id)sends everyone back.- A resource's instances are deleted when it stops.
- Events:
rlx:instanceCreated(id, info),rlx:instanceChanged(source, id, fromon the server;id, fromon the client),rlx:instanceDeleted(id). - Client:
RLX.GetCurrentInstance()returns the instance the player is in (0for the normal world). - The first free dimension is
Config.InstanceFirstDimension(1000 by default), so dimensions you number yourself stay below it.