Help my plugin has bugs, help
#1
hi there, i had worked at an plugin (yes u maybe know this code) but i'm still an newbie.
PHP Code:
using System; using System.Collections.Generic; using System.Timers; using Addon; namespace undermap { public class spectate : CPlugin { Timer OneSecondInterval = new Timer(); List<ServerClient> Teleport = new List<ServerClient>(); List<int> TeleportIn = new List<int>(); Dictionary<string, List<Vector>> Spawn = new Dictionary<string, List<Vector>>(); Dictionary<string, int> Requests = new Dictionary<string, int>(); static Random rnd = new Random(); int TimeBeforeTeleport = 2; int TeleportRequests = 0; private void setSpawnPoints() { List<Vector> temp = new List<Vector>(); temp.Add(new Vector(-271.3662f, 266.284f, -520.870f)); temp.Add(new Vector(-2263.284f, 949.1547f, -210.875f)); temp.Add(new Vector(-2938.689f, -6255.507f, -260.125f)); temp.Add(new Vector(-3638.923f, 5949.7f, 259.9276f)); Spawn.Add("mp_dome", temp); temp = new List<Vector>(); temp.Add(new Vector(-7899.75537f, -759.5192f, -351.875f)); temp.Add(new Vector(-341.7238f, 1448.964f, -351.875f)); Spawn.Add("mp_exchange", temp); temp = new List<Vector>(); temp.Add(new Vector(-44.36094f, -1280.527f, 140.55347f)); temp.Add(new Vector(920.0093f, 1231.334f, 135.8516f)); temp.Add(new Vector(-1428.351f, -102.2619f, 507.9496f)); Spawn.Add("mp_aground_ss", temp); temp = new List<Vector>(); temp.Add(new Vector(-6171.717f, 2894.179f, 1120.125f)); temp.Add(new Vector(-6585.529f, -260.9605f, 2682.154f)); temp.Add(new Vector(14652.04f, -8786.891f, 1738.83f)); Spawn.Add("mp_radar", temp); temp = new List<Vector>(); temp.Add(new Vector(-32.43702f, 2558.124f, -120.875f)); Spawn.Add("mp_mogadishu", temp); temp = new List<Vector>(); temp.Add(new Vector(114.1973f, -160.3532f, -223.875f)); Spawn.Add("mp_bootleg", temp); temp = new List<Vector>(); temp.Add(new Vector(-1977.2677f, -3643.704f, 3560.125f)); temp.Add(new Vector(-12065.58f, -252.4027f, -7423.875f)); temp.Add(new Vector(-1206.419f, -2960.737f, -767.8751f)); Spawn.Add("mp_carbon", temp); temp = new List<Vector>(); temp.Add(new Vector(-1209.148f, 1847.2f, -55.875f)); temp.Add(new Vector(1104.961f, -759.7462f, 265.7924f)); Spawn.Add("mp_alpha", temp); temp = new List<Vector>(); temp.Add(new Vector(-226.2296f, -3242.486f, 0.1249986f)); temp.Add(new Vector(-1069.226f, -2045.814f, 0.1249996f)); temp.Add(new Vector(-582.5754f, 1011.445f, 620.2016f)); temp.Add(new Vector(-5161.83f, 3684.327f, 768.755f)); this.Spawn.Add("mp_paris", temp); temp = new List<Vector>(); temp.Add(new Vector(3227.455f, -469.4347f, 608.125f)); Spawn.Add("mp_plaza2", temp); temp = new List<Vector>(); temp.Add(new Vector(587.1492f, 670.2912f, -1023.875f)); temp.Add(new Vector(-582.5754f, 1011.445f, 620.2016f)); temp.Add(new Vector(-2265.172f, -513.6675f, 62.5587f)); Spawn.Add("mp_seatown", temp); temp = new List<Vector>(); temp.Add(new Vector(899.2142f, -1429.847f, 8.125f)); temp.Add(new Vector(79.62947f, 863.9869f, 8.125f)); Spawn.Add("mp_hardhat", temp); temp = new List<Vector>(); temp.Add(new Vector(3997.784f, 2506.632f, -2303.875f)); temp.Add(new Vector(000f, 000f, -105f)); Spawn.Add("mp_interchange", temp); temp = new List<Vector>(); temp.Add(new Vector(-1315.92f, -1311.651f, -1727.875f)); Spawn.Add("mp_courtyard_ss", temp); temp = new List<Vector>(); temp.Add(new Vector(-44.36094f, -1280.527f, 140.55347f)); temp.Add(new Vector(920.093f, 1231.334f, 135.8516f)); temp.Add(new Vector(-1428.351f, -102.2619f, 507.9496f)); Spawn.Add("mp_aground_ss", temp); temp = new List<Vector>(); temp.Add(new Vector(586.6773f, 915.8278f, -191.875f)); temp.Add(new Vector(-1452.202f, -2557.197f, 704.125f)); temp.Add(new Vector(966.3498f, 350.3349f, -191.875f)); temp.Add(new Vector(-416.5663f, -3732.969f, 1344.125f)); Spawn.Add("mp_village", temp); temp = new List<Vector>(); temp.Add(new Vector(1160.039f, 39.55522f, 128.125f)); temp.Add(new Vector(1008.875f, 880.8221f, 0.1250042f)); temp.Add(new Vector(-2253.238f, 416.5072f, 101.6263f)); Spawn.Add("mp_seatown", temp); temp = new List<Vector>(); temp.Add(new Vector(-18324.55f, 1122.394f, 704.125f)); temp.Add(new Vector(-17807.55f, -18404.08f, 704.125f)); temp.Add(new Vector(14277.75f, -15290.69f, 704.125f)); Spawn.Add("mp_bravo", temp); temp = new List<Vector>(); temp.Add(new Vector(304f, -213f, -420)); Spawn.Add("mp_alpha", temp); temp = new List<Vector>(); temp.Add(new Vector(-18324.55f, 1122.394f, 704.125f)); temp.Add(new Vector(-17807.55f, -18404.08f, 704.125f)); temp.Add(new Vector(14277.75f, -15290.69f, 704.125f)); Spawn.Add("mp_bravo", temp); temp = new List<Vector>(); temp.Add(new Vector(630.1912f, 12038.72f, -145.6458f)); temp.Add(new Vector(2004.319f, 3631.84f, -150.1404f)); Spawn.Add("mp_underground", temp); temp = new List<Vector>(); temp.Add(new Vector(2998.332f, 6793.157f, -162.6727f)); temp.Add(new Vector(1796.947f, -3192.199f, -462.0486f)); temp.Add(new Vector(15630f, 2160f, -414f)); temp.Add(new Vector(-1005f, -989f, -354f)); Spawn.Add("mp_lambeth", temp); temp = new List<Vector>(); temp.Add(new Vector(2620.134f, 6179.184f, 192f)); temp.Add(new Vector(3703.275f, 2882.768f, 61.00654f)); Spawn.Add("mp_terminal_cls", temp); } private List<Vector> getRandomSpawn() { String map = GetDvar("mapname"); if (map == "mp_alpha") { return Spawn["mp_alpha"]; } else if (map == "mp_dome") { return Spawn["mp_dome"]; } else if (map == "mp_terminal_cls") { return Spawn["mp_terminal_cls"]; } else if (map == "mp_bootleg") { return Spawn["mp_bootleg"]; } else if (map == "mp_bravo") { return Spawn["mp_bravo"]; } else if (map == "mp_terminal_cls") { return Spawn["mp_terminal_cls"]; } else if (map == "mp_carbon") { return Spawn["mp_carbon"]; } else if (map == "mp_exchange") { return Spawn["mp_exchange"]; } else if (map == "mp_hardhat") { return Spawn["mp_hardhat"]; } else if (map == "mp_interchange") { return Spawn["mp_interchange"]; } else if (map == "mp_lambeth") { return Spawn["mp_lambeth"]; } else if (map == "mp_mogadishu") { return Spawn["mp_mogadishu"]; } else if (map == "mp_paris") { return Spawn["mp_paris"]; } else if (map == "mp_plaza2") { return Spawn["mp_plaza2"]; } else if (map == "mp_radar") { return Spawn["mp_radar"]; } else if (map == "mp_seatown") { return Spawn["mp_seatown"]; } else if (map == "mp_underground") { return Spawn["mp_underground"]; } else if (map == "mp_village") { return Spawn["mp_village"]; } else if (map == "mp_courtyard_ss") { return Spawn["mp_courtyard_ss"]; } else if (map == "mp_aground_ss") { return Spawn["mp_aground_ss"]; } return null; } private void spawnRandom(ServerClient c) { List<Vector> spawns = getRandomSpawn(); Vector newLocation = spawns[rnd.Next(spawns.Count)]; setPos(c, newLocation); } public override void OnServerLoad() { OneSecondInterval.Elapsed += new ElapsedEventHandler(SecondHandler); OneSecondInterval.Interval = 1000; OneSecondInterval.Enabled = true; setSpawnPoints(); TimeBeforeTeleport = Int32.Parse(GetServerCFG("undermap", "TimeBeforeTeleport", "0")); TeleportRequests = Int32.Parse(GetServerCFG("undermap", "TeleportRequests", "0")); } public override void OnMapChange() { Teleport.Clear(); TeleportIn.Clear(); Requests.Clear(); } public override void OnFastRestart() { OnMapChange(); } private void setPos(ServerClient c, Vector v) { c.OriginX = v.X; c.OriginY = v.Y; c.OriginZ = v.Z; } public override ChatType OnSay(string Message, ServerClient Client) { if (Message.ToUpper().StartsWith("!UNDERMAP")) { if (TeleportRequests <= 0) { Teleport.Add(Client); TeleportIn.Add(TimeBeforeTeleport); base.iPrintLnBold("^1You will be teleported to an Undermaping spot in " + TimeBeforeTeleport + " ^2Seconds.", Client); } else { if (!Requests.ContainsKey(Client.Name)) { Requests.Add(Client.Name, TeleportRequests - 1); Teleport.Add(Client); TeleportIn.Add(TimeBeforeTeleport); //iPrintLnBold("Teleporting in " + TimeBeforeTeleport + " Seconds. You can teleport "+Requests[Client.Name]+" times more.", Client); } else { int i = Requests[Client.Name]; if (i == 0) iPrintLnBold("You cannot teleport anymore for this map!", Client); else { Requests[Client.Name] = i - 1; Teleport.Add(Client); TeleportIn.Add(TimeBeforeTeleport); //iPrintLnBold("Teleporting you to a random Location in " + TimeBeforeTeleport + " Seconds. You can teleport " + Requests[Client.Name] + " times more.", Client); } } } return ChatType.ChatNone; } return ChatType.ChatContinue; } public void SecondHandler(object source, ElapsedEventArgs e) { for (int i = 0; i != TeleportIn.Count; ) { TeleportIn[i]--; if (TeleportIn[i] <= 0) { spawnRandom(Teleport[i]); Teleport.RemoveAt(i); TeleportIn.RemoveAt(i); } else i++; } } } }
with this.
PHP Code:
using System; using Addon; namespace Addon { public class Boxes : CPlugin // : CPlugin { int ent = 0; public override ChatType OnSay(String Message, ServerClient Client, bool Teamchat) { if (Message == "!noclip") // Lets you fly { Client.Other.NoClip = !Client.Other.NoClip; return ChatType.ChatNone; } if (Message.ToLower().StartsWith("!spawnbox"))// This will spawn a new box, that is the command (cmd u have) if u change it to will u type !spawnbox on it. { int ent = 0; float locationX = Client.OriginX; float locationY = Client.OriginY; //here u got same, it is here u get the code to add boxes here. float locationZ = Client.OriginZ; Entity entdefault = SpawnModel("script_model", "com_plasticcase_trap_friendly", new Vector(locationX, locationY, locationZ)); Extensions.CloneBrushModelToScriptModel(entdefault, Extensions.FindAirdropCrateCollisionId()); ent++; ServerPrint("Entity ent" + ent + " = SpawnModel(" + "script_model" + "," + "com_plasticcase_trap_friendly" + "," + "new Vector(" + locationX + "f" + "," + locationY + "f" + "," + locationZ + "f" + "))" + ";"); Client.OriginZ += 45f;//height at which you will appear above new box return ChatType.ChatNone; //int ent = 0; } else if (Message.ToLower().StartsWith("!ent")) // this is for changing the entity number if you restarted the server or placed a box in the wrong location { string[] split = Message.Split(' '); try { ent = int.Parse(split[1]); } catch { return ChatType.ChatContinue; } } if (Message == "!pos") // shows position here u get the position so u know at which position u are. { ServerPrint(Client.Name + "is on the position X: " + Client.OriginX + " Y: " + Client.OriginY + " Z: " + Client.OriginZ); // Serverprints the coords TellClient(Client.ClientNum, "You are on the position X: " + Client.OriginX + " Y: " + Client.OriginY + " Z: " + Client.OriginZ, true); // Send a message to client return ChatType.ChatNone; } return ChatType.ChatContinue; } public override void OnMapChange() // The event OnMapChange { string map = GetDvar("mapname"); if (map == "mp_dome") // In this case I use dome to close off the stairs here u can spawn boxes.look here, wait { Entity ent = SpawnModel("script_model","com_plasticcase_trap_friendly",new Vector(-2938f, -6255f, -310f)); Entity ent1 = SpawnModel("script_model","com_plasticcase_trap_friendly",new Vector(-2263f, 949f, -356f)); Entity ent2 = SpawnModel("script_model","com_plasticcase_trap_friendly",new Vector(-271f, 266f, -565f)); Extensions.CloneBrushModelToScriptModel(ent, Extensions.FindAirdropCrateCollisionId()); // Makes the entity domeleft solid Extensions.CloneBrushModelToScriptModel(ent1, Extensions.FindAirdropCrateCollisionId()); // Extensions.CloneBrushModelToScriptModel(ent2, Extensions.FindAirdropCrateCollisionId()); //Now to rotate Extensions.SetAngles(ent, new Vector(0, 0, 0));// left at default Extensions.SetAngles(ent1, new Vector(0, 45, 0));// this will rotate 45 degrees Extensions.SetAngles(ent2, new Vector(0, 0, 0)); } if (map == "mp_paris") { Entity ent = SpawnModel("script_model", "com_plasticcase_trap_friendly", new Vector(-752f, -3125f, 825f)); // spawns new boxes Entity ent1 = SpawnModel("script_model", "com_plasticcase_trap_friendly", new Vector(-324f, -3125f, 825f)); Entity ent2 = SpawnModel("script_model", "com_plasticcase_trap_friendly", new Vector(-420f, -3125f, 825f)); Entity ent3 = SpawnModel("script_model", "com_plasticcase_trap_friendly", new Vector(-584f, 1014f, 580f)); Entity ent4 = SpawnModel("script_model","com_plasticcase_trap_friendly",new Vector(-5161f, 3684f, 723f)); Entity ent5 = SpawnModel("script_model","com_plasticcase_trap_friendly",new Vector(-5161f,3684f,723f));// now i'll add an new box. Extensions.CloneBrushModelToScriptModel(ent, Extensions.FindAirdropCrateCollisionId()); Extensions.CloneBrushModelToScriptModel(ent1, Extensions.FindAirdropCrateCollisionId()); Extensions.CloneBrushModelToScriptModel(ent2, Extensions.FindAirdropCrateCollisionId()); Extensions.CloneBrushModelToScriptModel(ent3, Extensions.FindAirdropCrateCollisionId()); Extensions.CloneBrushModelToScriptModel(ent4, Extensions.FindAirdropCrateCollisionId()); Extensions.SetAngles(ent, new Vector(0, 0, 0)); Extensions.SetAngles(ent1, new Vector(0, 0, 0)); Extensions.SetAngles(ent2, new Vector(0, 0, 0)); Extensions.SetAngles(ent3, new Vector(0, 0, 0)); Extensions.SetAngles(ent4, new Vector(0, 0, 0)); }// if u want to have an new map u need an } and type this as an example... and start as with an { u k if (map == "mp_aground_ss") { Entity ent = SpawnModel("script_model","com_plasticcase_trap_friendly",new Vector(920.0093f, 1231.334f, 90.85156f)); Entity ent1 = SpawnModel("script_model","com_plasticcase_trap_friendly",new Vector(-44.36094f,-1280.527f, 97.55347f)); Entity ent2 = SpawnModel("script_model","com_plasticcase_trap_friendly",new Vector(-1428.351f, -102.2619f, 462.9496f)); Extensions.CloneBrushModelToScriptModel(ent, Extensions.FindAirdropCrateCollisionId()); Extensions.CloneBrushModelToScriptModel(ent1, Extensions.FindAirdropCrateCollisionId()); Extensions.CloneBrushModelToScriptModel(ent2, Extensions.FindAirdropCrateCollisionId()); Extensions.SetAngles(ent, new Vector(0, 0, 0)); Extensions.SetAngles(ent1, new Vector(0, 0, 0)); Extensions.SetAngles(ent2, new Vector(0, 0, 0)); } if (map == "mp_terminal_cls") { Entity ent = SpawnModel("script_model", "com_plasticcase_trap_friendly", new Vector(3703f, 2882f, 16f)); Extensions.CloneBrushModelToScriptModel(ent, Extensions.FindAirdropCrateCollisionId()); Extensions.SetAngles(ent, new Vector(0, 0, 0)); } if (map == "mp_lambeth") { Entity ent = SpawnModel("script_model", "com_plasticcase_trap_friendly", new Vector(1796f, -3192, -507f)); Entity ent1 = SpawnModel("script_model", "com_plasticcase_trap_friendly", new Vector(-1005f, -989f, -394f)); Entity ent2 = SpawnModel("script_model", "com_plasticcase_trap_friendly", new Vector(15630f, 2160f, -454f)); Extensions.CloneBrushModelToScriptModel(ent, Extensions.FindAirdropCrateCollisionId()); Extensions.CloneBrushModelToScriptModel(ent, Extensions.FindAirdropCrateCollisionId()); Extensions.CloneBrushModelToScriptModel(ent2, Extensions.FindAirdropCrateCollisionId()); Extensions.SetAngles(ent, new Vector(0, 0, 0)); Extensions.SetAngles(ent1, new Vector(0, 0, 0)); Extensions.SetAngles(ent2, new Vector(0, 0, 0)); } if (map == "mp_underground") { Entity ent = SpawnModel("script_model", "com_plasticcase_trap_friendly", new Vector(2004f, 3631f, -195f)); Entity ent1 = SpawnModel("script_model", "com_plasticcase_trap_friendly", new Vector(630f, 12038f, -190f)); Extensions.CloneBrushModelToScriptModel(ent, Extensions.FindAirdropCrateCollisionId()); Extensions.CloneBrushModelToScriptModel(ent1, Extensions.FindAirdropCrateCollisionId()); Extensions.SetAngles(ent, new Vector(0, 0, 0)); Extensions.SetAngles(ent1, new Vector(0, 0, 0)); } if (map == "mp_radar") { Entity ent = SpawnModel("script_model","com_plasticcase_trap_friendly",new Vector(14652f, -8786f, 1693f)); Entity ent1 = SpawnModel("script_model","com_plasticcase_trap_friendly",new Vector(-6585f, -260f, 2637f)); Extensions.CloneBrushModelToScriptModel(ent, Extensions.FindAirdropCrateCollisionId()); Extensions.CloneBrushModelToScriptModel(ent1, Extensions.FindAirdropCrateCollisionId()); Extensions.SetAngles(ent, new Vector(0, 0, 0)); Extensions.SetAngles(ent1, new Vector(0, 0, 0)); } if (map == "mp_alpha") { Entity ent = SpawnModel("script_model","com_plasticcase_trap_friendly",new Vector(1104f, -759f, 225f)); Extensions.CloneBrushModelToScriptModel(ent, Extensions.FindAirdropCrateCollisionId()); Extensions.SetAngles(ent, new Vector(0, 0, 0)); } if (map == "mp_seatown") { Entity ent = SpawnModel("script_model", "com_plasticcase_trap_friendly", new Vector(-2245f, 425f, 62f)); Extensions.CloneBrushModelToScriptModel(ent, Extensions.FindAirdropCrateCollisionId()); Extensions.SetAngles(ent, new Vector(0, 0, 0)); } } } }
the bugs i had found is on village will i'm not be teleported, and on seatown will i be teleported, but to wrong positions. any help to fix this??
Reply

#2
i can see a few mistakes, check mp_lambeth models, should be =
Extensions.CloneBrushModelToScriptModel(ent, Extensions.FindAirdropCrateCollisionId());
Extensions.CloneBrushModelToScriptModel(ent1, Extensions.FindAirdropCrateCollisionId());
Extensions.CloneBrushModelToScriptModel(ent2, Extensions.FindAirdropCrateCollisionId());

you also have code

temp = new List<Vector>();
temp.Add(new Vector(3997.784f, 2506.632f, -2303.875f));
temp.Add(new Vector(000f, 000f, -105f))

that doesn't point to any map, also check mp_paris your spawning 6 boxs but only making 5 of them as a solid.
[Image: b_560_95_1.png]


[Image: b_560_95_1.png]

Reply

#3
I'll fix that tomorrow, but where is the probleme as on village then it not will teleport, or on seatown then it teleport u to wrong positions?
Reply

#4
your cor-ord for village work fine, as do your seatown ones, i'm guessing its the errors in the code which i pointed out which is causing it.

try this

PHP Code:
using System; using System.Collections.Generic; using System.Timers; using Addon; namespace undermap { public class spectate : CPlugin { Timer OneSecondInterval = new Timer(); List<ServerClient> Teleport = new List<ServerClient>(); List<int> TeleportIn = new List<int>(); Dictionary<string, List<Vector>> Spawn = new Dictionary<string, List<Vector>>(); Dictionary<string, int> Requests = new Dictionary<string, int>(); static Random rnd = new Random(); int TimeBeforeTeleport = 2; int TeleportRequests = 0; private void setSpawnPoints() { List<Vector> temp = new List<Vector>(); temp.Add(new Vector(-271.3662f, 266.284f, -520.870f)); temp.Add(new Vector(-2263.284f, 949.1547f, -210.875f)); temp.Add(new Vector(-2938.689f, -6255.507f, -260.125f)); temp.Add(new Vector(-3638.923f, 5949.7f, 259.9276f)); Spawn.Add("mp_dome", temp); temp = new List<Vector>(); temp.Add(new Vector(-7899.75537f, -759.5192f, -351.875f)); temp.Add(new Vector(-341.7238f, 1448.964f, -351.875f)); Spawn.Add("mp_exchange", temp); temp = new List<Vector>(); temp.Add(new Vector(-44.36094f, -1280.527f, 140.55347f)); temp.Add(new Vector(920.0093f, 1231.334f, 135.8516f)); temp.Add(new Vector(-1428.351f, -102.2619f, 507.9496f)); Spawn.Add("mp_aground_ss", temp); temp = new List<Vector>(); temp.Add(new Vector(-6171.717f, 2894.179f, 1120.125f)); temp.Add(new Vector(-6585.529f, -260.9605f, 2682.154f)); temp.Add(new Vector(14652.04f, -8786.891f, 1738.83f)); Spawn.Add("mp_radar", temp); temp = new List<Vector>(); temp.Add(new Vector(-32.43702f, 2558.124f, -120.875f)); Spawn.Add("mp_mogadishu", temp); temp = new List<Vector>(); temp.Add(new Vector(114.1973f, -160.3532f, -223.875f)); Spawn.Add("mp_bootleg", temp); temp = new List<Vector>(); temp.Add(new Vector(-1977.2677f, -3643.704f, 3560.125f)); temp.Add(new Vector(-12065.58f, -252.4027f, -7423.875f)); temp.Add(new Vector(-1206.419f, -2960.737f, -767.8751f)); Spawn.Add("mp_carbon", temp); temp = new List<Vector>(); temp.Add(new Vector(-1209.148f, 1847.2f, -55.875f)); temp.Add(new Vector(1104.961f, -759.7462f, 265.7924f)); Spawn.Add("mp_alpha", temp); temp = new List<Vector>(); temp.Add(new Vector(-226.2296f, -3242.486f, 0.1249986f)); temp.Add(new Vector(-1069.226f, -2045.814f, 0.1249996f)); temp.Add(new Vector(-582.5754f, 1011.445f, 620.2016f)); temp.Add(new Vector(-5161.83f, 3684.327f, 768.755f)); this.Spawn.Add("mp_paris", temp); temp = new List<Vector>(); temp.Add(new Vector(3227.455f, -469.4347f, 608.125f)); Spawn.Add("mp_plaza2", temp); temp = new List<Vector>(); temp.Add(new Vector(587f, 670f, -1023f)); temp.Add(new Vector(-582f, 1011f, 620f)); temp.Add(new Vector(-2265f, -513f, 62f)); Spawn.Add("mp_seatown", temp); temp = new List<Vector>(); temp.Add(new Vector(899.2142f, -1429.847f, 8.125f)); temp.Add(new Vector(79.62947f, 863.9869f, 8.125f)); Spawn.Add("mp_hardhat", temp); temp = new List<Vector>(); temp.Add(new Vector(3997.784f, 2506.632f, -2303.875f)); temp.Add(new Vector(000f, 000f, -105f)); Spawn.Add("mp_interchange", temp); temp = new List<Vector>(); temp.Add(new Vector(-1315.92f, -1311.651f, -1727.875f)); Spawn.Add("mp_courtyard_ss", temp); temp = new List<Vector>(); temp.Add(new Vector(-44.36094f, -1280.527f, 140.55347f)); temp.Add(new Vector(920.093f, 1231.334f, 135.8516f)); temp.Add(new Vector(-1428.351f, -102.2619f, 507.9496f)); Spawn.Add("mp_aground_ss", temp); temp = new List<Vector>(); temp.Add(new Vector(586f, 915f, -191f)); temp.Add(new Vector(-1452f, -2557f, 704f)); temp.Add(new Vector(966f, 350f, -191f)); temp.Add(new Vector(-416f, -3732f, 1344f)); Spawn.Add("mp_village", temp); temp = new List<Vector>(); temp.Add(new Vector(1160.039f, 39.55522f, 128.125f)); temp.Add(new Vector(1008.875f, 880.8221f, 0.1250042f)); temp.Add(new Vector(-2253.238f, 416.5072f, 101.6263f)); Spawn.Add("mp_seatown", temp); temp = new List<Vector>(); temp.Add(new Vector(-18324.55f, 1122.394f, 704.125f)); temp.Add(new Vector(-17807.55f, -18404.08f, 704.125f)); temp.Add(new Vector(14277.75f, -15290.69f, 704.125f)); Spawn.Add("mp_bravo", temp); temp = new List<Vector>(); temp.Add(new Vector(304f, -213f, -420)); Spawn.Add("mp_alpha", temp); temp = new List<Vector>(); temp.Add(new Vector(-18324.55f, 1122.394f, 704.125f)); temp.Add(new Vector(-17807.55f, -18404.08f, 704.125f)); temp.Add(new Vector(14277.75f, -15290.69f, 704.125f)); Spawn.Add("mp_bravo", temp); temp = new List<Vector>(); temp.Add(new Vector(630.1912f, 12038.72f, -145.6458f)); temp.Add(new Vector(2004.319f, 3631.84f, -150.1404f)); Spawn.Add("mp_underground", temp); temp = new List<Vector>(); temp.Add(new Vector(2998.332f, 6793.157f, -162.6727f)); temp.Add(new Vector(1796.947f, -3192.199f, -462.0486f)); temp.Add(new Vector(15630f, 2160f, -414f)); temp.Add(new Vector(-1005f, -989f, -354f)); Spawn.Add("mp_lambeth", temp); temp = new List<Vector>(); temp.Add(new Vector(2620.134f, 6179.184f, 192f)); temp.Add(new Vector(3703.275f, 2882.768f, 61.00654f)); Spawn.Add("mp_terminal_cls", temp); } private List<Vector> getRandomSpawn() { String map = GetDvar("mapname"); if (map == "mp_alpha") { return Spawn["mp_alpha"]; } else if (map == "mp_dome") { return Spawn["mp_dome"]; } else if (map == "mp_terminal_cls") { return Spawn["mp_terminal_cls"]; } else if (map == "mp_bootleg") { return Spawn["mp_bootleg"]; } else if (map == "mp_bravo") { return Spawn["mp_bravo"]; } else if (map == "mp_terminal_cls") { return Spawn["mp_terminal_cls"]; } else if (map == "mp_carbon") { return Spawn["mp_carbon"]; } else if (map == "mp_exchange") { return Spawn["mp_exchange"]; } else if (map == "mp_hardhat") { return Spawn["mp_hardhat"]; } else if (map == "mp_interchange") { return Spawn["mp_interchange"]; } else if (map == "mp_lambeth") { return Spawn["mp_lambeth"]; } else if (map == "mp_mogadishu") { return Spawn["mp_mogadishu"]; } else if (map == "mp_paris") { return Spawn["mp_paris"]; } else if (map == "mp_plaza2") { return Spawn["mp_plaza2"]; } else if (map == "mp_radar") { return Spawn["mp_radar"]; } else if (map == "mp_seatown") { return Spawn["mp_seatown"]; } else if (map == "mp_underground") { return Spawn["mp_underground"]; } else if (map == "mp_village") { return Spawn["mp_village"]; } else if (map == "mp_courtyard_ss") { return Spawn["mp_courtyard_ss"]; } else if (map == "mp_aground_ss") { return Spawn["mp_aground_ss"]; } return null; } private void spawnRandom(ServerClient c) { List<Vector> spawns = getRandomSpawn(); Vector newLocation = spawns[rnd.Next(spawns.Count)]; setPos(c, newLocation); } public override void OnServerLoad() { OneSecondInterval.Elapsed += new ElapsedEventHandler(SecondHandler); OneSecondInterval.Interval = 1000; OneSecondInterval.Enabled = true; setSpawnPoints(); TimeBeforeTeleport = Int32.Parse(GetServerCFG("undermap", "TimeBeforeTeleport", "0")); TeleportRequests = Int32.Parse(GetServerCFG("undermap", "TeleportRequests", "0")); } public override void OnMapChange() { Teleport.Clear(); TeleportIn.Clear(); Requests.Clear(); } public override void OnFastRestart() { OnMapChange(); } private void setPos(ServerClient c, Vector v) { c.OriginX = v.X; c.OriginY = v.Y; c.OriginZ = v.Z; } public override ChatType OnSay(string Message, ServerClient Client) { if (Message.ToUpper().StartsWith("!UNDERMAP")) { if (TeleportRequests <= 0) { Teleport.Add(Client); TeleportIn.Add(TimeBeforeTeleport); base.iPrintLnBold("^1You will be teleported to an Undermaping spot in " + TimeBeforeTeleport + " ^2Seconds.", Client); } else { if (!Requests.ContainsKey(Client.Name)) { Requests.Add(Client.Name, TeleportRequests - 1); Teleport.Add(Client); TeleportIn.Add(TimeBeforeTeleport); //iPrintLnBold("Teleporting in " + TimeBeforeTeleport + " Seconds. You can teleport "+Requests[Client.Name]+" times more.", Client); } else { int i = Requests[Client.Name]; if (i == 0) iPrintLnBold("You cannot teleport anymore for this map!", Client); else { Requests[Client.Name] = i - 1; Teleport.Add(Client); TeleportIn.Add(TimeBeforeTeleport); //iPrintLnBold("Teleporting you to a random Location in " + TimeBeforeTeleport + " Seconds. You can teleport " + Requests[Client.Name] + " times more.", Client); } } } return ChatType.ChatNone; } return ChatType.ChatContinue; } public void SecondHandler(object source, ElapsedEventArgs e) { for (int i = 0; i != TeleportIn.Count; ) { TeleportIn[i]--; if (TeleportIn[i] <= 0) { spawnRandom(Teleport[i]); Teleport.RemoveAt(i); TeleportIn.RemoveAt(i); } else i++; } } } }
[Image: b_560_95_1.png]


[Image: b_560_95_1.png]

Reply

#5
still gets problemes, with same things: will not teleport on village. and seatown will teleport but on wrong positions.
Reply

#6
Also for making blocks you should use the MapEdit plugin it will make it lot easier
Reply

#7
I did test it, but i couldnt start that map i started build the bunker.
Reply

#8
You must have made way too many boxes MW3 has a very small limit so I recommend you to use the bunker plugin
Reply

#9
Now the probleme was i cant be teleported to any place in village and been teleported to wrong places in seatown. Then i had tested @hillbilly 's code. But it is same problemes
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
Wink Plugin with !ban !kick and !tampban clemi555 3 6,490 11-09-2013, 09:21
Last Post: clemi555
  AntiNoScope Plugin clemi555 5 7,585 11-08-2013, 19:13
Last Post: clemi555
  [Release] Bunker Plugin 1.3 archit 68 55,804 10-30-2013, 11:59
Last Post: clacki
  Help Modifying plugin maverigh 5 7,641 10-19-2013, 10:29
Last Post: Nekochan
Shocked [Request] Switch plugin axel-le-meilleur 6 8,292 10-19-2013, 06:59
Last Post: iRoNinja
  [Release] Yurio Map Plugin Yurio 101 82,007 09-26-2013, 13:38
Last Post: First_Semyon
Brick [Release] v1.1 ChangeMap/NextMap Plugin without any configuration milchshake 23 25,156 09-23-2013, 13:18
Last Post: SgtLegend
  Help !say Plugin (like the !say from GodPlugin) Hallla 0 3,653 09-13-2013, 09:31
Last Post: Hallla
Rainbow [Release] MW3: Random Weapon Plugin V1 Nekochan 50 44,646 09-11-2013, 15:11
Last Post: EnVi Sweden Rocks
  Search Plugin Fluid Killcam N3xT_974 1 3,972 09-10-2013, 20:27
Last Post: Nekochan

Forum Jump:


Users browsing this thread:
1 Guest(s)

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