LukeWasTakenn/luke_garages

ped interaction problem

Closed this issue · 9 comments

Hello ,
I noticed a problem that I can't solve.
I declared several garages in the configuration, here is the configuration:


Config.Garages = {
    {
        label = 'Legion Garage',
        type = 'car', -- car, boat or aircraft
        pedCoords = vector4(215.90, -808.87, 29.74, 248.0), -- The Ped MUST be inside the PolyZone
        zone = {name = 'legion', x = 228.68, y = -789.15, z = 30.59, l = 52.4, w = 39.6, h = 340, minZ = 28.99, maxZ = 32.99},
        spawns = {
            vector4(206.25, -801.21, 31.00, 250.47),
            vector4(206.25, -801.21, 31.00, 250.47),
            vector4(208.72, -796.45, 30.95, 246.74),
            vector4(210.89, -791.42, 30.90, 248.02),
            vector4(216.12, -801.68, 30.80, 68.72),
            vector4(218.21, -796.79, 30.77, 68.80),
            vector4(219.76, -791.47, 30.76, 69.89),
            vector4(221.37, -786.53, 30.78, 70.72),
            vector4(212.52, -783.46, 30.89, 248.63),
        }
    },
    {
        label = 'Americano Way Garage',
        type = 'car',
        pedCoords = vector4(-1651.83, 63.90, 61.86, 338.03),
        zone = {name = 'americano', x = -1682.74, y = 60.93, z = 63.5, l = 59.6, w = 60.6, h = 329, minZ = 61.15, maxZ = 68.35},
        spawns = {
            vector4(-1660.57, 75.52, 63.20, 170.90),
            vector4(-1666.24, 79.84, 63.45, 171.92),
            vector4(-1671.97, 84.59, 63.83, 169.94),
            vector4(-1662.57, 57.99, 62.90, 293.91),
            vector4(-1664.75, 60.63, 63.05, 292.60),
            vector4(-1667.53, 62.90, 63.21, 291.82),
        }
    },
    {
        label = 'Route 68 Garage',
        type = 'car',
        pedCoords = vector4(587.23, 2723.50, 41.13, 7.85),
        zone = {name = 'route68', x = 573.19, y = 2727.17, z = 42.06, l = 22.4, w = 51.2, h = 4, minZ = 41.08, maxZ = 45.08},
        spawns = {
            vector4(584.51, 2721.56, 41.88, 3.59),
            vector4(581.14, 2721.32, 41.88, 3.99),
            vector4(578.15, 2720.59, 41.88, 4.65),
            vector4(574.86, 2721.09, 41.88, 4.85),
            vector4(572.01, 2720.28, 41.88, 5.40),
            vector4(568.78, 2720.25, 41.88, 5.15),
            vector4(565.86, 2719.79, 41.88, 3.42),
            vector4(562.68, 2719.95, 41.88, 3.98),
            vector4(559.54, 2719.52, 41.88, 3.45),
        }
    },
    {
        label = 'Paleto Bay Garage',
        type = 'car',
        pedCoords = vector4(140.62, 6613.02, 31.06, 183.37),
        zone = {name = 'paleto', x = 152.63, y = 6600.21, z = 30.84, l = 28.2, w = 27.2, h = 0, minZ = 30.84, maxZ = 34.84},
        spawns = {
            vector4(145.55, 6601.92, 31.67, 357.80),
            vector4(150.56, 6597.71, 31.67, 359.00),
            vector4(155.55, 6592.92, 31.67, 359.57),
            vector4(145.90, 6613.97, 31.64, 0.60),
            vector4(151.04, 6609.26, 31.69, 357.50),
            vector4(155.84, 6602.45, 31.86, 0.47),
        }
    },
    {
        label = 'Highway Pier Garage',
        type = 'boat',
        pedCoords = vector4(-3428.27, 967.34, 7.35, 269.47),
        zone = {name = 'pier', x = -3426.48, y =  968.89, z = 8.35, l = 31.2, w = 39.2, h = 0, minZ = nil, maxZ = nil},
        spawns = {
            vector4(-3444.37, 952.64, 1.02, 98.70),
            vector4(-3441.02, 965.30, 0.17, 87.18),
        }
    },
    {
        label = 'LSIA Garage',
        type = 'aircraft',
        pedCoords = vector4(-941.43, -2954.87, 12.95, 151.00),
        zone = {name = 'lsia', x = -968.31, y = -2992.47, z = 13.95, l = 94.4, w = 84.6, h = 330, minZ = nil, maxZ = nil},
        spawns = {
            vector4(-958.57, 2987.20, 13.95, 58.19),
            vector4(-971.89, 3008.83, 13.95, 59.47),
            vector4(-984.30, 3025.04, 13.95, 58.52),
        }
    },
    {
        label = 'MRPD Police Garage',
        type = 'car',
        job = 'police',
        pedCoords = vector4(450.6633, -1027.3324, 27.5732, 5.1321),
        zone = {name = 'mrpd', x = 439.36, y= -1021.04, z = 28.83, l = 20, w = 40, h = 0, minZ = 27.03, maxZ = 31.03},
        spawns = {
            vector4(446.4181, -1026.2117, 28.2490, 357.9764),
            vector4(442.5637, -1025.5530, 28.2984, 1.7611),
            vector4(438.6664, -1027.0088, 28.3936, 3.1104),
            vector4(434.8707, -1026.6675, 28.4554, 3.9030),
            vector4(431.6170, -1026.7904, 28.5088, 0.9789),
            vector4(427.3045, -1027.6506, 28.5950, 5.8251)
        }
    },
    {
        label = 'Pillbox Ambulance Garage',
        type = 'car',
        job = 'ambulance',
        pedCoords = vector4(319.3737, -559.4569, 27.7438, 21.0252),
        zone = {name = 'pillbox', x = 325.59, y = -549.27, z = 28.74, l = 25, w = 25, h = 0, minZ = 27.74, maxZ = 30.74},
        spawns = {
            vector4(321.0445, 542.4713, 28.5142, 180.9354),
            vector4(323.8813, 542.8687, 28.5135, 181.6986),
            vector4(326.6019, 542.6691, 28.5133, 179.8377),
            vector4(329.3755, 542.5102, 28.5137, 179.7974),
            vector4(332.2085, 542.5237, 28.5125, 181.5656)
        }
    },
    {
        label = 'Cardealer Garage',
        type = 'car',
        job = 'cardealer',
        pedCoords = vector4(-13.02, -1111.47, 26.00, 70),
        zone = {name = 'cardealer', x = -14.50, y = -1102.10, z = 26.92, l = 30, w = 10, h = 340, minZ = 26.00, maxZ = 28.00},
        spawns = {
            vector4(-11.98, -1101.66, 26.5, 70.00),
            vector4(-12.81, -1104.66, 26.5, 70.00),
            vector4(-14.04, -1104.66, 26.5, 70.00)
        }
    },
    {
        label = 'Mechanic Garage',
        type = 'car',
        job = 'mechanic',
        pedCoords = vector4(-34.74, -1023.52, 27.80, 250),
        zone = {name = 'mechanic', x = -23.8, y = -1022.85, z = 28.88, l = 20, w = 15, h = 70, minZ = 28.00, maxZ = 32.00},
        spawns = {
            vector4(-26.85, -1026.86, 28.46, 160.0),
            vector4(-21.14, -1029.23, 28.36, 160.00),
            vector4(-23.9, -1028.04, 28.45, 160.00)
        }
    },
    {
        label = 'Unicorn Garage',
        type = 'car',
        job = 'unicorn',
        pedCoords = vector4(148.04, -1288.19, 28.2, 300),
        zone = {name = 'unicorn', x = 143.51, y = -1280.38, z = 29.24, l = 16, w = 13, h = 28.69, minZ = 28.00, maxZ = 32.00},
        spawns = {
            vector4(143.43, -1285.4, 28.9, 299.4),
            vector4(140.42, -1280.27, 28.9, 299.4),
            vector4(139.49, -1277.61, 28.88, 299.4)
        }
    },
    {
        label = 'Gouvernement Garage',
        type = 'car',
        job = 'gouv',
        pedCoords = vector4(-572.22, -149.52, 36.5, 219.95),
        zone = {name = 'gouv', x = -568.54, y = -158.03, z = 38.07, l = 25, w = 40, h = 20, minZ = 36.00, maxZ = 50},
        spawns = {
            vector4(-569.47, -147.22, 37.42, 201.39),
            vector4(-575.55, -149.42, 37.49, 201.92),
            vector4(-557.59, -161.94, 37.75, 291.53),
            vector4(-575.08, -169.49, 37.52, 291.6)
        }
    },
    {
        label = 'Ammunation Garage',
        type = 'car',
        job = 'ammunation',
        pedCoords = vector4(-7.38, -1120.21, 26.71, 186.68),
        zone = {name = 'ammunation', x = -7.14, y = -1114.79, z = 28.4, l = 18, w = 9, h = 161.98, minZ = 25.00, maxZ = 31.00},
        spawns = {
            vector4(-8.55, -1113.97, 28.36, 161.2),
            vector4(-8.55, -1113.97, 28.36, 161.2),
            vector4(-8.55, -1113.97, 28.36, 161.2)
        }
    },
    {
        label = 'Weazel Garage',
        type = 'car',
        job = 'weazel',
        pedCoords = vector4(-541.05, -878.47, 25.24, 188.5),
        zone = {name = 'weazel', x = -548.56, y = -887.13, z = 25.19, l = 41, w = 20, h = 89.09, minZ = 24.00, maxZ = 50},
        spawns = {
            vector4(-532.61, -891.4, 24.2, 182.43),
            vector4(-556.04, -890.94, 24.57, 181.58)
        }
    },
    {
        label = 'Rea Garage',
        type = 'car',
        job = 'rea',
        pedCoords = vector4(-174.91, -615.13, 31.42, 342.01),
        zone = {name = 'rea', x = -172.29, y = -607.75, z = 32.42, l = 14, w = 20, h = 250, minZ = 29, maxZ = 33.00},
        spawns = {
            vector4(-175.81, -608.6, 32, 248.35),
            vector4(-174.78, -604.34, 32, 248.35),
            vector4(-173.1, -600.59, 32, 248.35)
        }
    },
    {
        label = 'Lawyer Garage',
        type = 'car',
        job = 'lawyer',
        pedCoords = vector4(-1902.7, -557.61, 28.29, 233.52),
        zone = {name = 'lawyer', x = -1898.9, y = -558.75, z = 11.74, l = 14, w = 20, h = 319.69250, minZ = 10.74, maxZ = 14.00},
        spawns = {
            vector4(-1900.2, -560.37, 11.36, 320.81),
            vector4(-1900.2, -560.37, 11.36, 320.81),
            vector4(-1900.2, -560.37, 11.36, 320.81)
        }
    },
    {
        label = 'Bestbud Garage',
        type = 'car',
        job = 'bestbud',
        pedCoords = vector4(372.13, -827.05, 28.29, 89.4),
        zone = {name = 'bestbud', x = 369.45, y = -820.27, z = 28.87, l = 18, w = 8, h = 179.89, minZ = 28, maxZ = 30},
        spawns = {
            vector4(369.45, -820.27, 28.87, 179.89),
            vector4(369.45, -820.27, 28.87, 179.89),
            vector4(369.45, -820.27, 28.87, 179.89)
        }
    },
    {
        label = 'vigne Garage',
        type = 'car',
        job = 'vigne',
        pedCoords = vector4(-1924.45, 2051.31, 139, 262.69),
        zone = {name = 'vigne', x = -1920.74, y = 2046.72, z = 140.74, l = 25, w = 10, h = 166, minZ = 140, maxZ = 142},
        spawns = {
            vector4(-1920.35, 2052.81, 140.31, 254.14),
            vector4(-1921.28, 2044.15, 140.31, 255.55)
        }
    },
    {
        label = 'Brewer Garage',
        type = 'car',
        job = 'brewer',
        pedCoords = vector4(1947.27, 4629.87, 39.52, 24.4),
        zone = {name = 'brewer', x = 1947.27, y = 4629.87, z = 40.52, l = 10, w = 15, h = 24.4, minZ = 39.5, maxZ = 42},
        spawns = {
            vector4(1943.65, 4628.22, 40.44, 12.56),
            vector4(1943.65, 4628.22, 40.44, 12.56)
        }
    },
    {
        label = 'Cluckinbell Garage',
        type = 'car',
        job = 'cluckinbell',
        pedCoords = vector4(-61.89, 6272.82, 30.34, 33.08),
        zone = {name = 'cluckinbell', x = -63.93, y = 6277.03, z = 31.36, l = 10, w = 15, h = 112.52, minZ = 30.34, maxZ = 32.34},
        spawns = {
            vector4(-63.93, 6277.03, 31.36, 112.52),
            vector4(-63.93, 6277.03, 31.36, 112.52)
        }
    },
    {
        label = 'Farm Garage',
        type = 'car',
        job = 'farm',
        pedCoords = vector4(403.74, 6477.71, 27.96, 311.46),
        zone = {name = 'farm', x = 405.51, y = 6475.66, z = 28.81, l = 8, w = 9, h = 347.21, minZ = 28.39, maxZ = 30.34},
        spawns = {
            vector4(406.51, 6475.16, 28.39, 348.38),
            vector4(406.51, 6475.16, 28.39, 348.38)
        }
    },
    {
        label = 'Bakery Garage',
        type = 'car',
        job = 'bakery',
        pedCoords = vector4(-1262.63, -300.25, 36.14, 115.24),
        zone = {name = 'bakery', x = -1266.47, y = -297.49, z = 36.77, l = 18, w = 6, h = 207.93, minZ = 36.77, maxZ = 38.77},
        spawns = {
            vector4(-1266.47, -297.89, 36.77, 207.93),
            vector4(-1266.47, -297.89, 36.77, 207.93)
        }
    },
    {
        label = 'Recycling Garage',
        type = 'car',
        job = 'recycling',
        pedCoords = vector4(2342.4, 3148.39, 47.23, 33.25),
        zone = {name = 'recycling', x = 2343.55, y = 3153.21, z = 47.71, l = 16, w = 10, h = 115.39, minZ = 47.77, maxZ = 49.77},
        spawns = {
            vector4(2343.55, 3153.21, 47.71, 115.39),
            vector4(2343.55, 3153.21, 47.71, 115.39)
        }
    },
    {
        label = 'Raventbutchery Garage',
        type = 'car',
        job = 'ravenbutchery',
        pedCoords = vector4(954.54, -2180.72, 29.6, 87.72),
        zone = {name = 'ravenbutchery', x = 948.65, y = -2175.95, z = 30.79, l = 15, w = 12, h = 85.24, minZ = 30, maxZ = 32},
        spawns = {
            vector4(948.64, -2175.94, 30.79, 85.24),
            vector4(2343.55, 3153.21, 47.71, 115.39)
        }
    },
    {
        label = 'Tequilala Garage',
        type = 'car',
        job = 'tequilala',
        pedCoords = vector4(-551.02, 297.07, 82.05, 346.08),
        zone = {name = 'tequilala', x = -556.85, y = 301.39, z = 83.41, l = 18, w = 12, h = 264.67, minZ = 82, maxZ = 84},
        spawns = {
            vector4(-559.99, 301.84, 83.4, 264.29),
            vector4(-559.99, 301.84, 83.4, 264.29)
        }
    },
    {
        label = 'Tabac Garage',
        type = 'car',
        job = 'tabac',
        pedCoords = vector4(221.64, 369.66, 105.26, 91.1),
        zone = {name = 'tabac', x = 211.74, y = 381.99, z = 107.17, l = 26, w = 24, h = 257.8, minZ = 105, maxZ = 108},
        spawns = {
            vector4(213.56, 389.45, 107.09, 172.3),
            vector4(205.09, 377.93, 107.49, 345.91)
        }
    },
    {
        label = 'Atomburger Garage',
        type = 'car',
        job = 'atomburger',
        pedCoords = vector4(90.84, 298.47, 109.21, 336.17),
        zone = {name = 'atomburger', x = 97.58, y = 303.06, z = 110.25, l = 25, w = 15, h = 67.95, minZ = 109, maxZ = 111},
        spawns = {
            vector4(105.34, 302.86, 110.26, 160.69),
            vector4(95.68, 306.53, 110.25, 157.87)
        }
    },

In some cases and it is quite frequent I cannot interact with the PED.

I noticed that by removing the job parameter from the AddTargetModel function like this :

    exports['qtarget']:AddTargetModel({v.ped or Config.DefaultGaragePed}, {
        options = {
            {
                event = "luke_garages:GetOwnedVehicles",
                icon = "fas fa-warehouse",
                label = Locale('take_out_vehicle'),
                canInteract = function(entity)
                    hasChecked = false
                    if IsInsideZone('garage', entity) and not hasChecked then
                        hasChecked = true
                        return true
                    end
                end
            },
        },
        distance = 2.5,
    })

the problem does not occur.

I think a problem with qtarget but I'm not sure.

I thought of a workaround, which would be to show the PED only if the garages ped === player job.

But this remains a workaround that does not solve the problem.

Thank you for your answer

You can't interact with the ped because it requires you to have the job you set as job to do so

no no i can't interact with public garages

Does it just happen randomly? Cause that's not going to be easy to debug if there even is an issue

Yes it's totally random that's why I'm having trouble finding the origin of the problem.
But as I told you before, not passing the job to qtarget seems to solve the problem :/

Of course, that's not a solution.

But it reminds me of a problem with qtarget

It does sound like a qtarget issue, but I neve ran into anything similar while using it so I am not sure

Too bad, I will continue to look for where this problem could come from :/ Thank you for reading and answering me.

I'm leaving the issue open in case I find a fix.

Any updates on this?

No, I still have the same problem...

Even with your new version

As this issue has been open for some time now and no one else seems to have had this issue I will close it as I cannot reproduce this at all.

If you happen to get some more info on what may be causing it feel free to comment on this issue.