Despawn NPC ped in a range

I need a help to create a function that delete any NPC that enters a radius, this should be a simple code but i dont have any clues how do i get every ped that enters the radius.

i found this code that can help me but i dont know how do i get the ped

if pedX - 30 < X or pedY - 30 < Y  then
	-- Set ped as no longer needed for despawning
	local model = GetEntityModel(ped)
	SetEntityAsNoLongerNeeded(ped)
	SetModelAsNoLongerNeeded(model)
end

Hi,

You can get ped with : https://runtime.fivem.net/doc/natives/#_0xC33AB876A77F8164