TTT body found

Is there a way to find out if all the bodes were founded ?
I think It has to do something with this v:GetNWBool(“body_found”, false), but I don’t know how to use it.
I am thinking that I should add it in a loop but how I did it didn’t worked.

Try this?

[LUA]
local deadplayers = 0
local foundbodies = 0

local function CheckAllBodiesFound()

for k, v in pairs( player.GetAll() ) do
	if !v:IsSpec() and (not v:Alive()) then
		foundbodies = foundbodies + 1
		if v:GetNWBool( "body_found" ) then
			foundbodies = foundbodies + 1
		end	
	end
end

if deadplayers ~= foundbodies then 
	return false
else
	return true
end

end
[/LUA]

So how would I do to check if all the dead players have been found or not ?
I want to make an if and check if all the dead player have been found.
Right not it just checks if there is a found body.

[LUA]if CheckAllBodiesFound() then
– doyathing
end [/LUA]

It’s not working.
Even if I found only one body and another 3 players are dead it still does that and it should happen only if all the bodies are found.

Sorry, it’s 3 am here.
Here you go, it takes into account if there are no dead players too:
[LUA]local function CheckAllBodies()

local deadplayers = 0
local foundbodies = 0


table.foreach( player.GetAll(), function( k, v )
	
	if not v:Alive() then
	deadplayers = deadplayers + 1
	end
		
	if v:GetNWBool( "body_found" ) then
		foundbodies = foundbodies + 1
	end	
	
end)

if deadplayers == foundbodies and deadplayers ~= 0 then 
	return true
else
	return false
end

end[/LUA]

now you can just do

[LUA]
if CheckAllBodies() then
print(“returned true”)
else
print(“returned false”)
end
[/LUA]

-snip-

That worked, thank you very much.