[Release] [Standalone] Target Tracking

How to add Target in ATM Can someone help me? I don’t understand :sob:

This is an example from my script that I use for bank and atm.

Citizen.CreateThread(function()
local atm = {
-870868698,
-1126237515,
-1364697528,
506770882,
}
exports[“bt-target”]:AddTargetModel(atm, {
options = {
{
event = “banking:atm”,
icon = “fas fa-piggy-bank”,
label = “Bankomat”,
},
},
job = {“all”},
distance = 2.5
})
end)

RegisterNetEvent(“banking:atm”)
AddEventHandler(“banking:atm”, function()
openPlayersBank(‘atm’)
end)

2 Likes

Is there a posibility to trigger event with variables? like kamkus_methjob(something)

Here for now

Allows passing on arguments for events. In the example for banking, I pass the model (hash) and also the object to a banking event. Still fleshing it out a bit, but it works for the purpose I need it for (getting specific entity you are interacting with).

To Trigger:

options = {
            {
                event = "banking:atm",
                icon = "fas fa-piggy-bank",
                label = "Use ATM",
                args = true,
            },
            {
                event = "banking:hack",
                icon = "fas fa-piggy-bank",
                label = "Hack ATM",
                args = false,
            },
        },

Decision on whether to just trigger event or pass all data as args

RegisterNUICallback('selectTarget', function(data, cb)
    SetNuiFocus(false, false)
    success = false
    targetActive = false

    if data.event.args then   
        TriggerEvent(data.event.event, data) 
    else
        TriggerEvent(data.event.event)
    end
end)
RegisterNetEvent("banking:atm")
AddEventHandler("banking:atm", function(data)
    TriggerEvent("bank:interact", data) -- Banking Event
end)

Some JS and few other changes in the fork:

Whoever wants to target any vehicle without making a list with all the cars models, here is an example.

Citizen.CreateThread(function()
  while true do
    Wait(10)
    if not IsPedInAnyVehicle(playerPed) and (GetGameTimer() - GUI.Time) > 1000 then
      local playerPed = PlayerPedId()
      local position = GetEntityCoords(playerPed)
      local vehicle = GetClosestVehicle(position['x'], position['y'], position['z'], 5.001, 0, 70)
      local getmodel = GetEntityModel(vehicle)
      local model =  {
        getmodel
      }
      exports["bt-target"]:AddTargetModel(model, {
          options = {
              {
                  event = "v-trunk:open",
                  icon = "fas fa-truck-loading",
                  label = "Open Trunk",
              },
          },
          job = {"all"},
          distance = 2.5
      })
      GUI.Time = GetGameTimer()
    else
      Citizen.Wait(1500)
    end
  end
end)
1 Like

Anyone can help me with AddCircleZone. I have problem with targetoptions.

Citizen.CreateThread(function()

exports["bt-target"]:AddCircleZone("da", vector3(-533.25, 5538.94, 64.77), 0.82, {

    name = "da",

    useZ=true,

    debugPoly=true,

    options = {

        {

            event = "pickup:bike",

            icon = "fas fa-bicycle",

            label = "Uzmi Bicikl",

        },

    },

    job = {"all"},

    distance = 1.5

})

end)

My ATM Works Here:

Citizen.CreateThread(function()
	AddBoxZone("ATM", vector3(-204.019, -861.009, 29.271), 0.4, 0.6, {
		name="ATM",
		heading=21,
		debugPoly=false,
		minZ=29.27,
		maxZ=30.99
    },{
		options = {
            {
                event = "balance",
                icon = "fas fa-piggy-bank",
                label = "Use ATM",
            },
		},
        job = {"all"},
        distance = 1.5
    })
end)

With this trigger.

RegisterNetEvent("balance")
AddEventHandler("balance", function()
        TriggerEvent('luke_atm:ATMCheck')
end)

That works. ^^^^^

But this does not, Can i use the same trigger for two different functions? I am trying to use the same event for a bank booth, and for an ATM using the same trigger/event.

Not to sure where i am going wrong, unlesss its because im using the same event? do i need to create two different events for each section? - i tried and it would not work either.

Citizen.CreateThread(function()
	AddBoxZone("BankCheck", vector3(-352.000, -50.260, 49.280), 0.7, 6.0, {
		name="BankCheck",
		heading=160.83,
		debugPoly=true,
		minZ=47.50,
		maxZ=50.50
    },{
		options = {
            {
                event = "balance",
                icon = "fas fa-piggy-bank",
                label = "Use Bank",
            },
		},
        job = {"all"},
        distance = 2.5
    })
end)

The code above is NOT working, it will pull up BT-target but not trigger the event. But the first code posted in the begginning of the post, will trigger that same event and work fully, so i dont see why my bankbooth is not working???

If I want to select all peds to sell drugs for example, how the thread looks like? because i don’t understand how to do it.

i get an error saying No export AddZoneBox in bt-target

The correct export is AddBoxZone, not AddZoneBox

yeah sorry thats what i meant, no such export AddBoxZone

Use this:
exports[‘bt-target’]:AddBoxZone


Hey, I’ve been trying to fix this for couple hours now. Everytime a player joins it doesn’t get their job (After restarting the script everything functions until you leave and rejoin). I tried adding in the config
Config.NonEsxJob = function()
local PlayerJob = {
name = mechanic
}
return PlayerJob
end
But didn’t manage to get it to work.

1 Like

Hey did you ever get it working with ESX_SIT? if so are you able to post a link to your version of ESX_SIT please?

I’m having a script error I cannot figure out. @bt-target/client/main.lua:141: bad argument #1 to ‘pairs’ (table expected, got nil).

Citizen.CreateThread(function()
    AddBoxZone("PoliceDuty", vector3(441.79, -982.07, 30.69), 0.4, 0.6, {
    name="PoliceDuty",
    heading=91,
    debugPoly=false,
    minZ=30.79,
    maxZ=30.99
    }, {
        options = {
            {
                event = "signon",
                icon = "far fa-clipboard",
                label = "Sign On",
                job = {"police", "ambulance", "mechanic"},
            },
            {
                event = "signoff",
                icon = "far fa-clipboard",
                label = "Sign Off",
                job = {"police", "ambulance", "mechanic"},
            },
        },
        distance = 1.5
    })
end)

I have this in the bt-target client folder because using the exports caused even more issues. I do have my RegisterNetEvents set up as well just underneath that code to trigger the event needed. Any help is appreciated.

1 Like

Check my github page :slight_smile:

Do you have bt-target for trunk?

what inventory is this?

Hi… Dont work for me…wwwwwwwwwwwww

1 Like

How to put this work with trunk cars ?

1 Like