Contracts
How to add a contract into the gang app ?
Last updated
How to add a contract into the gang app ?
Last updated
You can add any heist resource to the gang app contracts.
If the heist script is open source then you can start it with the gang group.
If the heist script is not open source then you need to start it solo from the gang app.
All zat heists works with the gang app.
1 - Under config.lua you will find the Config.Contracts, example :
{
id = 1, -- must be a unique id for the contract
label = 'Roof Running', -- label that will show in the ui gang app
requirements = { -- the required items to start the contract (just to display them)
'Green Laptop',
'RFID Cloner',
'Drill',
'Helmet'
},
price = 15, -- price to start the contract
available = true, -- in case you want to disable it (as admin)
image = 'https://www.awheatingandcooling.com/blog/wp-content/uploads/2020/07/Are-Rooftop-AC-Units-Right-for-Your-Business.jpg',
resource = 'zat-roofrunning', -- the resource of the heist or contract
text = 'Roof Running mission started, head over to the location and contact the responsable...', -- notification that the player will get on contract start
coords = vector3(574.08, 133.01, 98.47) -- npc location
},
2 - Once the player buys the contract, then he must head to the npc to start the contract from, here are the exports you can use on the heist / contract script : client exports :
exports('AmIMemberOfThisContractById', AmIMemberOfThisContractById)
exports('GetMyContractIdByResource', GetMyContractIdByResource)
exports('GetContractMembersById', GetContractMembersById)
exports('GetContractResourceById', GetContractResourceById)
exports('DisableContractById', DisableContractById)
server exports :
exports('GetMyContractIdByResource', GetMyContractIdByResource)
exports('GetContractMembersById', GetContractMembersById)
exports('GetContractResourceById', GetContractResourceById)
exports('DisableContractById', DisableContractById)
3 - All you have to do is to add a condition to start the mission. example :
contractId = exports['zat-gangs']:GetMyContractIdByResource(GetCurrentResourceName())
if contractId == nil then
-- No contracts available
else
exports['zat-gangs']:DisableContractById(contractId) -- disable the contract so it could not be started again
-- start the contract
if exports['zat-gangs']:AmIMemberOfThisContractById(contractId) then
StartMission()
end
end
Check if there is a contract bought of roofrunning or not, then check if the client is member or not of the contract then start it.