bt-target icon indicating copy to clipboard operation
bt-target copied to clipboard

[Bug] Polyzone not working throws an error

Open benzon opened this issue 3 years ago • 4 comments

Got some issues with Polyzones it throws an error, since it can't work with the vector2 values, if i do vector3's or even add a min and max height, it dos not react either.

161775716154a868a8e7b7d40e8fa55c2bcb75b1c8

exports['bt-target']:AddPolyzone("Test", {vector2(733.60607910156, 658.37176513672), vector2(726.609375, 638.64202880859), vector2(646.35656738281, 668.22436523438), vector2(653.34967041016, 687.67864990234)}, {
		name="Test",
		debugPoly=true,
		}, {
			options = {
				{
					event = "signon",
					icon = "far fa-clipboard",
					label = "Sign On",
				},
			},
			job = {"all"},
			distance = 2.5
		})

benzon avatar Apr 07 '21 00:04 benzon

Same issue with creating "AddPolyzone". Still finding a way to fix it.

The issue is, bt-target cant find Zones[_].center with vector2 math

xDope7137 avatar Apr 17 '21 15:04 xDope7137

The issue is, bt-target cant find Zones[_].center with vector2 math

Polyzones don't have a center param so there is no vector for it to work with, the vector2 has nothing to do with this. This is going to either need an exception specific to polyzones or add an addition center param to them

LiamDormon avatar Apr 23 '21 17:04 LiamDormon

Hmm and how would you do that @Mojito-Fivem

benzon avatar Apr 23 '21 18:04 benzon

I think the easiest way to ammend this would be to add a center param to the AddPolyZone function like so

function AddPolyzone(name, center, points, options, targetoptions)
    Zones[name] = PolyZone:Create(points, options)
    Zones[name].targetoptions = targetoptions
    Zones[name].center = center
end

And then you can add an extra vector3 for the center of your PolyZone

exports["bt-target"]:AddPolyZone("ZoneName", vector3(0, 0, 0), points, options, {
    options = {
         {
              event = "some_event",
              icon = "fas fa-icon",
              label = "A Label"     
         }
    },
    jobs = {"all"},
    distance = 2.0,
}

If this works submit a PR to this repository or my maintained one.

LiamDormon avatar Apr 23 '21 20:04 LiamDormon