Closed benzon closed 3 years ago
Currently only polyzone is supported, will be adding support for the rest some time soon.
With this version, you must create the zone from your script:
local polyZone = PolyZone:Create(points,{
name="test_poly",
minZ=minZ,
maxZ=maxZ,
debugGrid=true,
gridDivisions=25
})
We then create a set of target options for this polyzone:
onInteract = function(targetName,optionName,vars,entityHit)
print("Interacted with ",targetName,optionName)
end
local targetOptions = {
name = "test_target",
label = "Test Target",
icon = "fas fa-home",
inside = false,
onInteract = onInteract,
options = {
{
name = "test_option",
label = "Test Option"
}
}
}
When the AddPolyZone export is called, it will pass back a function:
local setInside = exports["fivem-target"]:AddPolyZone(targetOptions)
This function is responsible for allowing fivem-target to know whether the player is inside the polyzone, and whether or not this target can be interacted with via the menu. We call it any time the player has entered the polyzone:
polyZone:onPointInOut(PolyZone.getPlayerPosition,setInside)
I'm aware the system is not as straightforward as the original bt-target, but it was the most efficient way I could think of to allow the calling script access to the polyzones methods.
Okay - it's always about what is most efficient and performance friendly no doubt
Could you provice more info on how to work with the diffent poly zones ex.
PolyZone CircleZone BoxZone EntityZone ComboZone
Is the ones im thinking about more specific