callback DoWithBlockEntityAt why not work
#14
(08-30-2016, 01:47 AM)as123456 Wrote:
Code:
function OnPlayerRightClick(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX, CursorY, CursorZ)
    
    local world=Player:GetWorld()

    world:DoWithBlockEntityAt(BlockX, BlockY, BlockZ,
    function  (a_BlockEntity)
    LOG("a_BlockEntity")
    LOG(a_BlockEntity.GetBlockType)
    end
    
    )
    LOG("End")
    return false
end

You must start from "function Initialize(Plugin)" functon, register hooks in the function. Plugin starts from the "function Initialize(Plugin)" function.So, I post simple plugin template code:
Code:
function Initialize(Plugin)
 Plugin:SetName("Private")
 Plugin:SetVersion(20151231)
 LOG(MsgSuffix .. Plugin:GetName() .. " initialize...")

 -- Register hooks
 cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_RIGHT_CLICK, MyOnPlayerRightClick);

 -- Load the InfoReg shared library:
 dofile(cPluginManager:GetPluginsPath() .. "/InfoReg.lua")

 -- Nice message :)
 LOG(MsgSuffix .. "Initialized " .. Plugin:GetName() .. " v." .. Plugin:GetVersion())

 return true
end

function MyOnPlayerRightClick(..)
-- Do what you want

 return false;
end
Reply
Thanks given by:


Messages In This Thread
RE: callback DoWithBlockEntityAt why not work - by DrMasik - 08-30-2016, 01:55 AM



Users browsing this thread: 3 Guest(s)