I'm making an addon in which the bans for it are stored in a MySQL table, to reduce the amount of queries I have to make I want to save the bans to a .JSON file every restart. I'm not sure how to go about doing this, so any help is appreciated.
[IMG]http://wiki.garrysmod.com/favicon.ico[/IMG] [URL="http://wiki.garrysmod.com/page/util/TableToJSON"]util.TableToJSON[/URL]
[IMG]http://wiki.garrysmod.com/favicon.ico[/IMG] [URL="http://wiki.garrysmod.com/page/util/JSONToTable"]util.JSONToTable[/URL]
I'm not aware of a hook that is called when the server restarts, but I think [IMG]http://wiki.garrysmod.com/favicon.ico[/IMG] [URL="http://wiki.garrysmod.com/page/GM/Initialize"]GM:Initialize[/URL] or [IMG]http://wiki.garrysmod.com/favicon.ico[/IMG] [URL="http://wiki.garrysmod.com/page/GM/ShutDown"]GM:ShutDown[/URL] are as close as you can get to a restart hook. (I'm not 100% sure on that though)
Sorry, you need to Log In to post a reply to this thread.