Exports & Events
This section contains all the exports provided by the script. For best results, make changes with someone knowledgeable in Lua to prevent errors.
Exports
HasSeatbelt
exports['mst_seatbelt']:HasSeatbelt()The HasSeatbelt export allows you to check if the local player is currently wearing a seatbelt. This export returns the current seatbelt state.
How to use?
To check if the local player is wearing a seatbelt, use the following code:
-- Check if local player is wearing a seatbelt
local hasSeatbelt = exports['mst_seatbelt']:HasSeatbelt()
if hasSeatbelt then
print("You are wearing a seatbelt")
else
print("You are not wearing a seatbelt")
endReturn value:
Returns
trueif the local player is wearing a seatbeltReturns
falseif the local player is not wearing a seatbelt
ToggleSeatbelt
exports['mst_seatbelt']:ToggleSeatbelt()The ToggleSeatbelt export allows you to toggle the seatbelt state for the local player. This will fasten the seatbelt if it's unfastened, or unfasten it if it's fastened.
How to use?
To toggle the local player's seatbelt, use the following code:
-- Toggle local player's seatbelt
local success = exports['mst_seatbelt']:ToggleSeatbelt()
if success then
print("Seatbelt toggled successfully")
else
print("Failed to toggle seatbelt (not in vehicle, vehicle excluded, or menu is open)")
endReturn value:
Returns
trueif the seatbelt was toggled successfullyReturns
falseif the player is not in a vehicle, the vehicle is excluded, or the pause menu is active
SetSeatbelt
exports['mst_seatbelt']:SetSeatbelt(state)The SetSeatbelt export allows you to set the seatbelt state for the local player to a specific value (fastened or unfastened).
How to use?
To set the local player's seatbelt state, use the following code:
-- Fasten the seatbelt
local success = exports['mst_seatbelt']:SetSeatbelt(true)
if success then
print("Seatbelt fastened")
else
print("Failed to fasten seatbelt")
end
-- Unfasten the seatbelt
local success = exports['mst_seatbelt']:SetSeatbelt(false)
if success then
print("Seatbelt unfastened")
else
print("Failed to unfasten seatbelt")
endParameters:
state(boolean): The desired seatbelt state.trueto fasten,falseto unfasten.
Return value:
Returns
trueif the seatbelt state was set successfullyReturns
falseif the player is not in a vehicle, the vehicle is excluded, the pause menu is active, the player is dead, or the seatbelt animation is still playing
Last updated