Exports & Events
Madonne Seatbelt exposes two client-side exports for integration with other resources, allowing you to read or control the seatbelt state programmatically.
π€ GetSeatbeltStatus
Returns the current seatbelt status of the local player.
local isBuckled = exports['MS_Madonne_Seatbelt']:GetSeatbeltStatus()
-- Returns: true (buckled) or false (unbuckled)Example use case
-- Prevent a player from exiting a vehicle if unbuckled
if not exports['MS_Madonne_Seatbelt']:GetSeatbeltStatus() then
TriggerEvent('chat:addMessage', { args = { "You must fasten your seatbelt before exiting!" } })
endπ₯ SetSeatbeltStatus
Forces the seatbelt state of the local player to a specific value.
exports['MS_Madonne_Seatbelt']:SetSeatbeltStatus(status)status
boolean
true to force buckle, false to force unbuckle
Example use case
β οΈ
SetSeatbeltStatusonly updates the internal state. It does not trigger the buckle/unbuckle sounds, notifications, or custom hooks. If you need those, trigger the seatbelt toggle manually through player input or useFastenedSeatbelt()/UnfastenedSeatbelt()incustom/main.lua.
πͺ Custom Hook Functions
Two functions in custom/main.lua are called automatically by the resource when the player toggles their seatbelt. You can add any logic inside them:
π‘ Custom Notification Events
When NotificationsType is set to "custom", the following client-side events are triggered:
These are already set up in custom/notifs.lua for you to fill in.
Last updated