I need help making an event if a player is in a tunnel

Hi I’m trying to make it so if a player is in the braddock tunnel (the paleto/grapeseed one) it sends something in the console but I can’t get it to work
This is what I did but it doesn’t print anything when I’m in the tunnel and I run the command

RegisterCommand('tunnels', function()
local playerCoords = GetEntityCoords(PlayerPedId())
local zone = GetNameOfZone(playerCoords)

if zone == BRADT then
    print('in tunnel')
else
    return
end
end)

BRADT should be a string.

RegisterCommand('tunnels', function()
    local player = PlayerPedId()
    local playerCoords = GetEntityCoords(player)
    local zone = GetNameOfZone(playerCoords.x, playerCoords.y, playerCoords.z)

    if zone == "BRADT" then
        print('In tunnel')
    else
        print('Not in tunnel')
    end
end, false)

2 Likes