Exports and events
Open the boosting tablet from other scripts, check VIN-scratched plates and run code when a boost finishes.
Open the tablet
From a client script:
TriggerEvent('gg_boosting:client:open_tablet')
From a server script, pass the player's server id:
TriggerClientEvent('gg_boosting:client:open_tablet', source)
The client event can fire once every 3 seconds. It sends gg_boosting:server:open_tablet, which opens the tablet for the player who sent it. Neither checks for the gg_boosting_tablet item.
Note Do not call
TriggerEvent('gg_boosting:server:open_tablet', source)from the server. That route does not open the tablet. UseTriggerClientEventas shown above.
Close the tablet
-- client
TriggerEvent('gg_boosting:client:close_tablet')
-- server
TriggerClientEvent('gg_boosting:client:close_tablet', source)
isVehicleVinscratched
Checks whether a plate belongs to a car a player got from a VIN scratch. It works on the client and on the server.
local scratched = exports.gg_boosting:isVehicleVinscratched(plate)
| Parameter | Type | Description |
|---|---|---|
plate | string | The vehicle's plate, without leading or trailing spaces |
| Returns | Type | Description |
|---|---|---|
scratched | boolean | true if the plate is a VIN-scratched car, otherwise false |
On the client it asks the server and waits for the answer, so call it from a thread or an event handler.
local plate = 'ABCD1234'
if exports.gg_boosting:isVehicleVinscratched(plate) then
print(('Plate %s is a VIN scratch.'):format(plate))
end
A plate that no longer exists in player_vehicles (QBCore, Qbox) or owned_vehicles (ESX) is cleared from the list when gg_boosting starts.
Run code when a boost finishes
gg_boosting/base/core/open/server/hooks.lua is open for editing. hooks.onBoostComplete runs on the server once for every member of the group when a boost is delivered.
| Field | Type | Description |
|---|---|---|
payload.player.source | number | Server id |
payload.player.identifier | string | Framework identifier |
payload.player.name | string | Boosting alias |
payload.player.leader | boolean | true for the group leader |
payload.job.vehicle | string | Vehicle model |
payload.job.label | string | Vehicle label |
payload.job.class | string | Contract class, for example "A+" |
payload.job.payout | number | This player's XNT share with level bonus. A VIN scratch does not pay it. |
payload.job.rep | number | Reputation this player got, with level bonus |
payload.job.vinScratch | boolean | true for a VIN scratch |
payload.group_id | number | Group id |
To run something once per group, check the leader:
hooks.onBoostComplete = function(payload)
if not payload.player.leader then return end
print(('%s finished a %s class boost'):format(payload.player.name, payload.job.class))
end
Restart gg_boosting after you edit the file.
