Cuberite Forum
Class cGroup - 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: Class cGroup (/thread-804.html)



Class cGroup - NiLSPACE - 02-15-2013

is cGroup completly up to date on the wiki? becouse i can't find Group:GetName() in the source code


RE: Class cGroup - xoft - 02-15-2013

No, it's not.

The easiest way to check out the API is to temporarily enable the Debuggers plugin, it will output all available API functions into a file, API.txt, next to the MCServer.exe executable.


RE: Class cGroup - NiLSPACE - 02-15-2013

thanks i now have a list of all the API functions Smile however i don't know how to use most of those functionsTongue
i am trying to make a chat plugin so you can see your group and i have this code:

	Server:SendMessage( Group:GetColor() .. "[" .. Group:GetName() .. "]" .. Player:GetColor() .. Player:GetName() .. ": " .. cChatColor.LightGray .. Message )

howerver i get this error all the time:
Code:
LUA: Plugins/Test/main.lua:17: attempt to index global 'Group' (a nil value)
Error in plugin chat calling function OnChat()



RE: Class cGroup - xoft - 02-15-2013

1, A player may be a member of multiple groups, so this idea's not gonna work at all
2, What is Group in your code, is it a variable? because it definitely isn't a class name. The Lua error is telling you basically that you're using an undefined thing called "Group"
3, To see parameters for API functions, have a look at the bottom of Bindings.cpp file, there's a huuuge tolua_AllToLua_open() function that glues Lua to C++, find your class and function there and have a look at how it's glued. For example, cCraftingRecipe:GetIngredient() is glued in tolua_AllToLua_cCraftingRecipe_GetIngredient00() function, if you look that one up, you'll see that it takes one "const cCraftingRecipe" parameter (that's the Lua's hidden first parameter, denoted by using a colon instead of a dot), two number parameters and nothing more, it calls cCraftingRecipe's GetIngredient C++ function and then returns one result, "cItem".


RE: Class cGroup - FakeTruth - 02-15-2013

You could use the first group a player is in and prefix that to the chat messages