I do not understand your script, you have some #ifdefs but they are nowhere defined, so it seems those lines in your script are never executed?
Also after level loading, you must wait until the level is synchronized to the server, just as described in the tutorial. Your wait(-2) is not good because dependent on the level size and Internet speed, synchronizing a level can take much longer or much shorter than 2 seconds. Its highly unlikely that it takes exactly two seconds.
You can debug either the client or the server with SED. When you debug the client for example, start first the server normally, then start the client in debug mode with the red arrow.