In the zone value, you can either set "random" to let the script select one of your configured zones or the name of a specific zone of your configured zones.
Areas/Zones Configuration
Zones = { ["House"] = { ["Area"] = { -- INFO: /pzcreate: to start a polyzone creation, /pzadd to add a point in the polyzone, /pzfinish to finish the creation of the polyzone.
vector2(3275.9729003906, 5182.8525390625),vector2(3286.1896972656, 5196.1513671875),vector2(3288.8740234375, 5197.8774414063),vector2(3307.4431152344, 5200.8916015625),vector2(3333.015625, 5181.2436523438),vector2(3315.8989257813, 5158.84765625),vector2(3312.8894042969, 5160.7846679688),vector2(3309.7436523438, 5156.7666015625) }, ["Blip"] = { Coords =vector3(3305.22,5178.94,17.16) }, ["Settings"] = { visible =true, minZ =17.0, maxZ =37.0, }, ["Duration"] =2, -- INFO: Duration in minutes. ["Bucket"] =1, -- INFO: Use 0 if you don't want an exclusive area bucket. ["ViewDistance"] =100.0, -- INFO: View distance to see the zone if setted to be visible. ["Rewards"] = { -- INFO: You can add any types, names and amount of rewards as the reward function is open source and you can handle freely the function.
{type ="item", name ="bread", amount =5}, {type ="weapon", name ="WEAPON_PISTOL", amount =50}, {type ="money", name ="black_money", amount =1000} } } },
In order to create a zone properly, you must create a polyzone via PolyZone script.
/pzcreate: To start the creation of a zone.
/pzadd : To add points of a zone. (Better use zone corners for points)
/pzfinish : To finish the zone. After that, a text file will be generated in the same location where your server.cfg is located at.
Open Framework Functions
Functions = {TriggerCronTask=function(h,m) -- INFO: ESX Cron is used here. Change it if you're using something else.TriggerEvent('cron:runAt', h, m, StartCaptureTheArea)end, RewardPlayer = function(playerId, reward) -- INFO: In this function, you can handle any type of rewards the capturer will receive.
-- ESX EXAMPLEif reward.type =='item' thenlocal xPlayer = Config.Framework.GetPlayerFromId(playerId) xPlayer.addInventoryItem(reward.name, reward.amount)endend,GetPlayerGroup=function(playerId) -- INFO: This is used to avoid capturing being paused by friends -- ESX EXAMPLElocal xPlayer = Config.Framework.GetPlayerFromId(playerId)return xPlayer.job.nameend,SendNotificationToPlayer=function(playerId,text)-- ESX EXAMPLETriggerClientEvent('esx:showNotification', playerId, text)end,Announcement=function(text)-- ESX EXAMPLE (Notification)-- RECOMMENDATION: It would be better if you replace the notification with a chat message instead.TriggerClientEvent('esx:showNotification', -1, text)end,IsStaff=function(playerId)-- ESX EXAMPLElocal xPlayer = Config.Framework.GetPlayerFromId(playerId)if xPlayer.getGroup() ~='user' thenreturntrueendreturnfalseend,IsAllowedToStart=function(playerId)-- ESX EXAMPLElocal xPlayer = Config.Framework.GetPlayerFromId(playerId)if xPlayer.getGroup() =='superadmin' thenreturntrueendreturnfalseend }
We've added ESX functionality as it's the most popular framework right now, but you can use any framework and make the script work.
If you need extra assistance, please don't hesitate to open a ticket on my Discord Server.