FA:S2 Attatchments spawn on start.

Greetings. As I’m going to use a weapon system called FA:S2, there are some cool stuff that comes with it. If you hold down C with it, you can attach certain items like a new mag, new scopes, silencer, bipod etc which fits perfectly for my needs. But I’ve got 1 problem, and that it needs to be made so it will spawn with the players, so they dont have to buy the attach itself. And there’s CVAR commands for that, which i located under here. Are there any .cfg files that makes the CVAR start when the server start, kinda like the sbox_noclip 1 features (Just an example)? So i dont have to go into the server, turn the attaches on, and kill every single person on the server to make it take effect.

Server cvar ‘fas2_att_c79’ changed to 1
Server cvar ‘fas2_att_sks20mag’ changed to 1
Server cvar ‘fas2_att_compm4’ changed to 1
Server cvar ‘fas2_att_mp5k30mag’ changed to 1
Server cvar ‘fas2_att_harrisbipod’ changed to 1
Server cvar ‘fas2_att_leupold’ changed to 1
Server cvar ‘fas2_att_eotech’ changed to 1
Server cvar ‘fas2_att_slugrounds’ changed to 1
Server cvar ‘fas2_att_uziwoodenstock’ changed to 1
Server cvar ‘fas2_att_tritiumsights’ changed to 1
Server cvar ‘fas2_att_foregrip’ changed to 1
Server cvar ‘fas2_att_acog’ changed to 1
Server cvar ‘fas2_att_sks30mag’ changed to 1
Server cvar ‘fas2_att_pso1’ changed to 1
Server cvar ‘fas2_att_sg55x30mag’ changed to 1
Server cvar ‘fas2_att_suppressor’ changed to 1
Server cvar ‘fas2_att_m2120mag’ changed to 1

Cause when i join the server and havent taken on the CVARs, it says this:
You have no attachments in the Magazine category.
If you’re in Sandbox - spawn them via the Entities tab.
As an Admin you can configure what attachments players are given when spawning in the Utilities section of the Spawn Menu.

I want it to be spawned with them when the server starts/opens. So i dont need to go into the server and turn it on, and if the server crashes and i cant be there to make them be able to have the attachments that they want to use.

What type of server are you running or planning on opening? If it is a server which hosts a lot of people, or the map doesn’t change regularly, then you may run into issues… FAS2 has a memory leak and, from what I’ve gathered, the author has left GMod and wasn’t planning on resolving the issue. I haven’t spoken to him since that conversation so I don’t know if a hotfix was uploaded or not.

I am planning on releasing my own hotfix using my resource management system soon.

As for your questions, I am not familiar enough with FAS2 to give an answer but if there are CVars then you should be able to modify the cvars and be done with it, or creating a simple lua/autorun/server/ Lua file which simply runs: RunConsoleCommand( “command”, “values …” ); for each command.


local FAS2_CVARS = {
	"fas2_att_c79";
	"fas2_att_sks20mag";
	"fas2_att_compm4";
	"fas2_att_mp5k30mag";
	"fas2_att_harrisbipod";
	"fas2_att_leupold";
	"fas2_att_eotech";
	"fas2_att_slugrounds";
	"fas2_att_uziwoodenstock";
	"fas2_att_tritiumsights";
	"fas2_att_foregrip";
	"fas2_att_acog";
	"fas2_att_sks30mag";
	"fas2_att_pso1";
	"fas2_att_sg55x30mag";
	"fas2_att_suppressor";
	"fas2_att_m2120mag";
};

hook.Add( "Initialize", "EnableFAS2", function( )
	for k, v in pairs( FAS2_CVARS ) do
		RunConsoleCommand( v, "1" );
	end
end );

That should do it if you put it into: addons/acecool/lua/autorun/server/sv_fas2_cvars.lua

Wow, you’re truly a “server” saver. It works, and it works perfectly. I can’t thank you enough tho.
It’s going to be a MilitaryRP server, and the Map will be like it is right now. Also, i dont think it will have a lot of people tho, but Idk yet. Where did you learn this? If there’s a link for this, i would like to know :slight_smile: