ThymonA/TigoAntiCheat

[BUG] Objects

Richards0nd opened this issue · 1 comments

Describe the bug
Hello, I'm having a problem with deleting objects created by hackers ...
In the case when they are placing objects on the map, the anticheat is not removing them or anything like that ...
And this is only happening in this new version, because in the old version it worked correctly and without problems.
I was unable to identify the problem, but I believe it is in the part of looking for the list of objects that are on the blacklist.

Expected behavior
It was for him to delete the object created by the hack, or even to let it spawn.

Screenshots
image

I did several tests here, none of them or TigoAntiCheat managed to delete the props created ...

You can use the old code that I had, which worked correctly.
If you want to implement it, here it is:

function ReqAndDelete(object, detach)
	if DoesEntityExist(object) then
		NetworkRequestControlOfEntity(object)
		while not NetworkHasControlOfEntity(object) do
			Citizen.Wait(1)
		end
		if detach then
			DetachEntity(object, 0, false)
		end
		SetEntityCollision(object, false, false)
		SetEntityAlpha(object, 0.0, true)
		SetEntityAsMissionEntity(object, true, true)
		SetEntityAsNoLongerNeeded(object)
		DeleteEntity(object)
	end
end

Citizen.CreateThread(function()
	while true do
		Citizen.Wait(500)
		local ped = PlayerPedId()
		local handle, object = FindFirstObject()
		local finished = false
		repeat
			Wait(1)
			if IsEntityAttached(object) and DoesEntityExist(object) then
				if GetEntityModel(object) == GetHashKey("prop_acc_guitar_01") then
					ReqAndDelete(object, true)
				end
			end
			for i=1,#Config.Objects do
				if GetEntityModel(object) == GetHashKey(Config.Objects[i]) then
					ReqAndDelete(object, false)
				end
			end
			finished, object = FindNextObject(handle)
		until not finished
		EndFindObject(handle)
	end
end)