Lua hooks needed! - Printable Version +- Cuberite Forum (https://forum.cuberite.org) +-- Forum: Cuberite (https://forum.cuberite.org/forum-4.html) +--- Forum: Development (https://forum.cuberite.org/forum-13.html) +--- Thread: Lua hooks needed! (/thread-464.html) |
RE: Lua hooks needed! - NiLSPACE - 02-21-2013 yes i want to make a login system but i don't want the server admin first edit the Groups.ini before he can use it. I want a "plug and play" plugin RE: Lua hooks needed! - xoft - 02-21-2013 I have added a HOOK_EXECUTE_COMMAND hook that fires just before a command handler for the command or console command is executed. The command is already known to have been bound; the permissions haven't been checked yet though. Note that the same hook is called for both in-game commands and console commands. To tell them apart, use the first parameter, which is the cPlayer issuing the in-game command, or nil for console commands. RE: Lua hooks needed! - NiLSPACE - 02-22-2013 so i should do something like this: function OnExecuteCommand(Player, Command) if Auth[Player:GetName()] == false then if Command ~= "/login" then return true end end end RE: Lua hooks needed! - xoft - 02-22-2013 You need to first check if you're getting a Player at all - compare to nil. And don't compare to booleans, that is bad practice and can lead to errors (in C/C++, it is possible that "true != true") Code: function OnExecuteCommand(Player, CommandSplit) RE: Lua hooks needed! - NiLSPACE - 03-20-2013 is there a OnBlockChange or something that fires when the fire simulator is working or the fluid simulator or anything else that isn't a player that changes a block? RE: Lua hooks needed! - xoft - 03-20-2013 I don't think so, because that would put quite a strain. Already the blockchanges are the most expensive operation of the TickThread. What if, instead, you could ask at each tick for the list of changed blocks, per chunk? That, to me, seems more likely to get implemented. RE: Lua hooks needed! - NiLSPACE - 03-20-2013 yes that could be usefull RE: Lua hooks needed! - xoft - 03-20-2013 Still, don't count on that being added anytime soon RE: Lua hooks needed! - NiLSPACE - 04-07-2013 Maybe you can also add a OnTakingDamage and if you do return true you won't even get the damage animation. RE: Lua hooks needed! - xoft - 04-08-2013 OnTakeDamage is already working as an "in progress"-style hook, so I'd rather add some kind of processing to that, perhaps adding a new member to TakeDamageInfo. |