Installation Instructions for gs_ttswatch
Follow these steps to properly install and configure your new resource:
-
Download the Resource
- Go to portal.cfx.re
-
Navigate to Assets > Granted Assets >
gs_ttswatch
- Download the resource
-
Extract the Files
-
Open the downloaded
.zip
file -
Inside, you'll find a folder named
gs_ttswatch
-
Move the entire
gs_ttswatch
folder into your desired server resources folder (e.g.,/resources/[scripts]
)
-
Open the downloaded
-
Add to Server Configuration
- Open your
server.cfg
-
Add the following line:
ensure gs_ttswatch
- Open your
-
Restart the Server
- Restart your FiveM server (Important!)
-
Configure the Script (Optional)
- Navigate to
gs_ttswatch/config.lua
- Edit the configuration options to fit your server's needs
- Navigate to
Setting up ElevenLabs
- Create a free account on ElevenLabs here.
- After creating an account, click on
Developers
at the bottom left and navigate to theAPI Keys
tab. - Press
+ Create Key
and make sure you setText to Speech
toAccess
. - Copy the API key to
gs_ttswatch/config.lua
underConfig.ElevenLabs.ApiKey
. - You can generate up to 20,000 characters for free each month. If you require more characters, you can upgrade to a paid monthly subscription on ElevenLabs.
- If you want to use all 20,000 characters, set
ModelId = 'eleven_turbo_v2_5'
ings_ttswatch/config.lua
.
Triggering audible notification from script
You can play a notification from a server-sided script through:
exports.gs_ttswatch:PlayAudioMessage(serverId, text, name, image, volume, voiceId)
exports.gs_ttswatch:IsAudioLoading(serverId) -- This export returns true while the audible notification is being generated.
or from a client-sided script through:
exports.gs_ttswatch:PlayAudioMessage(text, name, image, volume, voiceId)
If you want to save ElevenLabs credits, you can go to the Text to Speech
option in your ElevenLabs account, generate the desired audio and go to History
on the top right. Under this tab, you can hover over previously created audio files, and download these directly. Place the downloaded audio file in the gs_ttswatch/html/audio
folder and play it directly using the export below.
You can play any pre-recorded audio file (if the file is added to gs_ttswatch/html/audio
) from a server-sided script through:
exports.gs_ttswatch:PlaySavedAudioMessage(serverId, fileName, name, image, volume)
or from a client-sided script through:
exports.gs_ttswatch:PlaySavedAudioMessage(fileName, name, image, volume)
Input arguments:
serverId
: The server-id of the player that should receive the notification (only for server-sided exports).text
: The text that will be transformed into a voice-over.fileName
: The name of the audio file that will play, i.e. "sample.mp3" (audio file needs to be located ings_ttswatch/html/audio
).name
: The name that will be displayed on the hologram.image
: The image that will be displayed on the hologram (you can add custom images togs_ttswatch/html/images
).volume
: The volume of the voice-over (value between 0-1).voiceId
: The voice-id that will be used as the voice.