APPs Config
All APPs comes enabled by default, is important that if you want to restrict the access to an APP you add your own check by using your own exports or one of the ones provided here.
This is how the config for an APP looks like by default, you can find this code in every config.lua.
Config.App = {
name = "boosting",
label = "Boosting", -- You can rename the app by editing this field
isEnabled = function(serial)
return true
end
}
The following snippets are just examples for most common cases, add your own checks or use other scripts exports for this.
If you want to restrict an APP so only players with X item(s) can access it, you can use the following export:
Config.App = {
name = "boosting",
label = "Boosting",
isEnabled = function(serial)
return exports['av_laptop']:hasItem('water')
end
}
The export hasItem also support a table of items for situations where you want to verify if the player owns more than 1 item at the same time:
Config.App = {
name = "boosting",
label = "Boosting",
isEnabled = function(serial)
return exports['av_laptop']:hasItem({"water", "sandwich"})
end
}
Laptop Container
If using ox_inventory you can use laptop as container, this means each laptop can be used to open an individual stash:
open the inventory > right click on laptop > Devices
.You can drag n drop your items inside that little stash and use it to enable specific apps by using the following export:
exports['av_laptop']:hasDevice(itemName,laptopSerial)
params:
itemName:
string
Item required inside laptop container.laptopSerial:
string
This is sent from laptop to isEnabled functionreturns:
result:
boolean
Config.App = { name = "boosting", label = "Boosting", isEnabled = function(serial) local hasDevice = exports['av_laptop']:hasDevice("black_usb", serial) print("hasDevice?", hasDevice) -- should print true/false in F8 return hasDevice end }
Last updated