π΄ RDE SLEEP | Next-Gen Offline Sleep System for FiveM ox_core | Proximity-Loaded Clones | StateBag-Synced | Skin-Persistent | Robbable | Free Forever
Built by Red Dragon Elite | Free Forever | No Paywalls | No Legacy
π Installation β’ βοΈ Configuration β’ π‘ Exports β’ π Troubleshooting β’ π Website β’ π Terminal
Every other sleep script either ignores players when they disconnect or shows a static, skinless, unanimated ghost. We said no.
| β Other Sleep Scripts | β rde_sleep |
|---|---|
| Paid or locked behind Tebex | 100% free forever β RDE Black Flag |
| Skinless placeholder ped | Full skin restore via illenium-appearance or manual fallback |
| Static T-pose on disconnect | Two-phase animation: real lie-down β breathing idle loop |
| No inventory interaction | Full ox_inventory stash β rob sleeping players, stolen items removed on reconnect |
| No carry system | Pick up and carry sleeping players, drop them anywhere β position persists |
| Single global entity table | Proximity-based spawn/despawn β zero entities when nobody is nearby |
| Hardcoded position on reconnect | Tracks carry-drops in DB + characters table β player wakes up where they were left |
| ESX / QBCore only | ox_core native β the future, not the past |
| Resource restarts break everything | Full DB persistence + activeStashes guard with ox_inventory empty-check |
- π΄ Proximity clone spawning β sleeping peds spawn within
renderDistance, despawn beyonddespawnDistance. Zero entities when no players are nearby. - π¨ Full skin persistence β reads from
playerskinsvia illenium-appearance. Falls back to manual component/overlay/tattoo application. - π Persistent inventory β items accessible via ox_inventory stash. Stolen items are deducted from the player's inventory on reconnect.
- πͺ Carry system β pick up any sleeping player, carry them across the map, drop them. DB +
characterstable updated on drop. - π Robbery β progress-bar search with ox_inventory stash integration. First open populates; subsequent opens use live stash state.
- π Admin wake β triple-layer auth: ACE β ox_core groups β Steam ID whitelist.
- π¬ Two-phase sleep animation β
@baselie-down intro plays once, then@idle_aloops with realistic breathing. No more idle-twitch bug from looping@baseclips. Animation verified post-play with auto-retry against illenium race condition. - π― ox_target integration β Rob / Carry / Wake context menu on every sleeping clone.
- π‘ StateBag sync β
GlobalState.sleepingPlayerskeeps all clients in sync without polling. - πΎ Auto-save β coordinates + skin cached every 30 seconds and on resource stop.
- π Stash dedup guard β ox_inventory persists stash contents in DB across resource restarts. Items are never re-added if the stash is already populated.
oxmysql β https://github.com/overextended/oxmysql
ox_lib β https://github.com/overextended/ox_lib
ox_core β https://github.com/overextended/ox_core
ox_inventory β https://github.com/overextended/ox_inventory
ox_target β https://github.com/overextended/ox_target
optional:
illenium-appearance β full skin restore (falls back to manual if absent)
cd resources
git clone https://github.com/RedDragonElite/rde_sleep.gitensure oxmysql
ensure ox_lib
ensure ox_core
ensure ox_target
ensure ox_inventory
ensure rde_sleepEdit config.lua β defaults work out of the box. Key values:
Config.PlayerSkinsColumnβ column inplayerskinslinking tocharId('citizenid'or'charid')Config.AdminSystemβ ACE permission, Steam IDs, ox_core group namesConfig.Performance.renderDistanceβ clone spawn radius
Tables auto-create on first run. No SQL import needed.
Config.Debug = false -- verbose console output
Config.Performance.renderDistance = 200.0 -- clone spawn range
Config.Performance.proximityTick = 1000 -- proximity loop (ms)
Config.Performance.maxVisiblePeds = 50 -- max simultaneous clones
Config.InvinciblePeds = true -- clones take no damage
Config.PlayerSkinsColumn = 'citizenid' -- playerskins column β charIdConfig.AdminSystem = {
acePermission = 'rde.sleepmod',
steamIds = { 'steam:110000xxxxxxxxx' },
oxGroups = { ['admin'] = 0, ['superadmin'] = 0 },
checkOrder = { 'ace', 'oxcore', 'steam' },
}ACE setup in server.cfg:
add_ace group.admin rde.sleepmod allowConfig.SleepingAnimations accepts only @idle_a entries. The @base intro is derived and played automatically. Do not add @base clips β they will loop and cause the twitch bug.
-- β
Correct
{ dict = 'amb@world_human_bum_slumped@male@laying_on_back@idle_a', clip = 'idle_a' },
-- β Wrong β @base clips with flag=1 loop the lie-down intro forever
{ dict = 'amb@world_human_bum_slumped@male@laying_on_back@base', clip = 'base' },-- Get sleeping data for one player
exports.rde_sleep:GetSleepingPlayer(stateId) -- table | nil
-- Get all sleeping players
exports.rde_sleep:GetAllSleepingPlayers() -- table<stateId, data>
-- Remove a sleeping entry (programmatic wake)
exports.rde_sleep:RemoveSleepingPlayer(stateId)-- Check if a ped entity is a sleeping clone
exports.rde_sleep:IsSleepingClone(entity) -- boolean
exports.rde_sleep:IsClone(entity) -- boolean (alias)Enable with Config.Debug = true, then in-game:
| Command | Description |
|---|---|
sleeplogout |
Manually trigger a sleeping entry (simulate logout) |
sleeptest |
Print spawned ped count vs GlobalState count to console |
rde_sleep/
βββ fxmanifest.lua
βββ config.lua
βββ README.md
βββ LICENSE
βββ client.lua β proximity loop, ped spawn/despawn, carry, robbery, animations
βββ server.lua β DB, statebag sync, playerDropped, stash, admin, exports
You're on v1.3.1 or earlier. The post-skin delay was 500ms β not enough on server restart because illenium-appearance clears ped tasks asynchronously. Fixed in v1.3.2: delay increased to 1000ms + animation verified with auto-retry via IsEntityPlayingAnim.
You're on v1.3.1 or earlier. activeStashes is in-memory β cleared on resource restart. ox_inventory persists stash contents in DB, so snapshot items were added on top on next access. Fixed in v1.3.2: RegisterStash now calls GetInventory first and only populates if the stash is genuinely empty.
You're on v1.2.9 or earlier. @base clips with loop flag=1 repeat the lie-down intro forever. Fixed in v1.3.0: Config now accepts only @idle_a entries. The @base intro is played once automatically, then transitions to the @idle_a loop.
- Verify
Config.PlayerSkinsColumnmatches yourplayerskinstable column (citizenidorcharid) - Confirm illenium-appearance is installed and started before
rde_sleep - Enable
Config.Debug = trueβ check forSkin via illenium-appearanceorSkin applied manuallyin console - If using manual fallback: confirm your skin JSON uses the illenium-appearance format
The characters table is updated on every carry-drop via rde_sleepmod:updatePosition. If the position is still wrong on reconnect, check that oxmysql is running and the UPDATE characters query has write permissions.
Confirm ox_core and ox_lib are started before rde_sleep in server.cfg.
ox_core β Player & group management, statebags
ox_lib β Callbacks, notifications, progress bars, TextUI
ox_inventory β Stash system, item management
ox_target β World interaction zones on sleeping clones
oxmysql β Async database (auto-create tables)
illenium-appearance β Ped skin restore (optional, with manual fallback)
GlobalState β Client-side sync for sleeping player list
- FIX Sleeping clone stands upright after server restart β post-skin delay increased from 500ms to 1000ms. illenium-appearance clears ped tasks asynchronously; 500ms was a race condition on restart. Added animation verification: if
IsEntityPlayingAnimreturns false after Phase 2,TaskPlayAnimretries once.
- FIX Stash item duplication on resource restart β
activeStashesis in-memory only and gets wiped on restart. ox_inventory persists stash contents in DB, so snapshot items were added on top of existing items on next access.RegisterStashnow checksGetInventoryfirst and only populates from snapshot if the stash is genuinely empty.
- FIX
@baseanimation clips removed fromConfig.SleepingAnimationsβ they caused an idle-twitch loop when played with flag1. Config now accepts@idle_aentries only. - FIX Two-phase animation in
SpawnSleepingPed:@baseintro played once (ped lies down), then transitions to@idle_aloop (ped sleeps). Carry-drop goes straight to@idle_a(ped already horizontal). - DOCS
Wait(0)in carry detection thread documented as intentional Standards exception (required forIsControlJustPressedframe-accuracy).
- Proximity loop stability improvements
- skinApplyDelay / animApplyDelay tuning
- ox_core migration (ESX removed)
- GlobalState statebag sync
- Carry + robbery system
- illenium-appearance skin support
- Auto-save thread
- Full DB persistence
PRs welcome.
- Fork the repository
- Branch:
git checkout -b fix/your-fix - Test on a live server before submitting
- Commit: follow existing format β
π fix(scope): description - Open a Pull Request with a clear description
Guidelines:
- β Keep the RDE header in all files
- β Follow ox_core / ox_lib / StateBag patterns β no polling where statebags exist
- β
Config.SleepingAnimationsβ@idle_aentries only. Never@base. - β
Wait(0)only for per-frame control polling (IsControlJustPressed). UseWait(Nβ₯100)for everything else. - β Server-side validation stays β stash dedup, admin checks, input validation
- β No telemetry, no paywalls, no ESX/QBCore
- β Don't hardcode user-facing strings β use
GetLanguageString('key')and add the key to both locale tables inconfig.lua
| Resource | Description |
|---|---|
| rde_aipd | Next-Gen AI Police & Crime System β ox_core native, StateBag-Synced |
| rde_nostr_log | Decentralized FiveM logging via Nostr β replace Discord forever |
| awesome-ox-rde | Curated list of the best ox_core resources |
RDE Black Flag Source License v6.66
###################################################################################
# #
# .:: RED DRAGON ELITE (RDE) - BLACK FLAG SOURCE LICENSE v6.66 ::. #
# #
# PROJECT: RDE_SLEEP (NEXT-GEN OFFLINE SLEEP SYSTEM FOR FIVEM OX_CORE) #
# ARCHITECT: .:: RDE β§ Shin [β³ αα
α±αα
αΎαα αααα
β½] ::. | https://rd-elite.com #
# ORIGIN: https://github.com/RedDragonElite #
# #
# WARNING: THIS CODE IS PROTECTED BY DIGITAL VOODOO AND PURE HATRED FOR LEAKERS #
# #
# [ THE RULES OF THE GAME ] #
# #
# 1. // THE "FUCK GREED" PROTOCOL (FREE USE) #
# You are free to use, edit, and abuse this code on your server. #
# Learn from it. Break it. Fix it. That is the hacker way. #
# Cost: 0.00β¬. If you paid for this, you got scammed by a rat. #
# #
# 2. // THE TEBEX KILL SWITCH (COMMERCIAL SUICIDE) #
# Listen closely, you parasites: #
# If I find this script on any paid store, Patreon, or "Premium Pack": #
# > I will DMCA your store into oblivion. #
# > I will publicly shame your community on Nostr. Permanently. #
# > I hope every sleeping ped spawns directly inside your player model. #
# SELLING FREE WORK IS THEFT. AND I AM THE JUDGE. #
# #
# 3. // THE CREDIT OATH #
# Keep this header. If you remove my name, you admit you have no skill. #
# You can add "Edited by [YourName]", but never erase the original creator. #
# Don't be a skid. Respect the architecture. #
# #
# 4. // THE CURSE OF THE COPY-PASTE #
# This code implements real StateBag sync, server-side authority, #
# async MySQL, proximity loading, and skin persistence. #
# If you copy-paste without understanding, you WILL break something. #
# Don't come crying to my DMs. RTFM. #
# #
# -------------------------------------------------------------------------- #
# "We build the future on the graves of paid resources." #
# "REJECT MODERN MEDIOCRITY. EMBRACE RDE SUPERIORITY." #
# -------------------------------------------------------------------------- #
###################################################################################
TL;DR:
- β Free forever β use it, edit it, learn from it
- β Keep the header β credit where it's due
- β Don't sell it β commercial use = instant DMCA + public shaming on Nostr
- β Don't be a skid β copy-paste without reading will break things
| π Website | rd-elite.com |
| π Nostr Terminal | rd-elite.com/Files/NOSTR/Terminal |
| π GitHub | github.com/RedDragonElite |
| π£ Nostr | npub1wr4e24zn6zzjqx8kvnelfvktf0pu6l2gx4gvw06zead2eqyn23sq9tsd94 |
Before opening an issue:
- β Read this README fully
- β Check the Troubleshooting section
- β
Enable
Config.Debug = trueand include console output - β Don't open issues without logs β we can't help without them
Made with π₯ and zero tolerance for paid garbage by Red Dragon Elite
The future is ours. We are already inside.
REJECT MODERN MEDIOCRITY. EMBRACE RDE SUPERIORITY.
RDE FOREVER. SYSTEM FAILURE. β‘777β‘