/hungergames

Re: /hungergames

Postby Conor » 08 Aug 2013, 18:54

joppiesaus wrote:I think you forgot this at the top of your code:
Code: Select all
using System.IO;

This will fix the problem.


Ah, thank you Joppiesaus.

@Breakdown901:
Code: Select all
      private bool LevelExists()
      {
         foreach (FileInfo f in new DirectoryInfo("levels").GetFiles("*.lvl"))
         {
             if (f.Name.Split('.')[0] == mapName)
             {
                  return true;
             }
         }
         return false;
      }


As you said, this is looking in the levels folder for the map. You said you had a problem where the same map was created 5 times - if you first check to see the map is there before creating one, then this should hopefully solve that problem. As the map is created once, the above code will return false afterwards - so another map won't be created using /newlvl.

I also checked to see if the map is loaded later in the code to further help this problem. If the problem still persists then I'm not sure what is wrong with it.
Conor (Conanza121)
User avatar
Conor
Coder
 
Posts: 390
Joined: 10 Oct 2012, 21:36
Location: @21Conor

Previous

Return to Custom Commands

Who is online

Users browsing this forum: No registered users and 3 guests

cron