Awesome growing trees!
#2
To change the default Server behaviour of dropping leaf block you can try this:
PHP Code:
function TreePlugin:OnBlockDig( PacketData, Player ) local World = cRoot:Get():GetWorld() local X = PacketData.m_PosX local Y = PacketData.m_PosY local Z = PacketData.m_PosZ -- status 0 = started digging; 2 = block broken if(PacketData.m_Status == 2) then if(World:GetBlock(X,Y,Z) == E_BLOCK_LEAVES) then -- override default MCServer behaviour; 20% Chance of dropping saplings local Amount = math.random(1,10) if(Amount <= 2) then Amount = 1 else Amount = 0 end World:DigBlock(X, Y, Z, cItem(E_BLOCK_SAPLING, Amount)) return true end end -- false = allowed; true = disallowed return false end
greets,
Tybor
Reply
Thanks given by:


Messages In This Thread
Awesome growing trees! - by codename_B - 02-28-2011, 02:42 AM
RE: Awesome growing trees! - by Tybor - 02-28-2011, 03:41 AM
RE: Awesome growing trees! - by codename_B - 02-28-2011, 03:48 AM
RE: Awesome growing trees! - by Tybor - 02-28-2011, 03:52 AM
RE: Awesome growing trees! - by NiLSPACE - 07-09-2012, 08:19 PM



Users browsing this thread: 1 Guest(s)