ItsMods

Full Version: Bug in GetServerCFG?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have the following Problem:

Following code will be excuted in onServerStart:
Code:
string entry = GetServerCFG("EpicZombie", "mp_dome", "nothing");
            if (entry.CompareTo("nothing")!=0)
            {
                ServerLog(LogType.LogConsole, "before splitting with !:" + entry);
                String[] coords = entry.Split(new Char[] { '!' });
                ServerLog(LogType.LogConsole, "before splitting with !:" + entry.Length);
                ServerLog(LogType.LogConsole, "before splitting wit2 !:" + coords.Length);
                List<Vector> newPos = new List<Vector>();
                newPos.Add(parse(coords[0]));
                newPos.Add(parse(coords[1]));
                BoxPositions["mp_dome"] = newPos;
                entry = null;
            }

Method parse:
Code:
private Vector parse(String s)
        {
            ServerLog(LogType.LogConsole, "Before splitting with ,:" + s.Length);
            ServerLog(LogType.LogConsole, "Before splitting with ,:" + s);
            String[] coord = s.Split(new Char[] { ',' });
            ServerLog(LogType.LogConsole, "After splitting with ,:" + coord.Length);
            ServerLog(LogType.LogConsole, "After splitting with ,: " + coord[0] + "  " + coord[1] + "  " + coord[2]);
            return new Vector(Int32.Parse(coord[0]), Int32.Parse(coord[1]), Int32.Parse(coord[2]));
        }

In sv_config.ini:
Code:
[EpicZombie]
mp_dome=67,-347,-352!825,-648,0


Normally should work everything well.
But what i get from the above code:
  • The ServerLog Methods in OnServerStart prints nothing, not even a newline
  • ServerLog(LogType.LogConsole, "Before splitting with ,:" + s.Length); give s me a length of 0/ But it even prints something
  • resulting a C# IndexOutOfBounds exception in return new Vector(Int32.Parse(coord[0]), Int32.Parse(coord[1]), Int32.Parse(coord[2]));
Works perfectly fine for me
OnServerStart exists???

Maybe you should use:
CSHARP Code
  1. public override void OnServerLoad()
  2. {
  3.  
  4. }
(07-28-2012, 12:54)narkos Wrote: [ -> ]OnServerStart exists???

Maybe you should use:
CSHARP Code
  1. public override void OnServerLoad()
  2. {
  3.  
  4. }

soz. i just write the above code wthout looking for it.
I mean OnServerLoad()


If i use this code segment in my EpicZombieMod it will crash other things too that are not even related to it.