02-25-2017, 03:56 AM
I'm new to lua, and I was wondering if there was any way to place a specific block in a specific place after the block previously in that place was broken?
Placing blocks in lua
|
02-25-2017, 03:56 AM
I'm new to lua, and I was wondering if there was any way to place a specific block in a specific place after the block previously in that place was broken?
02-25-2017, 06:02 AM
(This post was last modified: 02-25-2017, 06:08 AM by Seadragon91.)
A plugin can be written to do that.
There is a hook named HOOK_PLAYER_BROKEN_BLOCK with that you can detect what block and where it has been broken. Then you can place a new one immediately or after a specific time. That should be easy, if you have any problems / questions just ask Thanks given by: yoboykai
02-25-2017, 09:32 AM
I'm still a little confused about hoe to place a block with lua, as I said I'm very new to lua and developing plugins.
02-25-2017, 06:18 PM
(This post was last modified: 02-25-2017, 06:21 PM by Seadragon91.)
The function that will be called for the hook, contains the param Player. With it you can get the world the player is in:
Code: Player:GetWorld():SetBlock(Player:GetPosX(), Player:GetPosY(), Player:GetPosZ(), E_BLOCK_CAKE, 0) API: Player World World:SetBlock() E_BLOCK_CAKE If you want I could write a example plugin, that would place a block if a player breaks a block. Thanks given by: yoboykai
If you could it would be much appreciated.
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 Code: function Initialize(a_Plugin) Thanks given by: yoboykai
02-28-2017, 10:11 AM
Thank you, this clears so much up for me.
03-12-2017, 09:45 AM
Sorry if i'm annoying you but, how would I change all blocks of stone for example to a different block after a set amount of time, and repeatedly to this?
03-12-2017, 06:20 PM
Do you know the area where you want to replace the blocks?
03-13-2017, 04:30 AM
Yes, but there will be multiple separate areas and new areas being added.
|
« Next Oldest | Next Newest »
|