09-23-2013, 12:41
hi guys ...
1) How i compile a plugin (i use pluginmaker4)
when i will compile a plugin (yurio plugin=in itsmods) give me error :
default parameter specifiers not permitted
line : 62 & error cod : cs0241
how i fixed this...
please help
Youri plugin is :
_______________________________________________________________
2) I have 4 plugin source how compile and made this plugins to 1 plugin..?[/quote]
1) How i compile a plugin (i use pluginmaker4)
when i will compile a plugin (yurio plugin=in itsmods) give me error :
default parameter specifiers not permitted
line : 62 & error cod : cs0241
how i fixed this...
please help
Youri plugin is :
Code:
using System;
using System.Collections.Generic;
using System.IO;
using Addon;
namespace YuMap
{
public class PluPack : CPlugin
{
const int MAPS = 16;
bool haveadmin = false;
List<string> admins = new List<string>();
string[] mapdev = { "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" };
string[] mapuser = { "lockdown", "bootleg", "mission", "carbon", "dome", "downturn", "hardhat", "interchange", "fallen", "bakaara", "resistance", "arkaden", "outpost", "seatown", "underground", "village" };
int[] maprange = new int[MAPS];
int range;
int nextmap = -1;
string dspl, dsr;
Random rnd = new Random(unchecked((int)DateTime.Now.Ticks));
void GetAdmins()
{
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)
{
foreach (string a in admins)
if (id.ToLowerInvariant().Contains(a.ToLowerInvariant())) { return true; }
return false;
}
void GetRotation()
{
dspl = GetServerCFG("Yu", "dspl", "default") + ".dspl";
dsr = GetServerCFG("Yu", "dsr", "FFA_default");
string[] weights = GetServerCFG("Yu", "weights", "3, 2, 5, 3, 5, 2, 5, 3, 2, 5, 5, 3, 2, 3, 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 SetMap(string map)
{
File.WriteAllText(@"admin\" + dspl, map + "," + dsr + ",1");
}
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;
}
public override void OnServerLoad()
{
ServerPrint("Yurio Map Plugin v1.0 loaded");
GetAdmins();
GetRotation();
}
public override void OnMapChange()
{
int prevmap = GetMapByName(GetDvar("mapname"), true);
repeat:
nextmap = FindMap(1 + rnd.Next(range));
if (prevmap == nextmap) { goto repeat; }
SetMap(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("!map", StringComparison.InvariantCultureIgnoreCase))
{
if (!admin) { return ChatType.ChatGame; }
if (parsed.Length > 1)
{
int map = GetMapByName(parsed[1]);
if (map != -1) { ServerCommand("map " + mapdev[map]); }
}
return ChatType.ChatNone;
}
if (Message.StartsWith("!nextmap", StringComparison.InvariantCultureIgnoreCase))
{
if (admin && parsed.Length > 1)
{
int map = GetMapByName(parsed[1]);
if (map != -1)
{
nextmap = map;
SetMap(mapdev[nextmap]);
}
}
ServerSay("Next map is: ^3" + mapuser[nextmap].ToUpperInvariant(), true);
ServerPrint("Next map is: ^3" + mapuser[nextmap].ToUpperInvariant());
return ChatType.ChatNone;
}
return ChatType.ChatContinue;
}
}
}
2) I have 4 plugin source how compile and made this plugins to 1 plugin..?[/quote]
You can't teach an old dog new tricks
You can't teach grandmother to suck eggs
You can't teach grandmother to suck eggs