theVehicle nesse caso é uma string. Não tem como usar getElementModel em uma string.
Tente isso:
function verPorte (thePlayer, cmd, name)
local alvo = findPlayer (thePlayer) -- Essa função não existe. Espero que vc tenha criado ela em outro lugar.
if (getPedOccupiedVehicle (thePlayer)) then
local id = getElementModel (getPedOccupiedVehicle (thePlayer))
if (id == 596) then
if (name and getElementData (alvo, "porte") == true) then
outputChatBox ("O(a) "..getPlayerName (alvo).."#FFFFFF possui um porte de arma válido.", thePlayer, 255, 255, 255, true)
else
outputChatBox ("O(a) "..getPlayerName (alvo).."#FFFFFF não possui um porte de arma valido.", thePlayer, 255, 255, 255, true)
end
else
outputChatBox ("Você não está em uma viatura policial.", thePlayer, 255, 255, 255)
end
else
outputChatBox ("Você não está em um veículo.", thePlayer, 255, 255, 255)
end
end
addCommandHandler ("vporte", verPorte)