💾Persistent Records & Tablet
How to set up Pro Laser 4 tablet.
Introduction
By default, Pro Laser 4 will store the last 100 clocks to the player's machine, which will be loaded on player join.
The section below describes a centralized database for tracking clocks server side.
Dependencies
oxmysql - SQL interface resource. Alternatively you can modify sv_lidar.lua
if you use another resource.
Setup Pro Laser 4 Database Table
If you do not have an existing database you'd like to use, you can create one, see example below. Notice: this must be the same database you connect to in your server.cfg.
Example:
I use a database called resources
and my connection string looks like this in my server.cfg:
During testing, hangs/server crashes occurred when connectTimeout=60000;acquireTimeout=60000;timeout=60000
was not included, your mileage may vary. I would recommend including these just in case.
Import SQL / Execute
Now with your desired database selected you can execute setup.sql
included with the resource, it will build a table with columns below.
Logging Configuration
Configure logging settings in config.lua
. Then use /lidarrecords
in game to open the tablet and review records.
Uncomment these two oxmysql lines from fxmanifest:
Imgur Integration for Record Printing
The Pro Laser 4 can use Imgur as an upload endpoint for "printing" lidar records from the tablet. These are more screenshots than prints but, are roleplayed as such. In order to be able to upload these images to Imgur you will need to generate an API client ID.
Navigate to https://api.imgur.com/oauth2/addclient
Register an application, select "OAuth 2 authorization without a callback URL"
Navigate to: https://imgur.com/account/settings/apps
Copy Client ID field.
Paste in to config in the following format:
cfg.imgurApiKey = 'Client-ID XXXXXXXXXXXXXXX'
whereXXXXXXXXXXXXXXX
is the client ID you copied in step 4.Restart Pro Laser 4 and test out your print functionality in the tablet.
Discord Webhook for Record Printing
The Pro Laser 4 can also use Discord as an upload endpoint for "printing" lidar records from the tablet. Discord webhook messages include record data and a screenshot of the record document. In order to be able to upload these images to Discord you will need a Discord webhook on a channel.
Open "Edit Channel" for the channel where you would like these posted.
Navigate to "Integrations" tab.
Click "Webhooks", then "New Webhook" if you don't already have one.
Then "Copy Webhook URL" and paste in
cfg.discordWebhook
. See example below.Restart Pro Laser 4 and test out your print functionality in the tablet.
Note: customizing the icon or name for the webhook is not necessary, ProLaser4 will set the webhook name and image when posting.
Last updated