Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Compile please this code
#1
Hello who can compile this code:

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

namespace YuMap
{
     public class PluPack : CPlugin
     {
         const int MAPS = 34;
         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_six_ss, mp_burn_ss, mp_crosswalk_ss, mp_nola, mp_roughneck, mp_aground_ss, mp_courtyard_ss, mp_terminal_cls, mp_shipbreaker";
             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, parish, offshore, aground, erosion, terminal, decommission";
             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, 3 ,4 ,5 ,3, 4, 5, 2, 4, 5, 3, 5, 3, 4, 2").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
Please use Sailor Moons Plugin Maker. So you don't need MVS.
Reply

#3
(07-27-2013, 08:25)Bandarigoda123 Wrote: Please use Sailor Moons Plugin Maker. So you don't need MVS.
Error Line Code
121 CS0241

Please,i need compiled dll file
Reply

#4
(07-27-2013, 09:35)First_Semyon Wrote:
(07-27-2013, 08:25)Bandarigoda123 Wrote: Please use Sailor Moons Plugin Maker. So you don't need MVS.
Error Line Code
121 CS0241

Please,i need compiled dll file

here, I compiled it. But I got no errors.


.zip   plug.zip (Size: 4.43 KB / Downloads: 15)
Reply

#5
(07-27-2013, 05:18)First_Semyon Wrote: Hello who can compile this code:

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

namespace YuMap
{
     public class PluPack : CPlugin
     {
         const int MAPS = 34;
         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_six_ss, mp_burn_ss, mp_crosswalk_ss, mp_nola, mp_roughneck, mp_aground_ss, mp_courtyard_ss, mp_terminal_cls, mp_shipbreaker";
             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, parish, offshore, aground, erosion, terminal, decommission";
             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, 3 ,4 ,5 ,3, 4, 5, 2, 4, 5, 3, 5, 3, 4, 2").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;
         }
     }
}

hey you have a prob in line 155 ,fix it before asking anybody to compile it
Reply

#6
@Hallla
But It was compiled flawless -_- see the attachment
Reply

#7
(07-27-2013, 10:27)Bandarigoda123 Wrote: @Hallla
But It was compiled flawless -_- see the attachment

^^ i dont see and i found my prob ... only pasting in false line ;D
Reply

#8
ah, see it now xD. Attached now.
Reply

#9
(07-27-2013, 10:18)Bandarigoda123 Wrote:
(07-27-2013, 09:35)First_Semyon Wrote:
(07-27-2013, 08:25)Bandarigoda123 Wrote: Please use Sailor Moons Plugin Maker. So you don't need MVS.
Error Line Code
121 CS0241

Please,i need compiled dll file

here, I compiled it. But I got no errors.

Thank you very much, work very well!!!
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  Help Code color crosshairs koren30 3 4,016 10-02-2013, 19:26
Last Post: koren30
  Help need help?how to make plugins code hXnarutoXone 12 8,546 09-01-2013, 18:30
Last Post: Bandarigoda123
  Help Need Help with C# code tubwux 2 3,313 08-27-2013, 18:18
Last Post: tubwux
  [Request] Compile this code please dozsa0 4 4,133 08-10-2013, 21:02
Last Post: Nukem
  Compile this code please First_Semyon 12 9,682 08-08-2013, 14:53
Last Post: Bandarigoda123
  Trying to compile a modified menu DidUknowiPwn 7 5,706 07-05-2013, 21:55
Last Post: DidUknowiPwn
  Code of vector Bloodfocus 1 2,411 06-23-2013, 11:54
Last Post: Yamato
  problem with gsc code CheGuevara 5 5,617 04-20-2013, 15:06
Last Post: Nekochan
  Help Server Script Compile Error when loading ExtremeBunkerMaker lolmoon 3 3,928 04-09-2013, 03:11
Last Post: lolmoon
Tongue [Request] read if you have a cs:go code:) rawr-saours 5 4,061 04-05-2013, 18:15
Last Post: SuperNovaAO

Forum Jump:


Users browsing this thread:
1 Guest(s)

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