I want to make more than one weapon allowed in a zone (PROBLEM WITH FOR AND TABLE)

I have used polyzone to create the zones, but the problem comes when I add more than one weapon to the allowed weapons table, when I only have one weapon the script works correctly, but when I put more than one it stops working, does anyone know why? it is?

Config.lua

Settings = {}

Settings.Zones = {
    {
        name = "Cannabis",
        allowedWeapons = {
            "WEAPON_PISTOL",
            "WEAPON_PISTOL_MK2",
        },
    }
}

client.lua

local Cannabis = PolyZone:Create({
    vector2(-489.82, -1766.53),
    vector2(-507.92, -1762.84),
    vector2(-525.63, -1753.71),
    vector2(-638.49, -1669.42),
    vector2(-661.96, -1643.68),
    vector2(-622.69, -1589.12),
    vector2(-597.88, -1581.37),
    vector2(-576.93, -1583.83),
    vector2(-397.84, -1674.78),
    vector2(-429.4, -1756.9)
}, {
    name="cannabis",
    minZ=17.0,
    maxZ=36.0,
    debugGrid=true,
    gridDivisions=25
})

local insideCannabis = false
CreateThread(function()
    while true do
        SetCurrentPedWeapon(player,GetHashKey("WEAPON_UNARMED"),true)
        local plyPed = PlayerPedId()
        local coord = GetEntityCoords(plyPed)
        insideCannabis= Cannabis:isPointInside(coord)
        if insideCannabis then
            for k, v in pairs(Settings.Zones) do
                if v.name == "Cannabis" then
                    for i = 1, #v.allowedWeapons do
                        local weapon = v.allowedWeapons[i]
                        if HasPedGotWeapon(PlayerPedId(), GetHashKey(weapon), false) then
                            print("Esta dentro de la zona y tiene el arma")
                        else
                            SetCurrentPedWeapon(plyPed,GetHashKey("WEAPON_UNARMED"),true)
                        end
                    end
                end
            end
        end
        Citizen.Wait(1000)
    end
end)

Can you provide us any debug please?

what do you mean about debug? xd

The problem is that if I add more than one weapon, it checks the weapon that I have in my hand and the one that I have not yet taken out. What I want is for it to only verify the weapon at the moment I take it out, so that it is not verifying all the weapons in the table

Then you might want to use:
BOOL GET_CURRENT_PED_WEAPON(Ped ped, Hash* weaponHash, BOOL p2);
It return true or false if the ped have the correct hash in is hand

its not working with GetCurrentPedWeapon(plyPed, weapon, true). The problem is in the for loop, because it is checking all the weapons at the same time, and I want it to check only if the one that has been taken is inside that table.

local allowed = false
                    for i = 1, #v.allowedWeapons do
                        local weapon = v.allowedWeapons[i]
                        if HasPedGotWeapon(PlayerPedId(), GetHashKey(weapon), false) then
                            allowed = true
                        end
                    end

                    if allowed then
                        print("tiene el arma")
                    else
                        print("no tiene el arma")
                        SetCurrentPedWeapon(plyPed,GetHashKey("WEAPON_UNARMED"),true)
                    end