Mads' Resource Documentation
  • 📺Youtube
  • 🤝Discord
  • ⭐Tebex
  • 👨‍💻GitHub
  • 👋Welcome!
  • General Info
    • ❓Questions and Answers
      • Is X script locked/encrypted?
      • I need support, where can I reach out?
      • How do I update my server artifacts?
      • How do I transfer a script from one account to another?
      • How do I set my game build?
    • ⚠️Common Problems
      • You lack the required entitlement
      • Failed to verify protected resource
      • Could not find dependency /assetpacks for resource
  • Resources
    • 🪑Sit Anywhere
      • Adding Custom Models
      • Falling Through the Map
      • Exports
      • Events
    • 🚁Helicopter Camera
      • Adding custom helicopters
      • Moving the UI above the minimap
      • Adding controller inputs
      • Controls
      • Exports
      • Events
    • 🚙Slash Tires
      • Exports
      • Events
    • 🕶️Stungrenade
      • Adding the Stungrenade as an item
      • Measures Against Cheaters
      • Exports
      • Events
    • 🪖CS Styled Killfeed
      • General Information
      • Exports - Client Side
      • Exports - Server Side
      • Examples
      • Adding Messages to the feed
      • Weapons List / Death Reasons
      • Changing the position if the killfeed
    • Crouch & Crawl
      • Exports
    • 🔫Taser Effect
    • 🔭Telescopes
    • 🩺Crutches
      • How to make the script compatible with ps-walkstyle
    • ⛽No Exploding Pumps
    • 👠Hookers
Powered by GitBook
On this page
  • IsSitting
  • IsLaying
  • IsSittingOrLaying
  • IsNearSeat
  • IsNearBed
  • GetClosestSeat
  • GetClosestBed
  • SitOnClosestSeat
  • LayOnClosestBed
  • StopCurrentAction
  • DisableSitting
  • DisableLaying
  • DisableSittingAndLaying
  • IsSittingDisabled
  • IsLayingDisabled
  • GetSitDisableReasons
  • GetLayDisableReasons
  1. Resources
  2. Sit Anywhere

Exports

There are 17 exports included with the script (all are client-side).

IsSitting

Returns if the local player is sitting.

exports.sit:IsSitting()

Example

---@return boolean isSitting
local isSitting = exports.sit:IsSitting()
print("isSitting:", isSitting)

IsLaying

Returns if the local player is laying down.

exports.sit:IsLaying()

Example

---@return boolean isLaying
local isLaying = exports.sit:IsLaying()
print("isLaying:", isLaying)

IsSittingOrLaying

Returns if the local player is sitting or laying.

exports.sit:IsSittingOrLaying()

Example

---@return boolean isSittingOrLaying
local isSittingOrLaying = exports.sit:IsSittingOrLaying()
print("isSittingOrLaying:", isSittingOrLaying)

IsNearSeat

Returns if the local player is closer than Config.MaxInteractionDist to a seat.

exports.sit:IsNearSeat()

Example

---@return boolean isNearSeat
local isNearSeat = exports.sit:IsNearSeat()
print("isNearSeat:", isNearSeat)

IsNearBed

Returns if the local player is closer than Config.MaxInteractionDist to a bed.

exports.sit:IsNearBed()

Example

---@return boolean isNearBed
local isNearBed = exports.sit:IsNearBed()
print("isNearBed:", isNearBed)

GetClosestSeat

Returns the closest seat to the player.

exports.sit:GetClosestSeat()

Example

---@return boolean found if any position was found or not
---@return table closest table containing the data about the closest seat
local found, closest = exports.sit:GetClosestSeat()
if found then
    -- print(json.encode(closest, {indent=true}))
    print("type:", closest.type) -- "sit"
    print("entity:", closest.entity) -- number (0 if poly)
    print("coords:", closest.coords) -- coords, vector3
    print("distance:", closest.distance) -- distance, number
    print("name:", closest.name) -- Poly name (if applicable)
    print("group:", closest.group) -- Poly group
else
    print("No seat was found!")
end

GetClosestBed

Returns the closest bed to the player.

exports.sit:GetClosestBed()

Example

---@return boolean found if any position was found or not
---@return table closest table containing the data about the closest bed
local found, closest = exports.sit:GetClosestBed()
if found then
    -- print(json.encode(closest, {indent=true}))
    print("type:", closest.type) -- "sit"
    print("entity:", closest.entity) -- number (0 if poly)
    print("coords:", closest.coords) -- coords, vector3
    print("distance:", closest.distance) -- distance, number
    print("name:", closest.name) -- Poly name (if applicable)
    print("group:", closest.group) -- Poly group
else
    print("No seat was found!")
end

SitOnClosestSeat

Makes the local player sit on the closest seat.

exports.sit:SitOnClosestSeat()

LayOnClosestBed

Makes the local player lay down on the closest bed.

exports.sit:LayOnClosestBed()

StopCurrentAction

Makes the local player get up if they are sitting or laying down.

exports.sit:StopCurrentAction()

Example

if exports.sit:IsSitting() or exports.sit:IsLaying() then
    exports.sit:StopCurrentAction()
end

DisableSitting

Disables sitting. If reason isn't specified it will be handled as 'default' internally.

exports.sit:DisableSitting(state, reason)

Example

---@param boolean state
---@param string reason
exports.sit:DisableSitting(true, 'dead')

DisableLaying

Disables laying. If reason isn't specified it will be handled as 'default' internally.

exports.sit:DisableLaying(state, reason)

Example

---@param boolean state
---@param string reason
exports.sit:DisableLaying(true, 'dead')

DisableSittingAndLaying

Disables sitting and laying. If reason isn't specified it will be handled as 'default' internally.

exports.sit:DisableSittingAndLaying(state, reason)

Example

---@param boolean state
---@param string reason
exports.sit:DisableSittingAndLaying(true, 'dead')

IsSittingDisabled

Returns if sitting is disabled as the first return value, and the reason (if applicable) as the second value.

exports.sit:IsSittingDisabled()

Example

---@return boolean isDisabled
---@return table reasons
local isDisabled, reasons = exports.sit:IsSittingDisabled()
print(isDisabled, json.encode(reasons, {indent=true}))

IsLayingDisabled

Returns if laying is disabled as the first return value, and the reason (if applicable) as the second value.

exports.sit:IsLayingDisabled()

Example

---@return boolean isDisabled
---@return table reasons
local isDisabled, reasons = exports.sit:IsLayingDisabled()
print(isDisabled, json.encode(reasons, {indent=true}))

GetSitDisableReasons

Returns the reasons that sitting is disabled, returns an empty table if there are no reasons.

exports.sit:GetSitDisableReasons()

Example

---@return table reasons
local reasons = exports.sit:GetSitDisableReasons()
print(json.encode(reasons, {indent = true}))

GetLayDisableReasons

Returns the reasons that laying is disabled, returns an empty table if there are no reasons.

exports.sit:GetLayDisableReasons()

Example

---@return table reasons
local reasons = exports.sit:GetLayDisableReasons()
print(json.encode(reasons, {indent = true}))

PreviousFalling Through the MapNextEvents

Last updated 1 year ago

🪑