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-13-2013 i think HOOK_CHAT is broken becouse if i use return false with OnChat() i still can just talk. RE: Lua hooks needed! - xoft - 02-13-2013 You need to return true to refuse the chat message. False means "continue processing". RE: Lua hooks needed! - NiLSPACE - 02-13-2013 oh yes sorry. i tried both return true and false but it did nothing. EDIT: Wait it works now. but now i have another problem. i made a plugin with a command but when i use that command the server sais Unknown Command. howerver the command is still executed. EDIT: Nevermind. i forgot return true ;S RE: Lua hooks needed! - xoft - 02-14-2013 I added the HOOK_WEATHER_CHANGING hook and with it I quite changed a lot of weather code. I hope I got it right, but I'm unable to test with a client, unfortunately. Can you guys test it out for me? Probably with some sort of a weather plugin. Rev 1210. RE: Lua hooks needed! - NiLSPACE - 02-14-2013 testing it now but i have to wait until it starts to rain oh it works with the rainy plugin to but i think it uses the function OnWeatherChanged becouse i have HOOK_WEATHER_CHANGING but i get this error: Quote:Error in plugin SunnyForever: Could not find function OnWeatherChanged() hmm it seems to use both function OnWeatherChanged and function OnWeatherChanging becouse i get an error if i am missing one of them. RE: Lua hooks needed! - xoft - 02-14-2013 Yes, it should get triggered upon any change of the weather, be it built-in ticking or change by a plugin. Anything that calls cWorld:SetWeather(). First the OnWeatherChanging() is called, allowing you to modify the weather that will be changed to. Then the weather is changed and then OnWeatherChanged() is called. If not, then there's something wrong. RE: Lua hooks needed! - NiLSPACE - 02-14-2013 just return true in OnWeatherChanging() should make it stop rain forever? RE: Lua hooks needed! - xoft - 02-14-2013 It needn't - if the server loads a world with rain, it will continue raining forever. To make a permanent sunshine, do a Code: return true, eWeather_Sunny RE: Lua hooks needed! - xoft - 02-15-2013 So how's my hook, does it work? Can I close the issue? RE: Lua hooks needed! - NiLSPACE - 02-15-2013 I didn't get it to work but i propably did something wrong. function OnWeatherChanging() LOGINFO("Still Sunny") return true, eWeather_Sunny end function OnWeatherChanged() return true, eWeather_Sunny end |