Not able to run command inside plugin - Printable Version +- Cuberite Forum (https://forum.cuberite.org) +-- Forum: Plugins (https://forum.cuberite.org/forum-1.html) +--- Forum: Plugin Discussion (https://forum.cuberite.org/forum-8.html) +--- Thread: Not able to run command inside plugin (/thread-3337.html) Pages:
1
2
|
Not able to run command inside plugin - mueller_minki - 02-18-2021 Hello, I'm writing a plugin and no matter what I try, i allways have "insufficient privileges "/setblock"". Can anyone help me with that? Here is the source: Code: PLUGIN = nil Code: [12:55:56] Player muellerCAM3 is executing command "/setblock" in world "world" at world age 237160. RE: Not able to run command inside plugin - NiLSPACE - 02-18-2021 That's because you haven't given yourself more permissions than the basics that Cuberite has by default. You can make yourself admin using 'op muellerCAM3' in the console. RE: Not able to run command inside plugin - mueller_minki - 02-18-2021 (02-18-2021, 10:42 PM)NiLSPACE Wrote: That's because you haven't given yourself more permissions than the basics that Cuberite has by default. You can make yourself admin using 'op muellerCAM3' in the console. Thats the problem. I already did that. Didn't work. I even tried making a new group using the webadmin. Worked for all plugins except mine. RE: Not able to run command inside plugin - NiLSPACE - 02-18-2021 Could you show screenshots from the 'Player Ranks', 'Ranks' and 'Permissions' pages in the webadmin? RE: Not able to run command inside plugin - mueller_minki - 02-18-2021 Ok, got it fixed now. something was messed up with my database. But now there is a new problem: SetBlock wants a Vector3 and idk what that even is and how to make 3 strings into 1 Vector3. RE: Not able to run command inside plugin - mueller_minki - 02-18-2021 Ok, this is what I came up with but it doesn't work: outVector3 = {x = 0, y = 0, z = 0} outVector3.x = tonumber(Split[2]) outVector3.y = tonumber(Split[3]) outVector3.z = tonumber(Split[4]) Player:GetWorld():SetBlock(outVector3, Split[5]) It gives this error: argument #2 is 'table'; 'Vector3<int>' expected. RE: Not able to run command inside plugin - NiLSPACE - 02-18-2021 Vector3i is a class which we use to bundle up X, Y and Z coordinates. You can convert the 3 strings using this: Vector3i(tonumber(string1), tonumber(string2), tonumber(string3)) RE: Not able to run command inside plugin - mueller_minki - 02-18-2021 Ok, idk why but it wants BlockType to be a number? Why? Code: error in function 'SetBlock'. Here is the plugin as far as I am right now: Code: PLUGIN = nil RE: Not able to run command inside plugin - NiLSPACE - 02-18-2021 cWorld:SetBlock doesn't automatically translate strings to the blocktype and meta. You could take WorldEdit's GetBlockTypeMeta function to do this: https://github.com/cuberite/WorldEdit/blob/master/functions.lua#L12 local type, meta = GetBlockTypeMeta(Split[5]) Player:GetWorld():SetBlock(outVector, type, meta) RE: Not able to run command inside plugin - 12xx12 - 02-19-2021 We're still using the numeric identification for blocks which was removed by mojang in 1.13. At this point you'll have to use a number. We're working on it Edit: isn't the C++ function to do this exported to lua? I know there is one in the code |