Script
Automatize user time tracking
Using the FiveM Lua Script
Prerequesites
For now the script is only working on ESX. Please contact us if you are a good qbcore scripter and can help us translating the script.
Installing
Download here
To setup the script you will need to install NodeJS Runtime. It will be necessary to install important dependicies. For Windows just download the exe here and run it. How to install on Linux you can find here
Windows
Goto your FXServer Ressources, and unzip the script as a new folder.
Run windows_setup.bat
to automatically install needed dependecies.
Dont forget to autostart the script by updating your server cfg
ensure timecord_esx_script-master
Linux
Goto your FXServer Ressources, create a new folder and paste the script source there.
Goto Script path
Run
chmod +x linux_setup.sh
After that run
./linux_setup.sh
Dont forget to update your server cfg to enable autostart.
Using ESX
Basic Function
The script works with the esx:playerLoaded
and esx:playerDropped
event. Once the event is fired, we send a http request to our server. Our server then handles everything else.
Using getSharedObject()
In the newer versions esx uses a differnt function to import the esx object. If you have a newer esx version please update the script like that.
Configuration
In this table, our key is the exact name of the job how it is in the database. Based on that the script checks if the user has the specified job. The value of this pair is our API Key from the server where our bot is on. You can obtain your Key in the Settings -> Script Tab
Notice: You can add multiple keys if you want. Ensure that within the server settings (dashboard), the IP address of your server has been properly configured under the script settings. Also dont give your API Key away!
Using the custom event
If you have any custom on/offy dutys, where your users can stop or start working without leaving the server u can use the custom event to trigger stamping in or out.
Error handling
We experienced that some servers experience that their esx:playerDropped
dont work properly. For now we dont know why this error occurs. Maybe you changed it in your esx script or you have an other event that is rewriting it. You can update our script if you have an custom Event by removing the onNet('esx:playerDropped')
from our script and replacing it with your own custom event. An optional Workaround may be to use the FiveM Playerjoined Event :)
Last updated