Setting up
You have 2 different ways to configure the guide:
First way (with AutoStart)
The first one is by putting the AutoStart to true
in the configuration file (config.lua
) :
Config = {
...
AutoStart = true,
...
}
By setting it to true, it means that the guide will be automatically played if the player has never seen it.
It also means that you have to configure the behavior of your identity/character creator scripts.
Why?
Because if you don't, there will be cameras conflicts and the first player connection will be bugged.
How can I configure the behavior?
There are different ways that allow you to manage when identity/character creator scripts can trigger their features but the easier is by using the seen
export.
function OpenIdentityMenu()
local guideSeen = exports["cuchi_guide"]:seen()
if not guideSeen then -- if not seen then we need to wait for the guide to end
while not guideSeen do
guideSeen = exports["cuchi_guide"]:seen() -- check every 50ms if the guide ended
Wait(50)
end
end
-- Show identity menu
...
end
You can also use both export and event which is better:
local guideSeen = exports["cuchi_guide"]:seen()
AddEventHandler("cuchi_guide:ended", function() -- this event is triggered at the end of the guide
guideSeen = true
end)
function OpenIdentityMenu()
while not guideSeen do
Wait(0)
end
-- Show identity menu
...
end
Second way (without AutoStart)
The second one is by putting the AutoStart to false in the configuration file (config.lua
) :
Config = {
...
AutoStart = false,
...
}
So in this case you have to manually trigger the export playGuide
as :
function OpenIdentityMenu()
...
-- Show identity menu
...
-- Assuming this code is executed once the identity registration is ended
exports["cuchi_guide"]:playGuide()
end
You can also trigger the guide from the server by using the cuchi_guide:play
event
RegisterNetEvent("identity:finished", function() -- assuming this event is triggered once the identity registration is ended
...
TriggerClientEvent("cuchi_guide:play", source)
end)