Is there any way to disable certain E2 functions for a server? If so how would I go about doing it? I have been looking for a couple hours now and can not figure it out.
Yes, you can comment them out in the E2 entity’s files. I’ll post an example tomorrow.
Sorry for the delay, anyhow, you have to first extract the Wiremod content from the .gma file into a legacy addon (so a folder in your addons folder named ‘wiremod’, or whatever you want).
Once you have done that, browse to /addons/wiremod/lua/entities/gmod_wire_expression2/core
There are plenty of files in there. If you look on the Expression 2 wiki, you can see which “section” the function belongs to, and therefor you can determine which file it is most likely to be found in.
For example, if you want to disable “applyForce()”, go to the file entity.lua.
In there, search for “applyForce”, and you’ll run into the following function:
e2function void entity:applyForce(vector force) if not validPhysics(this) then return nil end if not isOwner(self, this) then return nil end if check( force ) then local phys = this:GetPhysicsObject() phys:ApplyForceCenter(Vector(force,force,force)) end end
To disable the function, replace the code with this:
--[[e2function void entity:applyForce(vector force) if not validPhysics(this) then return nil end if not isOwner(self, this) then return nil end if check( force ) then local phys = this:GetPhysicsObject() phys:ApplyForceCenter(Vector(force,force,force)) end end]]--
Then in-game type “wire_expression2_reload” as a superadmin, or type it in the server console. The other option would be restarting the server.
Because of Cloudflare detecting me as a spambot, my latest edit didn’t go through.
Disabling a function as described above will break all E2s using the functions you block. The user spawning an E2 containing the removed function will get an error saying “function on line … Does not exist” (something along the lines of that). If you want all E2s to remain working, but just block the E2 function then put the “–[[” after the first line, and the “]]–” before the last “end” closing the function. That way the function still exists, but loses it’s functionality. If you are more advanced with Lua you could also replace the code within the function to display a message once the E2 is spawned that a certain function in the user’s code is disabled on the server.
A tricky thing is that extracting Wiremod makes it non-updateable. If you use SVN and make edits, you are able to merge the new files and your own, while still remaining the ability to keep your edits without having to redo them every time Wiremod updates.
EDIT: sorry for the triple post, really assumed it should have merged my last 2 posts…