04-24-2014, 07:26 AM
Hi,
How are you intercepting commands? When you register the command (using cPluginManager:BindCommand, http://mc-server.xoft.cz/LuaAPI/cPluginM...#functions or using Info.lua file) you give it a handler function, that handler function receives two parameters, the text that the user has sent (split into individual words into a table of strings) and the cPlayer object for the player who sent the command. So a typical command handler does something like this:
How are you intercepting commands? When you register the command (using cPluginManager:BindCommand, http://mc-server.xoft.cz/LuaAPI/cPluginM...#functions or using Info.lua file) you give it a handler function, that handler function receives two parameters, the text that the user has sent (split into individual words into a table of strings) and the cPlayer object for the player who sent the command. So a typical command handler does something like this:
function HandleCmdSomething(a_Split, a_Player) -- a_Split is the command, split into words; access like a_Split[1], a_Split[2] etc. -- a_Player is the cPlayer object of the player who sent the command -- Do something command-related -- Notify the player that the command has been done successfully: a_Player:SendMessage(cCompositeChat("Success!", mtInfo)) -- Here's your cPlayer object being used return true end