Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help Bug in GetServerCFG?
#1
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]));
[Image: compiling.png][Image: aLKA8og_460sa.gif]
Reply

#2
Works perfectly fine for me
Reply

#3
OnServerStart exists???

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

#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.
[Image: compiling.png][Image: aLKA8og_460sa.gif]
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  [Request] A code like GetServerCFG raminr63 5 2,471 11-10-2012, 20:53
Last Post: Nekochan

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.