Hey all,

I’am struggling with the following issue:
On a client side I create Ped and Vehicle entities for a mission, however I have to handle the situation when a player disconnects or crashes during a mission. Without any handling, the network entities will be stuck forever.

I’ve handled this by requesting all clients to try to set the entities as no longer needed with:
SetEntityAsNoLongerNeeded()

I only do this on the client that has control of the entity using:

for i = 1, #sHeistPeds do
	local LocalHeistPed = NetworkGetEntityFromNetworkId(sHeistPeds[i])
	if NetworkHasControlOfEntity(LocalHeistPed) then
		print("Local Entity ID: "..LocalHeistEntity)	
		SetEntityAsNoLongerNeeded(LocalHeistPed)
	end
end

While testing this, I do see logging on one of the players who is still in the server, however the SetEntityAsNoLongerNeeded function is not doing anything (the Ped’s remain frozen and don’t despawn).

If however I use:
DeleteEntity(LocalHeistEntity)
They do get deleted.

Does anyone know why SetEntityAsNoLongerNeeded is not working? Deleting of the Peds is rather aggressive, I’d like the deletion to be handled more smoothly (engine determines when to delete).

The entities are created as Networked = True, MissionEntity = true using:
CreatePedInsideVehicle(HeistCops[Index].Vehicle, 26, GetHashKey( "s_m_y_cop_01" ), -1, true, true)

Thanks in advance

Extra info: I’am not using OneSync

anyone?

No one? :upside_down_face:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.