Not able to run command inside plugin
#8
Ok, idk why but it wants BlockType to be a number? Why?

Code:
error in function 'SetBlock'.
    argument #3 is 'string'; 'number' expected.
 
Here is the plugin as far as I am right now:

Code:
PLUGIN = nil

function Initialize(Plugin)
    Plugin:SetName("VanillaFill")
    Plugin:SetVersion(1)

    -- Hooks

    PLUGIN = Plugin -- NOTE: only needed if you want OnDisable() to use GetName() or something like that

    -- Command Bindings
    cPluginManager.BindCommand("/setblock", "vanillafill.setblock", setblock, " ~ Changes a block at X Y Z.");
--    cPluginManager.BindCommand("/fill", "vanillafill.fill", fill, " ~ Fills an area from X Y Z to X2 Y2 Z2.");

    LOG("Initialised " .. Plugin:GetName() .. " v." .. Plugin:GetVersion())
    return true
end

function OnDisable()
    LOG(PLUGIN:GetName() .. " is shutting down...")
end

function setblock(Split, Player)
    if (#Split ~= 5) then
        -- There was more or less than four arguments (excluding the "/explode" bit)
        -- Send the proper usage to the player and exit
        Player:SendMessage("Usage: /setblock X Y Z [blocktype]")
        return true
    end

    outVector3 = Vector3i(tonumber(Split[2]), tonumber(Split[3]), tonumber(Split[4]))

    Player:GetWorld():SetBlock(outVector3, Split[5])

    return true
end
Reply
Thanks given by: ErnestoSiz


Messages In This Thread
RE: Not able to run command inside plugin - by mueller_minki - 02-18-2021, 11:34 PM



Users browsing this thread: 2 Guest(s)