How to make a script loads/run first?

I’ve been working on a basic anti-cheat (mainly a big whitelist) but I want to make sure that its running at the first possible opportunity to try to catch most people.

Does anyone know the load-order of things and/or where would be the best place to put the script?

Just put it in you auto run folder of the server that gets loaded on server startup

Put it in the enum, that gets loaded first, (lua/includes/enum i think, not sure)

^ Support link for above

Thanks for the reply.

I tried before to do that but I don’t think it was running/loading - With little documentation on it and no success I just assumed it might have been removed/restricted in gmod13?

Hey greeting instead of disagreeing, why don’t you post the “correct” way then.

I’m not sure if you can load in the enum folder and send the info to the client, loading may be different.

@below… ok.

enum folder doesn’t load anymore.

bump for interest

This is a list of all the lua files ran on my client in order. This might be of assistance to you if you haven’t already found your answer, OP.

Keep in mind that lua/includes/init.lua is running before any of them.


So if I were to put AddCSLuaFile(“filename.lua”) and include(“filename.lua”) it would run first 100% of the time?

You have to send that version of init.lua to your clients as well. It’ll run first through Garry’s method of loading lua in to Garry’s Mod but if people are trying hard enough they can get their scripts to run first. Nothing you can do about that.

You don’t have to AddCSLuaFile includes/init.lua, it’s automatically sent to clients, if you edit it on the server the modified version will still be sent to clients.