Placing blocks in lua
#6
1) Create a folder named PlaceBlocks inside of folder Plugins
2) Save the content into the file PlaceBlocks.lua
3) Add the plugin name to the section Plugins in settings.ini

Code:
function Initialize(a_Plugin)
    a_Plugin:SetName( "PlaceBlocks" )
    a_Plugin:SetVersion( 1 )
    
    cPluginManager:AddHook(cPluginManager.HOOK_PLAYER_BROKEN_BLOCK, OnPlayerBrokenBlock)
    
    return true
end

function OnPlayerBrokenBlock(Player, BlockX, BlockY, BlockZ, BlockFace, BlockType, BlockMeta)
    if BlockType == E_BLOCK_GRASS then
        Player:GetWorld():SetBlock(BlockX, BlockY, BlockZ, E_BLOCK_STONE, 0)
    end
end
This plugin example replaces the grass blocks that the player breaks with an stone block.
Reply
Thanks given by:


Messages In This Thread
Placing blocks in lua - by yoboykai - 02-25-2017, 03:56 AM
RE: Placing blocks in lua - by Seadragon91 - 02-25-2017, 06:02 AM
RE: Placing blocks in lua - by yoboykai - 02-25-2017, 09:32 AM
RE: Placing blocks in lua - by Seadragon91 - 02-25-2017, 06:18 PM
RE: Placing blocks in lua - by yoboykai - 02-26-2017, 08:40 AM
RE: Placing blocks in lua - by Seadragon91 - 02-27-2017, 11:51 PM
RE: Placing blocks in lua - by yoboykai - 02-28-2017, 10:11 AM
RE: Placing blocks in lua - by yoboykai - 03-12-2017, 09:45 AM
RE: Placing blocks in lua - by NiLSPACE - 03-12-2017, 06:20 PM
RE: Placing blocks in lua - by yoboykai - 03-13-2017, 04:30 AM
RE: Placing blocks in lua - by NiLSPACE - 03-13-2017, 05:00 AM
RE: Placing blocks in lua - by yoboykai - 03-13-2017, 05:59 AM
RE: Placing blocks in lua - by ThuGie - 03-13-2017, 08:22 AM
RE: Placing blocks in lua - by yoboykai - 03-13-2017, 12:27 PM
RE: Placing blocks in lua - by xoft - 03-13-2017, 06:23 PM



Users browsing this thread: 2 Guest(s)