Check if Vehicle has any decal other than clan decals

basically i want something that does the opposite of DoesVehicleHaveDecal() which only returns true if the vehicle has a clan decal, i want a function to return false if the vehicle doesn’t have any decal in general and true if it does, or return an array of the decals the car has, that would help me with my carwash script to check if the vehicle needs to be washed or not …

You can find all GTA V natives here.

@Seenko what does that help me with? i’ve been using this native reference, what’s the difference between that one and the one i’ve been using ?

Does the game has a native function that can retrieve that type of data that you want (in your case an array of the decals in the vehicle/check for all types of decals)?

If the answer is yes then you search for it in the natives database and the coding should be pretty straight forward.

If the answer is no then you can’t do exactly what you need.

i mean, there’s a native function here that retrieves the decal wash level, i guess you can loop it so it retrieves the wash level for every single decal …

float GET_DECAL_WASH_LEVEL(int decal) // 323F647679A09103 054448EF 

but i can’t imagine that being a very fast response … plus it takes integers, on the native reference there’s an enum with all the decalTypes, but there are some that don’t say the integer associated …

Well, you want to use for a car wash script right? Why not just use:

float GET_VEHICLE_DIRT_LEVEL(Vehicle vehicle);

I believe you don’t want to use it because it probably does not take into account blood splatters?

AFAIK, the native directory by FiveM (the one you’re using) uses nativeDB to get some of the natives. It then adds it’s own natives and updates some of the names. So, using the FiveM documentation is recommended.

So, have you tried using other values for the second parameter in the DOES_VEHICLE_HAVE_DECAL? The documentation posits that it could be a “decal index” and 0 may be for clan decals. You should be able to test this using the ADD_DECAL native. If not, you could try and use the IS_DECAL_ALIVE native to check (I don’t know what it does but, it sounds like its checking to see if the decal is on a vehicle).

Edit: I’ve moved this to #development:scripts as this seems a more appropriate category

@Seenko yes that’s right, blood splatters are decals and that function returns a float from 0 to 15.0 that represents the dust the car has or how dirty it is, doesn’t take in account the snow, mud or blood

@Havoc i’ve tried passing the second parameter of that function as 0, 1, false and true and the result was always false

void WASH_DECALS_FROM_VEHICLE(Vehicle vehicle, float p1);

Sadly it does not return anything after “washing” tho… If i did return something that would be a way to check if any decal was washed just for 0.0001 :thinking: But it’s void :pensive:

@Seenko didn’t try, but according to one of my script release comments it doesn’t matter weather you parse 1.0 or 100.0

That comment suggests that the max value for that parameter is 1.0, you could try with a value lower than that (it’s a float so try 0.0001), either way that’s a void function and shouldn’t return anything and I don’t think there is a way to contravention that…

@Seenko that’s true …

And also, not all decal functions are related to vehicles, only the ones that mention it on it’s name, the decals could be blood splatters on the ground and walls.

then i guess i’m stuck am i right ? because either i’m really blind or i don’t see any function that might suggest that it checks for decals and takes a parameter Vehicle other than DoesVehicleHaveDecal() but we already know that doesn’t work

I’m sorry, I’m having a little trouble understanding what you mean here. Are you saying you passed 0/1 as the parameter? If so, try using the decal index. For example, of you wanted to check if the vehicle has mud on it, you would pass “splatters_mud” (1020) to it and check the return value.

Edit: @TheSparta if you’re wanting to clean a vehicle, couldn’t you just use the SET_VEHICLE_DIRT_LEVEL native?

dirt isn’t a decal, but i’ll try parsing the 2nd parameter of DoesVehicleHaveDecal() as a decal id now since i’m already home

He wants to know if the vehicle is actually dirty, not just using the dirt level. For example, you shoot a ped near the vehicle and the blood will splatter in the vehicle, that does not change the vehicle’s dirt lever but is actually a decal in the vehicle, so if he checks only for the dirt level the vehicle will come out as clean even tho there is blood dripping from its door.

splatterDecals = {
	1010, -- splatters_blood
	1015, -- splatters_blood_dir
	1017, -- splatters_blood_mist
	1020, -- splatters_mud
	1030, -- splatters_paint
	1040, -- splatters_water
	1050, -- splatters_water_hydrant
	1110  -- splatters_blood2
}
-- later --

function es_carwash_checkfordecals()
	vehiclehasdecals = false
	for i = 0, #splatterDecals do
		result = DoesVehicleHaveDecal(GetVehiclePedIsUsing(GetPlayerPed(-1)), splatterDecals[i])
		if result == true then
			vehiclehasdecals = true
		end
	end
	return vehiclehasdecals
end

--when key is pressed --

hasdecals = es_carwash_checkfordecals()
TriggerServerEvent('es_carwash:checkmoney', GetVehicleDirtLevel(GetVehiclePedIsUsing(GetPlayerPed(-1),false)), hasdecals)

this would work if the second parameter of DoesVehicleHaveDecal() was an index right ?