• 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Code] Getting nextmap by custom way
#1
Rainbow 
Hey,

I just wrote code which will tell you next map!
You can replace GetServerCfg and split char to space if you want to use sv_maprotation var.

It will tell full map name. ( Not mp_dome or mp_alpha etc )

Oh, and remove unsafe if you don't need it.
Code:
public unsafe string GetNextMap()
        {
            ServerPrint("[KillMe V1.0] Getting nextmap..... ");
            string s = GetServerCFG("KillMe", "maprotation", null);

            string nextmap = string.Empty;

            String[] maps = s.Split(new Char[] { ',' });
            for (int i = 0; i < maps.Length; i++)
            {
                // getting current map
                if (maps[i] == GetDvar("mapname"))
                {
                    if (maps.Length >= i + 1)
                    {
                        nextmap = maps[1];
                    }
                    else
                    {
                        nextmap = maps[i + 1];
                    }
                }
            }
            ServerPrint("[KillMe V1.0] Next map is " + nextmap);
            string sortedmapname = nextmap.Substring(3); // skip 'mp_'
            string mapname_prefix = "MPUI_";

            // some maps
            if (sortedmapname == "alpha")
            {
                sortedmapname = "LOCKDOWN"; // we'll get MPUI_LOCKDOWN
            }
    
            string mapname = mapname_prefix + "" + sortedmapname.ToUpper();
            return mapname; // Returns full map name
        }
C++/Obj-C developer. Neko engine wip
Steam: Click
[-] The following 2 users say Thank You to Nekochan for this post:
  • 30mba, Krusty123
  Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Black Ops 2 Custom background? jotape99 10 5,075 10-29-2013, 07:22
Last Post: xInfinity.
  Help Code color crosshairs koren30 3 1,615 10-02-2013, 19:26
Last Post: koren30
Brick [Release] v1.1 ChangeMap/NextMap Plugin without any configuration milchshake 23 9,421 09-23-2013, 13:18
Last Post: SgtLegend
  Help need help?how to make plugins code hXnarutoXone 12 3,046 09-01-2013, 18:30
Last Post: Bandarigoda123
  Custom xanims DidUknowiPwn 8 2,864 08-28-2013, 08:17
Last Post: RaZ
  Help Need Help with C# code tubwux 2 1,317 08-27-2013, 18:18
Last Post: tubwux
  [Request] Compile this code please dozsa0 4 1,627 08-10-2013, 21:02
Last Post: Nukem
  Compile this code please First_Semyon 12 3,480 08-08-2013, 14:53
Last Post: Bandarigoda123
  Compile please this code First_Semyon 8 2,143 07-28-2013, 01:52
Last Post: First_Semyon
  Help Make ac130 shoot custom bullets Ra3shed 0 993 07-23-2013, 13:02
Last Post: Ra3shed

Forum Jump:


Users browsing this thread: 1 Guest(s)