You want to do something like this to get the actual name
local aheadVehHash = GetEntityModel(aheadVeh)
local aheadVehName = GetDisplayNameFromVehicleModel(aheadVehHash)
local aheadVehNameText = GetLabelText(aheadVehName)
I know sorry, i just resume the situation, here example of code where i’m using it :
function tvRP.getNearestVehicle(radius)
local x,y,z = tvRP.getPosition()
local ped = GetPlayerPed(-1)
if IsPedSittingInAnyVehicle(ped) then
return GetVehiclePedIsIn(ped, true)
else
-- flags used:
--- 8192: boat
--- 4096: helicos
--- 4,2,1: cars (with police)
local veh = GetClosestVehicle(x+0.0001,y+0.0001,z+0.0001, radius+0.0001, 0, 8192+4096+4+2+1) -- boats, helicos
if not IsEntityAVehicle(veh) then veh = GetClosestVehicle(x+0.0001,y+0.0001,z+0.0001, radius+0.0001, 0, 4+2+1) end -- cars
return veh
end
end
The function GetLabelText doesn’t match with what i need
I need to retrive the exact model name of cogcabrio with the function GetDisplayNameFromVehicleModel, but i get cogcabri, one letter is missing, and its a problem for function i’m using
The function getlabeltext, give me the total display name, like “Cognoscienti Cabro”, i dont need that ^^