02-27-2017, 11:51 PM
(This post was last modified: 02-27-2017, 11:52 PM by Seadragon91.)
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
This plugin example replaces the grass blocks that the player breaks with an stone block.
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