i need a way to have my plugin fill
#3
Alland20201 Wrote:Thanks! tho i need a way to fill a 3x3 plattform. do u know how without some messy code

You could use a loop for both x and z coordinate to do that like this:
function PlacePlatformAt(world, middlepoint, radius)
	for x = -radius, radius do
		for z = -radius, radius do
			world:FastSetBlock(middlepoint:addedXZ(x,z), E_BLOCK_BEDROCK, 0)
		end
	end
end


You could also use the cBlockArea api which is more performant:
function PlacePlatformAt(world, middlepoint, radius)
	local ba = cBlockArea()
	ba:Create(radius * 2 + 1, 1, radius * 2 + 1, cBlockArea.baTypes + cBlockArea.baMetas)
	ba:Fill(cBlockArea.baTypes + cBlockArea.baMetas, E_BLOCK_BEDROCK, 0, 0, 0);
	ba:Write(world, middlepoint:addedXZ(-radius, -radius), cBlockArea.baTypes + cBlockArea.baMetas);
end
Reply
Thanks given by:


Messages In This Thread
RE: i need a way to have my plugin fill - by NiLSPACE - 10-12-2024, 07:29 PM



Users browsing this thread: 4 Guest(s)