AI Core

ai-exitsleeping

A player who logs out stays in the world as a sleeping body that others can carry and put into vehicles.

ai-exitsleeping keeps logged-out characters in the world. When a player leaves the server or goes back to the character screen, their character lies down as a sleeping body where they stood. Other players can carry it, put it into a vehicle and take it out again, and the owner wakes up wherever the body ended up.

What it does in the game

  • Sleeping bodies. The body has the character's look (through AI Core's appearance layer, so any supported clothing script works) and one of the panel's lying poses. Every player sees the same pose.
  • Carrying. Walk up to a body and press the interact key at Carry Sleeping Player. X (or Stop Carrying) puts it down where you stand. You cannot carry while in a vehicle, downed or cuffed.
  • Vehicles. While carrying, Put in Vehicle at a vehicle seats the body in a passenger seat. Take Out Sleeping Player at a vehicle with a body inside takes it out (you then carry it).
  • Waking up. The owner's next spawn is where the body is now: on the ground, on the carrier's shoulder, or in the vehicle seat it was put in.
  • Expiry. Bodies of players who logged out longer ago than the panel's days are removed.
  • Hidden areas and private worlds. No body is left inside a hidden area (panel), and bodies put down there are hidden. With Ignore private worlds on, players inside a house or motel interior leave no body and see none.

Installation

Installed by the AI Core recipe. By hand: ensure ai-exitsleeping after ai-core. The table ai_exitsleeping_sleepers is created on the first start.

If your spawn script places the player itself after ai-core's spawn, set Wake up on to PlayerLoaded export (spawn script) and call exports['ai-exitsleeping']:PlayerLoaded() from it (see the developer page).

Panel settings

Admin panel > Exit Sleeping.

Tab: General

How long sleeping bodies stay, how far they are drawn and what players can do with them.

Sleeping bodies: a player who logs out stays in the world as a sleeping body where they left, and wakes up where the body ended up.

SettingWhat it changesUnitDefault
Keep bodies forBodies of players who logged out longer ago than this are removed. 1-365.days3
Draw distanceSleeping bodies appear when a player comes this close and disappear past it. 5-60, steps of 0.5.m25
Ignore private worldsPlayers inside a private world (a house or motel room interior) leave no body when they log out and see no bodies while inside.on / offon
Wake up onCharacter spawn (ai-core) or PlayerLoaded export (spawn script). Keep the default unless a spawn script calls exports['ai-exitsleeping']:PlayerLoaded() after its own spawn.Character spawn (ai-core)

Carrying and vehicles: players can carry a sleeping body, put it into a vehicle seat and take it out again.

SettingWhat it changesUnitDefault
Interaction distanceHow close a player must stand to carry a body or reach a vehicle. 1-10, steps of 0.5.m2.5
Server distance checkThe server refuses a carry or vehicle action from further away than this (against cheats). 2-30, steps of 0.5.m6
Position checkHow often the server updates where carried bodies and bodies in vehicles are, so the owner wakes up at the right place. 1-60.s5
Debug messagesPrints what the script does to the server and client consoles.on / offoff

Tab: Animations

The lying poses of sleeping bodies and the carry animation. Each animation is an Animation dictionary, an Animation name and Animation flags (GTA animation flags, 0-65535: 1 loops, 49 loops on the upper body while walking, 33 loops while attached).

CardWhat it changesDefault
Lying posesEvery body picks one of these at random; every player sees the same pose. Up to 20.amb@world_human_bum_slumped@male@laying_on_left_side@idle_a / idle_b, flags 1
Carrying playerThe animation of the player who carries a body.missfinale_c2mcs_1 / fin_c2_mcs_1_camman, flags 49
Carried bodyThe animation of the body on the carrier's shoulder.nm / firemans_carry, flags 33

Carry position: where the carried body sits on the carrier.

SettingWhat it changesUnitDefault
Bone indexBone index of the carrier the body is attached to (0 = the ped's root).0
Offset right-5 to 5, steps of 0.01.m0.2
Offset forward-5 to 5.m0.15
Offset up-5 to 5.m0.63
Rotation X-360 to 360, steps of 0.5.°0.5
Rotation Y-360 to 360.°0.5
Rotation Z-360 to 360.°5

Tab: Hidden areas

Places where no sleeping body is shown, such as interiors or safe zones. One record per area (New area / Delete area). Deleting an area makes the sleeping bodies inside visible again. None come ready.

Area: players who log out inside leave no body; bodies put down inside are hidden (the owner still wakes up there).

SettingWhat it changesUnitDefault for new
NameThe area's name.
ShapeBall, Cylinder or Polygon: a ball or a cylinder around a centre point, or a polygon from corner points.Ball
CentreThe middle of the area (ball and cylinder).point
RadiusMetres from the centre to the edge (ball and cylinder). 1-2000.m25
HeightMetres up and down the area reaches (cylinder: from the centre; polygon: past its lowest and highest corner). 0.5-1000.m10

Polygon corners (polygon only): add a corner at each turn of the border, in order (free camera or your position); a polygon needs at least three, up to 64. The shape is drawn in the world while this field is on screen.

Commands

CommandArgumentsWhoWhat it does
/exitsleeptestnoneAdmins (ai.admin)Toggle your own sleeping body (test): creates a body where you stand, or removes it.

Keybinds

Default keyWhat it does
XPut down the sleeping player you carry

Known limits

  • Bodies exist only in the shared world: inside an instanced interior a carried body is put down at its last outside position.
  • After a server restart every body lies on the ground at its last saved position (carried and seated states are not kept).
  • A player who wakes within a few seconds of their carrier or vehicle disappearing may spawn at the last saved spot (the Position check interval).

On this page