Thread Rating:
  • 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-Cdeveloper. Neko engine wip
Steam: Click
Reply



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

Forum Jump:


Users browsing this thread:
1 Guest(s)

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