Hello, I’ve made something awesome. Its going to make your life 100% Easier, and can be used in any situation. Its a simple file loader, this means that you don’t have too type ‘include’ around a billion times, and all your servers files are synced perfectly. I made this because I’m quite lazy when it comes to programming, and with two functions you need to call, and around 4 arguments in total, this game make your life a lot easier.
The syntax like all my classes is very simple, here’s how you load a directory.
LOAD:UpdateFilesServer(root , directory) LOAD:UpdateFilesClient(root, directory) LOAD:UpdateFilesShared(root, directory)
Here’s an example.
The ‘root’ folder is your garrysmod/ folder, from here you can navigate to where ever you want, if you want to go to the auto-run folder:-
The second argument is the directory, this is the folder the class will load into your gamemode.
I really wanted a method on which the server would automatically add the servers to the gamemode with out the need to ‘refresh’ your garrysmod, or do this and that. So here’s the automation part.
If you want to automate your loading process, you need to first use UpdateFilesServer. This will store a Directory to check under a table, then after that you can use this:-
Again, your location has to be the same as your previous UpdateFileServer’s, If you are using multiple locations this will not work ( sorry ). After that you might want to put it in a simple timer, here’s a practical example of this used.
timer.Create( "UpdateTimer", 60, 0, function() LOAD:CheckFiles("gamemodes/garrysurvival/gamemode") end )
Every 60 seconds, we will check the files for any changes, but this can be lowered, it won’t be that expensive on your resources!
You must not call this in the init.lua, just like an include type this must be called outside any functions, for example.
// Load files function LoadFiles() print("==[START]=[HASKELL LOAD 3.0]=================================") print(" >Haskell Loading Script has begun loading correct scripts") LOAD:UpdateFilesServer("gamemodes/garrysurvival/gamemode","server" ) print("==[DONE]=====================================================") timer.Create( "UpdateTimer", 60, 0, function() LOAD:CheckFiles("gamemodes/garrysurvival/gamemode") end ) end LoadFiles() // Call
If you don’t do this, things can break!
To install, you will need to add ‘haskell_load.lua’ into your init.lua, then it can be called from anywhere.
Thanks and enjoy!