SWAT4 Crash Fix

As of 2021-09-13 madserver.net no longer responds to SWAT 4 requests, whereas previously it gave a 400 – Bad Request, which was the reason for crashes. This should fix the problem for now, without needing a patch. But in case you do experience consistent crashes on joining a map, the solution is below.

Due to an ad company Massive Incorporated being down since 2021-09-07. The game will crash on some maps, because it fails to fetch ads and it doesn’t matter if it’s SP, MP, TSS or the SEF mod. To fix it, add these lines to your hosts file:

127.0.0.1   madserver.net
127.0.0.1   ad.madserver.net
127.0.0.1   imp.madserver.net
127.0.0.1   media.madserver.net

To add them, run your Notepad as administrator, go to File – Open, in the “File name” field enter: %WINDIR%\system32\drivers\etc\hosts and click Open. Add the lines at the bottom of the file and save it.

— You can also download this script, that will do that automatically for you:
http://swat4.tk/download/SWAT4_Crash_Fix.bat

— Automatic bash script for Linux (and presumably MacOS):
http://swat4.tk/download/SWAT4_Crash_Fix.sh

— What is hosts file?
https://en.wikipedia.org/wiki/Hosts_(file)#Purpose

— What is it used for in this case?
https://en.wikipedia.org/wiki/Hosts_(file)#Extended_applications
Refer to Internet resource blocking.


A possible alternative for fixing the crash is adding a delay to the search for ads. Keep in mind this has to be done for every module (Base, TSS, SEF, etc.) and after every mod update, unless you keep your Swat4X.ini file.

To do so, navigate to your SWAT 4 folder and find the module you want to apply it to. Content is base game; ContentExpansion is TSS; mod folders have their respective names. In there you’ll find the System folder and in it look for the Swat4X.ini file.

Open Swat4X.ini with notepad or equivalent and Ctrl + F for: [Engine.GameEngine]
Right under that, add a new line: MassiveUpdateDelay=99999999
Save and repeat for any other modules you play.

— Credit: @Beppe_Goodoldrebel


— More info about the origins of in-game ads can be found here:
https://induktio.net/wiki/In-game_advertising