Cuberite Forum
OnDisconnect - 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: OnDisconnect (/thread-82.html)



OnDisconnect - Revolucas - 03-15-2011

Aside from no documentation on how to use this. I can't get it to fire when a player leaves. The only example I found was in the Area plugin. From that I've made my own function for my upcoming plugin (Note: I removed everything inside the function for clarity and readability.)

Code:
function ZonePlugin:OnDisconnect(Reason, Player)

return false
end

Is this correct? If so, is it suppose to fire every time a player leaves? Because It doesn't. I put debug logging lines in and they don't appear. Functions are never called when they are inside. Please help as this is a very important part for databasing and clearing unwanted variables!


RE: OnDisconnect - FakeTruth - 03-17-2011

Did you tell the plugin manager to call that function on your plugin? Also check the MagicCarpet plugin because it uses on disconnect to remove the carpet


RE: OnDisconnect - Revolucas - 03-17-2011

Yeah, I ended up figuring that out eventually. Why does missing tiny details always make you feel like a big idiot? Thanks.

Aside from everything now working normally and as intented, I noticed the server crashes when you reload plugins from in game when requiring luasql.sqlite3. Also is there currently any way of either creating new entities or copying them, specifically the Player? I'd be nice to make a NPC plugin for use with an RP server.