Problem matching vehicles

Am trying to do a simple vehicle match from a list with the current vehicle am in, but for some reason the current vehicle hash dose not match any of the vehicle hashs I have in my list.

has anyone got any ideas here the code below, thanks

local vehicles = {
      { hash="456714581" }, -- policet
      { hash="-475225213" }, -- police custom
      { hash="2046537925" }, -- police original
      { hash="-1627000575" }, -- police2
      { hash="1912215274" }, -- police3
      { hash="-1973172295" }, -- police4
      { hash="741586030" }, -- pranger
      { hash="-1683328900" }, -- sheriff
      { hash="1922257928" }, -- sheriff2
      { hash="-34623805" }, -- policeb
      { hash="1127131465" }, -- fbi
      { hash="-1647941228" } -- fbi2
function VehicleList()
    local get_ped = GetPlayerPed(-1)
    local currentVehicle = GetVehiclePedIsIn(get_ped)
    local model = GetEntityModel(currentVehicle)
    local currentHash = GetHashKey(model, _r)

    for i, pos in pairs(vehicles) do
      hash = pos.hash

    if currentHash == hash then -- if match found then return tree
      return true
  return false

currentVehicle is the id of the car, not its model hash

Try to use this

I updated the question code to current source but problem am having is that the IF THEN match code is never called even when there a match found,

You have to loop it or trigger it, otherwise it won’t run

I did

for i, pos in pairs(vehicles) do
hash = pos.hash

and it triggered soon as a person enters any car