Modding FAQ

This is specifically about rare stuff not covered anywhere else. Most of it relates to modding, some of it to rare problems.

Rearming: Scripts show errors on my Linux server. How do I fix this?

This is caused by Lua/GMod’s unintelligent handling of line endings. The rearm script files need to have Windows-style line ending markers for Windows servers, but on Linux they need to be Linux-style. Most decent text editors have an option for “EOL conversion” or similar.

If you have shell access on the Linux server, you could navigate to where the scripts are and run:

dos2unix *.txt

That will convert all the scripts in one go. Converted scripts with proper line endings will no longer cause errors.

Lua: How do I make my custom ammo entities also spawn as random ammo?


ENT.AutoSpawnable = true

Note that this works on any entity, not just ammo. So if you want to randomly spread a certain entity across the map, this might be a workable method.

Lua: how do I allow spectators to possess my custom entity?

ENT.AllowPropspec = true

Lua: how do I keep players from picking up my custom entity?

ENT.CanPickup = false