Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help YuriMAP Plugin
#1
Hi guys.
in yuri map plug for change map and gametype i should add admin xuid in :
Code:
[Yu]
xuids= 10354982b, 10498f812, 1023b7f4c
i will this plugin use of permission plugin.

&
if name of .dsr file not added in :
Code:
[Yu]
dsr= CTF_default, DOM_default, HQ_default
i don't change gametype.
i will change to every .dsr file in Admins folder and not add .dsr files in yuri plugin : dsr=

if you can change this plugin and sent in topic.

thanks

Code OF plugin :
Code:
using System;
using System.Collections.Generic;
using System.IO;
using Addon;

namespace YuMap
{
    public class PluPack : CPlugin
    {
        const int MAPS = 35;
        bool haveadmin = false;
        List<string> admins = new List<string>();
        string[] mapdev, mapuser;
        int[] maprange = new int[MAPS];
        int range;
        int nextmap = -1;
        string dspl, dsr;
        string[] dsrlist;
        Random rnd = new Random(unchecked((int)DateTime.Now.Ticks));
        int max, counter;
        bool mult = false;
        bool requireAdmin = true;

        void GetMaps()
        {
            //fetch data
            string tempdev, tempuser;
            string defaultmapdev = "mp_alpha, mp_bootleg, mp_bravo, mp_carbon, mp_dome, mp_exchange, mp_hardhat, mp_interchange, mp_lambeth, mp_mogadishu, mp_paris, mp_plaza2, mp_radar, mp_seatown, mp_underground, mp_village, mp_overwatch, mp_park, mp_italy, mp_morningwood, mp_cement, mp_meteora, mp_qadeem, mp_hillside_ss, mp_restrepo_ss, mp_burn_ss, mp_six_ss, mp_crosswalk_ss, mp_gulch, mp_boardwalk, mp_nola, mp_roughneck, mp_aground_ss, mp_courtyard_ss, mp_terminal_cls";
            string defaultmapuser = "lockdown, bootleg, mission, carbon, dome, downturn, hardhat, interchange, fallen, bakaara, resistance, arkaden, outpost, seatown, underground, village, overwatch, liberation, piazza, blackbox, foundation, sancuary, oasis, getaway, lookout, vortex, u-turn, intersection, gulch, boardwalk, parish, offshore, aground, erosion, terminal";
            tempdev = GetServerCFG("Yu", "mapdev", defaultmapdev);
            tempuser = GetServerCFG("Yu", "mapuser", defaultmapuser);
            //populate arrays
            mapdev = tempdev.Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries);
            mapuser = tempuser.Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries);
        }

        void GetAdmins()
        {
            bool.TryParse(GetServerCFG("Yu", "requireAdmin", "TRUE"), out requireAdmin);
            string xuids = GetServerCFG("Yu", "xuids", "");
            if (xuids != "")
                foreach (string x in xuids.Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries))
                    admins.Add(x);
            if (admins.Count > 0) { haveadmin = true; }
        }

        bool Admin(string id)
        {
            if (requireAdmin)
            {
                foreach (string a in admins)
                {
                    if (id.ToLowerInvariant().Contains(a.ToLowerInvariant()))
                    {
                        return true;
                    }
                }
                return false;
            }
            else
            {
                return true;
            }
        }

        void GetRotation()
        {
            dspl = GetServerCFG("Yu", "dspl", "default") + ".dspl";
            dsrlist = GetServerCFG("Yu", "dsr", "FFA_default").Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries);
            max = dsrlist.Length;
            if (max == 1)
                dsr = dsrlist[0];
            else
            {
                counter = 0;
                mult = true;
            }
            string[] weights = GetServerCFG("Yu", "weights", "3, 2, 5, 3, 5, 2, 5, 3, 2, 5, 5, 3, 2, 3, 2, 5, 3, 5, 2, 5").Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < MAPS; i++)
            {
                range += int.Parse(weights[i]);
                maprange[i] = range;
            }
        }

        int FindMap(int r)
        {
            for (int i = 0; i < MAPS; i++)
                if (r <= maprange[i])
                    return i;
            return -1;
        }

        void WriteDSPL(string map)
        {
            File.WriteAllText(@"admin\" + dspl, map + "," + dsr + ",1");
        }

        void GetNextMode()
        {
            dsr = dsrlist[counter];
            counter++;
            if (counter == max) { counter = 0; }
        }

        int GetMapByName(string map, bool dev = false)
        {
            string[] m = dev ? mapdev : mapuser;
            for (int i = 0; i < MAPS; i++)
                if (m[i].StartsWith(map, StringComparison.InvariantCultureIgnoreCase))
                    return i;
            return -1;
        }

        int GetModeByName(string mode)
        {
            for (int i = 0; i < max; i++)
                if (dsrlist[i].StartsWith(mode, StringComparison.InvariantCultureIgnoreCase))
                    return i;
            return -1;
        }

        void SetMode(string[] p, int n = 2)
        {
            if (mult && p.Length > n)
            {
                int mode = GetModeByName(p[n]);
                if (mode != -1)
                {
                    dsr = dsrlist[mode];
                    counter = mode + 1;
                    if (counter == max) { counter = 0; }
                }
            }
        }

        public override void OnServerLoad()
        {
            ServerPrint("Yurio Map Plugin v1.4 loaded");
            GetMaps();
            GetAdmins();
            GetRotation();
        }

        public override void OnMapChange()
        {
            int prevmap = GetMapByName(GetDvar("mapname"), true);
        repeat:
            nextmap = FindMap(1 + rnd.Next(range));
            if (prevmap == nextmap) { goto repeat; }
            if (mult) { GetNextMode(); }
            WriteDSPL(mapdev[nextmap]);
        }

        public override ChatType OnSay(string Message, ServerClient Client)
        {
            string[] parsed = Message.Split(null as char[], StringSplitOptions.RemoveEmptyEntries);
            bool admin = haveadmin && Admin(Client.XUID);
            if (Message.StartsWith("!mode", StringComparison.InvariantCultureIgnoreCase) && mult)
            {
                if (admin)
                {
                    if (Message.StartsWith("!modes", StringComparison.InvariantCultureIgnoreCase))
                    {
                        //list maps
                        string message = "MODES: ";
                        foreach (string mode in dsrlist)
                        {
                            message += mode + " ";
                        }
                        TellClient(Client.ClientNum, message, true);
                        return ChatType.ChatNone;
                    }
                    SetMode(parsed, 1);
                    WriteDSPL(mapdev[nextmap]);
                }
                string msg = "Next map is ^3" + mapuser[nextmap].ToUpperInvariant() + " ^7(^3" + dsr.ToUpperInvariant() + "^7)";
                ServerSay(msg, true);
                ServerPrint(msg);
                return ChatType.ChatNone;
            }
            else if (Message.StartsWith("!map", StringComparison.InvariantCultureIgnoreCase))
            {
                if (!admin) { return ChatType.ChatGame; }
                if (Message.StartsWith("!maps", StringComparison.InvariantCultureIgnoreCase))
                {
                    //list maps
                    string message = "MAPS: ";
                    foreach (string map in mapuser)
                    {
                        message += map + " ";
                    }
                    TellClient(Client.ClientNum, message, true);
                    return ChatType.ChatNone;
                }
                if (parsed.Length > 1)
                {
                    int map = GetMapByName(parsed[1]);
                    if (map != -1)
                    {
                        nextmap = map;
                        SetMode(parsed);
                        WriteDSPL(mapdev[nextmap]);
                        ServerCommand("map_rotate");
                    }
                }
                return ChatType.ChatNone;
            }
            else if (Message.StartsWith("!nextmap", StringComparison.InvariantCultureIgnoreCase))
            {
                if (admin && parsed.Length > 1)
                {
                    int map = GetMapByName(parsed[1]);
                    if (map != -1)
                    {
                        nextmap = map;
                        SetMode(parsed);
                        WriteDSPL(mapdev[nextmap]);
                    }
                }
                string m = (mult) ? " ^7(^3" + dsr.ToUpperInvariant() + "^7)" : String.Empty;
                string msg = "Next map is ^3" + mapuser[nextmap].ToUpperInvariant() + m;
                ServerSay(msg, true);
                ServerPrint(msg);
                return ChatType.ChatNone;
            }
            else if (Message.StartsWith("!res", StringComparison.InvariantCultureIgnoreCase))
            {
                if (admin)
                {
                    ServerCommand("map_restart");
                    return ChatType.ChatNone;
                }
            }
            return ChatType.ChatContinue;
        }
    }
}
Reply

#2
nobody can help me Huh

Y U NO
Reply

#3
WHAT .........
ALL IN SLEEP ?

[Image: yHkf6lWh.jpeg]
Nyan Cat You can't teach an old dog new tricks Nyan Cat
Nyan Cat You can't teach grandmother to suck eggs Nyan Cat
Reply

#4
Seventeen days passed! You could figure it out yourselves? Oh silly you. Troll
C++/Obj-Cdeveloper. Neko engine wip
Steam: Click
Reply

#5
(12-17-2014, 22:09)Nekochan Wrote: Seventeen days passed! You could figure it out yourselves? Oh silly you. Troll

most itsmods coders is not GOOD . At
they love that see them post's & LIKE it.
when you have a problem they are death . Dodgy
creatures love Donate ,too.
Nyan Cat You can't teach an old dog new tricks Nyan Cat
Nyan Cat You can't teach grandmother to suck eggs Nyan Cat
Reply

#6
wat? use google translator....
~FYANB~ Servers Website

Primary Account:
[Image: 76561198070236721.png]
Secondary Account:
[Image: 76561198096107676.png]
Third Account:
[Image: 76561198164751656.png]
Reply

#7
(12-19-2014, 22:09)Casper Wrote: wat? use google translator....

what?
can't you see my first post? Dodgy Rolleyes
Nyan Cat You can't teach an old dog new tricks Nyan Cat
Nyan Cat You can't teach grandmother to suck eggs Nyan Cat
Reply

#8
We cant understand what you even want...
~FYANB~ Servers Website

Primary Account:
[Image: 76561198070236721.png]
Secondary Account:
[Image: 76561198096107676.png]
Third Account:
[Image: 76561198164751656.png]
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  Help IAM plugin source GameplaysDPP 8 6,771 07-19-2017, 19:40
Last Post: W4R||The Hyper
Rainbow Help Headshot plugin giving ammo or more points Rudy 1 2,349 02-02-2015, 12:59
Last Post: Danila
  MW3 plugin for BigBrotherBot raminr63 0 2,328 12-28-2014, 20:05
Last Post: raminr63
Rainbow Plugin no work Rudy 9 4,607 07-26-2014, 23:00
Last Post: Nekochan
Rainbow Help Can sombody end this plugin premium to work Rudy 6 4,015 07-26-2014, 22:16
Last Post: Rudy
  Help Server crashes after using plugin Gmzorz 2 2,728 01-23-2014, 19:04
Last Post: Gmzorz

Forum Jump:


Users browsing this thread:
2 Guest(s)

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