Shower System
Exports
Start a shower or a tooth-brush from your own scripts, and give free uses from the server
Exports
Available since 2.1.0. Your scripts can start suty-shower's own shower and tooth-brushing, with the same animation, water, clothing and hygiene as using the item.
The exports only ask suty-shower to start. The soap and the toothbrush are still required: the server checks them and removes them before the animation starts. A free use can only come from a server script (AllowFree). Nothing sent from a client can skip the item.
Client
StartShower
local ok, reason = exports['suty-shower']:StartShower(target, options)
| Argument | Type | Description |
|---|---|---|
target |
entity, coords or nil |
A shower prop entity, coords next to a shower (vector3 or { x, y, z }), or nil for the nearest shower |
options.skipHouse |
boolean | true skips the "must be inside a house" rule for this shower (gyms, prisons...) |
BrushTeeth
local ok, reason = exports['suty-shower']:BrushTeeth(target)
| Argument | Type | Description |
|---|---|---|
target |
entity, coords or nil |
A sink entity or coords (the player must be within 3 m), or nil to brush where the player stands |
IsBusy
local busy = exports['suty-shower']:IsBusy() -- true while the player is showering or brushing
Return values
StartShower and BrushTeeth return true when the action starts. Otherwise they return false and a reason:
| Reason | Meaning |
|---|---|
'busy' |
The player is already showering or brushing |
'no_shower' |
No shower was found |
'too_far' |
The player is too far away |
'disabled' |
The dental system is turned off (BrushTeeth only) |
Without the item, the player gets a notification and nothing happens.
Server
AllowFree
local granted = exports['suty-shower']:AllowFree(source, kind, seconds)
| Argument | Type | Description |
|---|---|---|
source |
number | The player's server id |
kind |
string | 'shower' or 'brush' |
seconds |
number | How long the pass lasts, 1-3600 (default 120) |
Gives the player one free shower or one free brush, with no item needed. The pass is used by the next shower or brush, or expires. Returns true when granted.
Example: a free gym shower
-- server
exports['suty-shower']:AllowFree(source, 'shower', 60)
TriggerClientEvent('mygym:shower', source)
-- client
RegisterNetEvent('mygym:shower', function()
local ok, reason = exports['suty-shower']:StartShower(nil, { skipHouse = true })
if not ok then print('shower failed: ' .. reason) end
end)
Reading hygiene values
For your own HUD, the client also exports GetHygiene(), GetDentalHygiene() and GetHygieneData(). See the «HUD API» section in Installation.
