Comment on page
Persistent Records & Tablet
How to set up Pro Laser 4 tablet.
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.
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
resourcesand my connection string looks like this in my server.cfg:
set mysql_connection_string "server=localhost;user=<USERNAME>;password=<PASSWORD>;database=resources;charset=utf8mb4;connectTimeout=60000;acquireTimeout=60000;timeout=60000
During testing, hangs/server crashes occurred when
connectTimeout=60000;acquireTimeout=60000;timeout=60000was not included, your mileage may vary. I would recommend including these just in case.
Now with your desired database selected you can execute
setup.sqlincluded with the resource, it will build a table with columns below.
CREATE TABLE `prolaser4` (
`rid` INT(11) NOT NULL AUTO_INCREMENT,
`timestamp` DATETIME NOT NULL,
`speed` INT(11) NOT NULL DEFAULT '0',
`distance` FLOAT NOT NULL DEFAULT '0',
`targetX` FLOAT NOT NULL DEFAULT '0',
`targetY` FLOAT NOT NULL DEFAULT '0',
`player` TEXT NOT NULL COLLATE 'latin1_swedish_ci',
`street` TEXT NOT NULL COLLATE 'latin1_swedish_ci',
`selfTestTimestamp` DATETIME NOT NULL,
PRIMARY KEY (`rid`) USING BTREE
Configure logging settings in
config.lua. Then use
/lidarrecordsin game to open the tablet and review records.
Uncomment these two oxmysql lines from fxmanifest:
'oxmysql', -- uncomment for persistent records & record management tablet. See docs and configs.
'@oxmysql/lib/MySQL.lua', -- uncomment for persistent records & record management tablet. See docs and configs.
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.
- 2.Register an application, select "OAuth 2 authorization without a callback URL"
- 4.Copy Client ID field.
- 5.Paste in to config in the following format:
cfg.imgurApiKey = 'Client-ID XXXXXXXXXXXXXXX'where
XXXXXXXXXXXXXXXis the client ID you copied in step 4.
- 6.Restart Pro Laser 4 and test out your print functionality in the tablet.
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.
Example Embed from PL4
- 1.Open "Edit Channel" for the channel where you would like these posted.
- 2.Navigate to "Integrations" tab.
- 3.Click "Webhooks", then "New Webhook" if you don't already have one.
- 4.Then "Copy Webhook URL" and paste in
cfg.discordWebhook. See example below.
- 5.Restart Pro Laser 4 and test out your print functionality in the tablet.
cfg.discordWebhook = 'https://discord.com/api/webhooks/XXXXXXXXXXXXXXXXXXX/YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY'
Note: customizing the icon or name for the webhook is not necessary, ProLaser4 will set the webhook name and image when posting.