mack-emotes-advanced

mack-emotes-advanced

£20.00

Add to Basket

# mack-emotes-advanced

Note this Has "mack-xxx" Built in as well as the Standard Emotes and all the special Emotes , Lean , Sit on Ledge etc Plus Raycasting to Detect Where your Stood

Emotes, work actions, music and a full sit / lean / lay / sleep system for **RedM** (rsg-core + ox_lib).

- **212 emote commands** (work, jobs, everyday, camp, music, gestures, dances, taunts) plus **31 seated activities** (`/sit read`, `/sit guitar`, ...).

- Raycast sit / lean / lay / sleep, prop chairs, benches and beds, seat claims, weapon holstering, interrupted-pose watchdog.

- Optional adult mode (off by default).

Open **`/emotes`** to see everything in a menu, grouped by category.

## Core commands

- `/sit` - detects what is in front of you (chair, bench, ledge, wall, edge, ground) and sits or leans.

- `/sit <activity>` - sit and do something, e.g. `/sit read`, `/sit smoke`, `/sit guitar`, `/sit fiddle`. The activity is matched to what you sit on (chair, bench, ground, ledge). If it is not possible there you just sit and are told so. List: `SeatedActivities` in `emotes.lua`.

- `/lean` - lean against a wall / post / barrel in front of you.

- `/lay` - lie down on open ground (or on a bed in front of you, `Config.Bed.LayUsesBeds`).

- `/sleep` - get into a bed or bedroll in front of you.

- `/stand` - get up, or stop a gesture / dance that is still playing. Pressing W/A/S/D also stands you up (`Config.StandOnMove`).

- `/emotes` - the emote menu.

## Emotes

Long running emotes (**scenarios**) behave like `/sit`: your weapon is holstered, `/stand` or walking away ends them, the watchdog cleans up if something interrupts you. One-shot emotes (**kit emotes**: gestures, dances) are played by the game's own emote system.

- **Work and chores:** `/sweep` `/rake` `/weed` `/hammer` `/chop` `/mine` `/dig` `/sledge` `/sawwood` `/plane` `/feedpigs` `/feedchickens` `/pump` `/fillbucket` `/pourbucket` `/pitchfork` `/repair` `/oil` `/wipe` `/cleanwindow` `/dishes` `/scrub` `/laundry` `/stir` `/cook` `/inspect` `/washface` `/microscope` and more.

- **Jobs and service:** `/bartend` `/cleanglass` `/shopkeep` `/browse` `/teller` `/clipboard` `/write` `/sellpaper` `/guard` `/knock` `/peek` `/lockpick` `/mirror` `/letter` `/note` `/map` `/photo` `/wantedposter` and more.

- **Everyday:** `/smoke` `/cigar` `/chew` `/drink` `/flask` `/coffee` `/fan` `/pray` `/mourn` `/cough` `/stoic` `/badass` `/waiting` `/impatient` `/drunk` `/passedout` ...

- **Camp:** `/campsit` `/campsquat` `/campkneel` `/tendfire` `/firestand` `/kettle`.

- **Music:** `/guitar` `/guitarblues` `/trumpet` `/piano` (needs a piano or organ in front of you) and the seated instruments `/sit banjo|fiddle|concertina|mandolin|harmonica|jawharp|guitar`.

- **Gestures (one-shot):** `/wave` `/bow` `/hattip` `/handshake` `/point` `/beckon` `/followme` `/surrender` `/shrug` `/facepalm` `/nod` `/clap` `/slowclap` `/laugh` `/yeehaw` `/thanks` ... and `/spin [0-5]` (gun twirl, needs a weapon in your hands).

- **Dances:** `/dance` plus `/dancewild` `/dancegraceful` `/dancedrunk` `/danceformal` ... (12 kit dances).

- **Taunts:** `/chicken` `/warcry` `/provoke` `/watching` ...

**Crude emotes** (`/pee` `/vomit` `/spit` `/snotrocket` `/hurl` `/flipoff` `/throatslit` `/upyours` `/youstink` `/cocksnook`) are off unless `Config.Emotes.AllowCrude = true`.

### Emote settings (`Config.Emotes`)

- `Enabled` - master switch for all emote commands.

- `Categories` - switch whole groups off (work, service, leisure, camp, music, seated, gestures, dances, taunts).

- `Disable` - switch individual commands off, e.g. `{ 'hammerwall', 'peek' }`.

- `Prefix` - put text in front of every emote command (`'e'` gives `/esweep`, `/ewave`). Use it if a name clashes with another resource.

- `SkipExisting` - an emote command is not registered if another resource already owns that name (it stays available in `/emotes`, marked "menu only"). The skipped names are printed to the F8 console once. Other resources that start *after* this one can still clash, so use `Prefix` if in doubt.

- `GesturesWhileSeated` - one-shot gestures can be used while sitting (upper body only).

- `ChatSuggestions` - add every emote to the chat suggestions (a lot of entries, off by default).

### Adding or changing emotes

Everything is in `emotes.lua`; no code changes needed. One line per emote:

```lua

S('sweep', 'work', 'Sweep', { 'WORLD_HUMAN_BROOM_WORKING', 'WORLD_HUMAN_PUSH_BROOM_WORKING' }) -- scenario

K('wave', 'gestures', 'Wave', 'GREET_GENTLEWAVE_1') -- kit emote

```

Scenario names are tried in order until one starts. A name can be `{ 'NAME', 'male' }` or `{ 'NAME', 'female' }` for scenarios that only exist for one gender.

### What to test in game first

Nothing here has been run inside RedM yet (it was checked with a Lua syntax check and a mock RedM runtime only). The names come from rdr3_discoveries and from other RedM scripts. Names marked `v = true` in `emotes.lua` are already used on player peds by other scripts, so they are the most trusted. Some scenarios may not start for a player (gender or prop conditions); the fallback names are tried and you get a notification instead of being stuck. Things worth a quick check: `/piano` offsets, the campfire emotes, `/sit <activity>` on benches, one-shot gestures while sitting, and `/spin`.

## Requirements, notifications and languages

- Needs `rsg-core` and **`ox_lib`** (start `ox_lib` before this resource).

- Every notification, dialog and menu text comes from `locales/en.json` (shown with ox_lib). The emote *names* in the menu are English and live in `emotes.lua`.

- Language: `Config.Locale = nil` follows the ox_lib language (`ox:locale` in `server.cfg`); set e.g. `Config.Locale = 'en'` to force one. To add a language, copy `locales/en.json` to `locales/<code>.json` and translate the values (keep the keys and the `%s` placeholders).

## Safety and robustness

- **Seat claims:** the server holds one claim per player, so two players cannot take the same chair, bench, piano or bed at the same moment (adult `/sex` and `/whore` scenes claim their bed too). A claim is released when you stand, disconnect, or walk away (`Config.Seats`). The server only accepts a claim for a spot the player is actually standing at, clamps the radius, and rate limits the requests; adult scene claims also expire after the scene time limit.

- **Interrupted poses:** a watchdog resets the script if you are interrupted while posing (death, handcuffs, mounting, a vehicle, or another script clearing your tasks), so you are never stuck "seated" and the seat is freed (`Config.Watchdog`). If you ever see spontaneous stand-ups, set `Config.Watchdog.CheckScenario = false`.

- **Weapons:** for `/sit`, `/lean`, `/lay` and `/sleep` your weapon is holstered when the pose starts and kept holstered while it lasts. Emotes and activities that come with a prop (`/sweep`, `/hammer`, `/sit read`, `/piano`...) put the weapon away once, *before* the prop appears, and then leave it alone (forcing it away afterwards removes the prop). Drawing a weapon during one of those simply ends it. Optionally the weapon can be re-equipped when you stand (`Config.Weapons`).

- **Props:** when a prop emote ends (you /stand, walk away, something interrupts it, or the resource restarts) the script lets the scenario play its exit, force-clears whatever is left, and deletes any object the emote attached to you that is still there. Objects that were already on you before the emote are never touched, and nothing is deleted while a weapon is in your hand.

- **Bed detection:** the raycast fallback ignores tables, desks, counters, chairs, benches, pianos and wagons, and can be limited to listed zones. The deny-list is `RejectBedModels` in `props.lua`; add names there or in `Config.BedFallback.RejectModels`. Beds baked into the map cannot be identified by a raycast, so use `Config.BedFallback.AllowZones` if tables in specific rooms are still mistaken for beds.

## Adult mode (optional, off by default)

Set `Config.AdultMode = true` in `config.lua` to enable it. With it `false` the adult commands do not exist and nothing else changes.

- `/whore` - adult NPC service on the nearest bed (prop bed or detected bed surface). It first shows an ox_lib confirmation ("You have requested a whore to join you, this will cost $X. Do you accept and pay?") and the cash is only taken if you accept. Costs `Config.Adult.Price`, gives stress relief afterwards, and the NPC is removed when the scene ends. Male characters only by default (`WhoreRequiresMale`).

- **`/whore` questions:** after the payment dialog two more questions follow, and closing either one cancels everything with nothing charged: **a male or a female companion?** and **naked or clothed?** (`Config.Adult.WhoreOptions` switches either question off). Choosing naked swaps the companion for the nude model (`u_f_m_rhdnudewoman_01` / `re_nakedswimmer_males_01`) and undresses the player. The player's outfit is read from `rsg-clothes` before undressing and put back with `rsg-clothes:ApplyClothes` when the scene ends for any reason (stop, death, resource restart); if no snapshot exists the server event `rsg-clothes:LoadClothes` is used, and `Config.Adult.Naked.RestoreEvent` can name a client event for other clothing scripts. If the clothes cannot be restored safely (rsg-clothes or rsg-appearance not running) the player is **not** undressed and is told so. The animation has one male and one female clip, so the companion always plays the clip of the opposite role to the player, whatever its model. `/sextest naked` and `/sextest female naked` try all of this without paying.

- `/sex [id]` - scene between two players on the nearest bed. The server checks that the target is online and close by (and close to the bed, again when the answer is accepted), that neither player is busy, on cooldown, dead, handcuffed or in jail, that the bed is free, and that one character is male and one is female. The other player gets an ox_lib yes / no dialog showing your character name and must accept; no answer within `Config.Adult.RequestTimeout` counts as declined.

- During a scene: BACKSPACE stops, ENTER changes position, SPACE changes the camera angle, and there is a time limit (`Config.Adult.Timer`). Stopping ends it for both players.

- Scenes are defined in `Config.Adult.Scenes` (animation dictionary + male / female clip names). Tune `offset` / `AnchorZOffset` until the two characters line up.

- Gender comes from `charinfo.gender` on the server (`Config.Adult.GenderValues`).

- **Stress relief is done by the server**, never by the client: when a scene the server saw running for at least `Config.Adult.Stress.MinDuration` seconds ends, the server lowers the character's `stress` metadata by `Amount` and sends `UpdateEvent` to the player so the HUD refreshes (default `hud:client:UpdateStress`; `nil` if your HUD does not need it). **Upgrade note:** the old `Config.Adult.Stress.Event` (a server event triggered by the client) no longer exists; remove it from a customised config.

- **Refunds:** if the NPC scene cannot start after paying, the money is refunded once, within `Config.Adult.RefundWindow` seconds, and never after the scene was confirmed as started.

- **Testing alone:** `/sextest` is restricted to players with the ACE permission `command.sextest` (e.g. admins). Set Config.Adult.SoloTest.Enabled = true, restart, stand next to a bed and use /sextest (your own gender's role), /sextest female or /sextest male.

### Adult mode security notes

The adult part behaves exactly like the standalone `mack-xxx` resource (same server rules, same checks, same settings). What the server enforces:

- `/sex`: both players online, not busy, not on cooldown, not dead / handcuffed / in jail, one male and one female character, close to each other and to the bed (checked again on accept), bed free. The other player must accept. One open request per player, requests are rate limited, and character names in the dialog are stripped of markup.

- `/whore`: payment taken on the server (cash, price, cooldown, gender rule, result of the money removal checked). Refund rules as above.

- Position changes (ENTER) are validated (scene index in range) and rate limited; a player can only end a scene that is really shared with them; scenes never reported as ended are dropped after `Timer` + 30 seconds.

Known limits (they apply to any client side animation script): the animation, the NPC and the bed detection run on the client, so a player with a cheat tool can play the NPC animation without paying. Treat the price as an in-character toll, not as a security feature, and keep your anticheat up to date. The server cannot check that the position sent by `/sex` is really a bed, only that both players stand next to it. Requires **OneSync** (the server checks player positions).

## Prop seating

`/sit` first looks for a known chair, stool, bench or couch within `Config.PropSearchRadius`. If found, you are seated at the closest free seat slot (benches have left/right slots; seats already used by another player are skipped). If no prop is found it falls back to the raycast logic (ledge / wall / edge / lean / ground).

Models and per-seat offsets live in `props.lua` (ported from phils-interactions). To add a prop, add an entry with `models`, `type` (`chair`, `bench`, `bed`, `bedroll` or `piano`) and `slots` (x/y/z/heading offsets in the prop's local space). `piano` props are only used by `/piano`, never as a seat.

## Install

1. Drop the `mack-emotes-advanced` folder into your resources folder.

2. Add `ensure mack-emotes-advanced` to `server.cfg` (after `rsg-core` and `ox_lib`). If you ran the old `mack-relaxing`, remove its `ensure` line.

## Config

- `Config.Offsets` - forward / z offsets per style. **These came from GTA V and need tuning in RedM.** Set `Config.Debug = true`, sit, and use the on-screen live offset readout (green = hit, yellow = edge, red = target).

- `Config.LedgeScenarios`, `Config.LeanScenarios`, `Config.GroundScenarios` - RedM scenario names.

- `Config.RayFlags` - shape test flags.

- `Config.Commands`, `Config.Notify`, `Config.Locale`, `Config.Emotes`, `Config.Blockers`, `Config.Weapons`, `Config.Watchdog`, `Config.Seats`.

- **"You cannot do that right now (...)"**: the text in brackets is the check that refused (dead, on a mount, in a vehicle, handcuffed, or the game reporting swimming / falling / ragdoll). If swimming, falling or ragdoll fires while you are standing normally, set it to `false` in `Config.Blockers`.

## Files

- `config.lua` - all settings. `emotes.lua` - the emote and seated-activity lists. `props.lua` - chairs, benches, beds, pianos and the bed deny-list.

- `client.lua`, `server.lua`, `locales/en.json`, `fxmanifest.lua`.

- **Asset escrow:** the manifest is prepared for Cfx.re Asset Escrow (`lua54 'yes'`, every script declared, no `load()` / `io.*`). client.lua and server.lua are encrypted; config.lua, emotes.lua, props.lua and locales/*.json stay readable and editable (`escrow_ignore` in `fxmanifest.lua`). `rsg-clothes` and `rsg-appearance` are optional (adult naked option only) and are therefore not in `dependencies`.

## Notes

- Natives adapted for RedM (text drawing, markers, joaat scenario hashes, RedM input hashes, the kit emote native).

- Sync uses a state bag (`mackEmotesData`), so OneSync is required for other players to see the scenario. Values written by other players are validated (a plain scenario name only) before they are played.

## Changelog

- **2.1.0** - Security and bug-fix pass, adult mode brought in line with `mack-xxx` 1.1.0: server side stress relief, bed claims for `/sex`, claim position check / radius clamp / rate limit and adult claim time limit, refund window, scene validation and rate limits, dead / handcuffed / jailed checks on the server, `/sextest` restricted, stale scene cleanup, safer return from the bed, re-check after the `/whore` dialogs, camera angle guard, state bag validation.

- **2.0.0** - Emotes, work actions, music, seated activities.