Customize the client side alerts to fit the look and feel of your own server
-- msg [string]: Message to display in the notification
-- type [string]: Type of notification to display
-- timeout [int]: Time in milliseconds to display the notification
function Alert(msg, type, timeout)
lib.notify({
type = type,
description = msg,
icon = "fas fa-truck",
duration = timeout,
position = "top",
})
end
3D Text
Customize the the draw text placed at each interactable offset location
-- Purpose: Function to draw 3D text.
-- x [float]: X coordinate
-- y [float]: Y coordinate
-- z [float]: Z coordinate
-- text [string]: Text to display
function DrawText3D(x, y, z, text)
SetTextScale(0.4, 0.4)
SetTextFont(4)
SetTextProportional(1)
SetTextColour(220, 220, 220, 215)
BeginTextCommandDisplayText("STRING")
SetTextCentre(true)
AddTextComponentSubstringPlayerName(text)
SetDrawOrigin(x,y,z+0.5, 0)
EndTextCommandDisplayText(0.0, 0.0)
ClearDrawOrigin()
end
Police Alert
Customize the dispatch triggered when someone is trying to lockpick a motorhome (Does not get triggered if the player is on a configured police job if enabled)
An extra function that is used to check whether or not a mortohome can be interacted with. You can use this to disable an RV's functionality in specific scenarios such as the player being dead, or the RV located in a green zone.
-- Purpose: Function to check if player can interact with RV
-- vehicle [int]: Vehicle entity
-- return [bool]: Whether the player can interact with the RV
function CanInteract(vehicle)
return true
end
Forced Entry
This is where you can customize a minigame of your choice. It is already setup to use a lockpick minigame that can be downloaded here
-- Purpose: Function to trigger lockpick minigame.
-- Triggered by client event "gs-motorhomes:client:minigame"
-- isPolice [bool]: Whether the player is a police officer
-- Callback [function]: Callback function
function AttemptForceEntry(isPolice, Callback)
--Give police more chances to get the door open / unlock the stash
local tries = (isPolice and 4 or 1)
--Simple lockpick minigame https://github.com/GlitchOo/lockpick
if IsResourceOnServer('lockpick') then
local success = exports['lockpick']:startLockpick(tries)
Callback(success) --true or false
else
Callback(false)
end
end