âī¸Integration
Information about how to integrate our tablet system with your server's resources.
đ Tablet opening
1ī¸âŖ Opening with an item
The resource configuration is pre-set for the tablet to open with an item by default. To make this feature work, you also need to create an item in your inventory with the ID of app_tablet.
Add this section to ox_inventory/data/items.lua
Add the following image file as ox_inventory/web/images/app_tablet.png
If you didn't name the item app_tablet, adjust the itemId in resource config accordingly.
2ī¸âŖ Opening with a command
If you don't wish the tablet to be an item, then in resource/config/shared.lua, change the openMethod option from inventory to command. Use the command /tablet in-game to open the application tablet.
đ Enabling application installs
By default, application installations are disabled, meaning all applications are visible on the tablet. However, you have the option to enable them:
Navigate to /resource/config/shared.lua and set installEnabled to true.
In config/client.lua set requireInstall to true for applications you want to require installation.
If you wish to configure options for RAHE resources, then head to /resource/client/integrations.lua. In the default resource, all of our applications have requireInstall set to true, meaning they will need to be installed if you enable installations.
đŋ Application installation
To install applications, you need to trigger the following server-side export:
exports['rahe-tablet']:installApplication(playerId, appId, slot)
This export will mark the application as installed, indicated by a progress circle. For example, to install our boosting application for player ID 1, who has a tablet in his inventory slot 4, you would use:
exports['rahe-tablet']:installApplication(1, 'rahe-boosting', 4)
You might wonder about the purpose of the slot variable. This variable is necessary only when you've configured the appInstallTarget in /resource/config/shared.lua to metadata (which is only applicable when using ox_inventory!). In this case, the slot variable is used retrieve the item in that specific slot and save the installed application ID into the metadata of that item.
Code example for ox_inventory
To install the application rahe-racing from a USB stick, follow these steps:
Add the installation USB item to ox_inventory/data/items.lua:
Add the usb_install export to a client-side file in rahe-tablet, such as the end of /resource/client/integrations.lua:
Create the server-side event to handle installation. Register the event as follows at the end of /resource/server/installation.lua:
(it's in the same file as the export function, so we are using the installApplication function directly)
Last updated