There's a couple of problems with that. First, I assume "Players" becomes "Player" if there's only one player on the server, which would cause the start position to be 0 (-1 + 1). Second, you'd want to add the length of "Players - " (if we're still using that, which is 9) because otherwise your starting position will be 1 after the start of "Players" which is "layers - x". Third, the end point will almost always be past the length of the string because the end point is specified as number of characters to grab, not the end point.
Also, you'd want to set NPL_Window.getValue() to a variable to avoid calling it a bunch of times.
If you wanted to compress the code to one line, you could do this:
serverConnection.isLocal() ? true : ((%pos = strPos(%serverName = getSubStr(%serverInfo = NPL_Window.getValue(), %start = strPos(%serverInfo, " - ")+3, strLen(%serverInfo)-%start), $Pref::Player::NetName)) == 0 && (getSubStr(%serverName, %pos + strLen($Pref::Player::NetName), 1) $= "\'"));
Buuut, that's pretty un-readable.