Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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<
ServerClientTeleport = new List<ServerClient>();
        List<
intTeleportIn = new List<int>();
        
Dictionary<string, List<Vector>> Spawn = new Dictionary<string, List<Vector>>();
        
Dictionary<stringintRequests = new Dictionary<stringint>();
        static 
Random rnd = new Random();
        
int TimeBeforeTeleport 2;
        
int TeleportRequests 0;

        private 
void setSpawnPoints()
        {
            List<
Vectortemp = new List<Vector>();
            
temp.Add(new Vector(-271.3662f266.284f, -520.870f));
            
temp.Add(new Vector(-2263.284f949.1547f, -210.875f));
            
temp.Add(new Vector(-2938.689f, -6255.507f, -260.125f));
            
temp.Add(new Vector(-3638.923f5949.7f259.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.7238f1448.964f, -351.875f));
            
Spawn.Add("mp_exchange"temp);
    
            
temp = new List<Vector>();
            
temp.Add(new Vector(-44.36094f, -1280.527f140.55347f));
            
temp.Add(new Vector(920.0093f1231.334f135.8516f));
            
temp.Add(new Vector(-1428.351f, -102.2619f507.9496f));
            
Spawn.Add("mp_aground_ss"temp);
        
            
temp = new List<Vector>();
            
temp.Add(new Vector(-6171.717f2894.179f1120.125f));
            
temp.Add(new Vector(-6585.529f, -260.9605f2682.154f));
            
temp.Add(new Vector(14652.04f, -8786.891f1738.83f));
            
Spawn.Add("mp_radar"temp);
            
            
temp = new List<Vector>();
            
temp.Add(new Vector(-32.43702f2558.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.704f3560.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.148f1847.2f, -55.875f));
            
temp.Add(new Vector(1104.961f, -759.7462f265.7924f));
            
Spawn.Add("mp_alpha"temp);
                            
            
temp = new List<Vector>();
            
temp.Add(new Vector(-226.2296f, -3242.486f0.1249986f));
            
temp.Add(new Vector(-1069.226f, -2045.814f0.1249996f));
            
temp.Add(new Vector(-582.5754f1011.445f620.2016f));
            
temp.Add(new Vector(-5161.83f3684.327f768.755f));
            
this.Spawn.Add("mp_paris"temp);
                                
            
temp = new List<Vector>();
            
temp.Add(new Vector(3227.455f, -469.4347f608.125f));
            
Spawn.Add("mp_plaza2"temp);
                                    
            
temp = new List<Vector>();
            
temp.Add(new Vector(587.1492f670.2912f, -1023.875f));
            
temp.Add(new Vector(-582.5754f1011.445f620.2016f));
            
temp.Add(new Vector(-2265.172f, -513.6675f62.5587f));
            
Spawn.Add("mp_seatown"temp);
                                        
            
temp = new List<Vector>();
            
temp.Add(new Vector(899.2142f, -1429.847f8.125f));
            
temp.Add(new Vector(79.62947f863.9869f8.125f));
            
Spawn.Add("mp_hardhat"temp);
                                            
            
temp = new List<Vector>();
            
temp.Add(new Vector(3997.784f2506.632f, -2303.875f));
            
temp.Add(new Vector(000f000f, -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.527f140.55347f));
            
temp.Add(new Vector(920.093f1231.334f135.8516f));
            
temp.Add(new Vector(-1428.351f, -102.2619f507.9496f));
            
Spawn.Add("mp_aground_ss"temp);
                                                    
            
temp = new List<Vector>();
            
temp.Add(new Vector(586.6773f915.8278f, -191.875f));
            
temp.Add(new Vector(-1452.202f, -2557.197f704.125f));
            
temp.Add(new Vector(966.3498f350.3349f, -191.875f));
            
temp.Add(new Vector(-416.5663f, -3732.969f1344.125f));
            
Spawn.Add("mp_village"temp);
                                                        
            
temp = new List<Vector>();
            
temp.Add(new Vector(1160.039f39.55522f128.125f));
            
temp.Add(new Vector(1008.875f880.8221f0.1250042f));
            
temp.Add(new Vector(-2253.238f416.5072f101.6263f));
            
Spawn.Add("mp_seatown"temp);
                                                            
            
temp = new List<Vector>();
            
temp.Add(new Vector(-18324.55f1122.394f704.125f));
            
temp.Add(new Vector(-17807.55f, -18404.08f704.125f));
            
temp.Add(new Vector(14277.75f, -15290.69f704.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.55f1122.394f704.125f));
            
temp.Add(new Vector(-17807.55f, -18404.08f704.125f));
            
temp.Add(new Vector(14277.75f, -15290.69f704.125f));
            
Spawn.Add("mp_bravo"temp);
                                                                        
            
temp = new List<Vector>();
            
temp.Add(new Vector(630.1912f12038.72f, -145.6458f));
            
temp.Add(new Vector(2004.319f3631.84f, -150.1404f));
            
Spawn.Add("mp_underground"temp);
                                                                            
            
temp = new List<Vector>();
            
temp.Add(new Vector(2998.332f6793.157f, -162.6727f));
            
temp.Add(new Vector(1796.947f, -3192.199f, -462.0486f));
            
temp.Add(new Vector(15630f2160f, -414f));
            
temp.Add(new Vector(-1005f, -989f, -354f));
            
Spawn.Add("mp_lambeth"temp);
                                                                                
            
temp = new List<Vector>();
            
temp.Add(new Vector(2620.134f6179.184f192f));
            
temp.Add(new Vector(3703.275f2882.768f61.00654f));
            
Spawn.Add("mp_terminal_cls"temp);

        }
           
         
        private List<
VectorgetRandomSpawn()
        {
            
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<
Vectorspawns getRandomSpawn();
            
Vector newLocation spawns[rnd.Next(spawns.Count)];
            
setPos(cnewLocation);
        }

        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 cVector v)
        {
            
c.OriginX v.X;
            
c.OriginY v.Y;
            
c.OriginZ v.Z;
        }

        public 
override ChatType OnSay(string MessageServerClient 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.NameTeleportRequests 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 (
== 0)
                            
iPrintLnBold("You cannot teleport anymore for this map!"Client);
                        else
                        {
                            
Requests[Client.Name] = 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 sourceElapsedEventArgs e)
        {
            for (
int i 0!= 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 MessageServerClient Clientbool 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(locationXlocationYlocationZ));
                
Extensions.CloneBrushModelToScriptModel(entdefaultExtensions.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.OriginZtrue); // 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(-2263f949f, -356f));
                
Entity ent2 SpawnModel("script_model","com_plasticcase_trap_friendly",new Vector(-271f266f, -565f));
                
Extensions.CloneBrushModelToScriptModel(entExtensions.FindAirdropCrateCollisionId()); // Makes the entity domeleft solid
                
Extensions.CloneBrushModelToScriptModel(ent1Extensions.FindAirdropCrateCollisionId()); // 
                
Extensions.CloneBrushModelToScriptModel(ent2Extensions.FindAirdropCrateCollisionId());
 

                
//Now to rotate
                
Extensions.SetAngles(ent, new Vector(000));// left at default
                
Extensions.SetAngles(ent1, new Vector(0450));// this will rotate 45 degrees
                
Extensions.SetAngles(ent2, new Vector(000));
            }
            if (
map == "mp_paris")
            {        
                
Entity ent SpawnModel("script_model""com_plasticcase_trap_friendly", new Vector(-752f, -3125f825f)); // spawns new boxes
                
Entity ent1 SpawnModel("script_model""com_plasticcase_trap_friendly", new Vector(-324f, -3125f825f));
                
Entity ent2 SpawnModel("script_model""com_plasticcase_trap_friendly", new Vector(-420f, -3125f825f));
                
Entity ent3 SpawnModel("script_model""com_plasticcase_trap_friendly", new Vector(-584f1014f580f));
                
Entity ent4 SpawnModel("script_model","com_plasticcase_trap_friendly",new Vector(-5161f3684f723f));
                
Entity ent5 SpawnModel("script_model","com_plasticcase_trap_friendly",new Vector(-5161f,3684f,723f));// now i'll add an new box. 
                
Extensions.CloneBrushModelToScriptModel(entExtensions.FindAirdropCrateCollisionId());
                
Extensions.CloneBrushModelToScriptModel(ent1Extensions.FindAirdropCrateCollisionId()); 
                
Extensions.CloneBrushModelToScriptModel(ent2Extensions.FindAirdropCrateCollisionId());
                
Extensions.CloneBrushModelToScriptModel(ent3Extensions.FindAirdropCrateCollisionId()); 
                
Extensions.CloneBrushModelToScriptModel(ent4Extensions.FindAirdropCrateCollisionId());                  
              
                
Extensions.SetAngles(ent, new Vector(000));
                
Extensions.SetAngles(ent1, new Vector(000));
                
Extensions.SetAngles(ent2, new Vector(000));
                
Extensions.SetAngles(ent3, new Vector(000));
                
Extensions.SetAngles(ent4, new Vector(000));
            }
// 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.0093f1231.334f90.85156f));
                
Entity ent1 SpawnModel("script_model","com_plasticcase_trap_friendly",new Vector(-44.36094f,-1280.527f97.55347f));
                
Entity ent2 SpawnModel("script_model","com_plasticcase_trap_friendly",new Vector(-1428.351f, -102.2619f462.9496f));
                
Extensions.CloneBrushModelToScriptModel(entExtensions.FindAirdropCrateCollisionId());
                
Extensions.CloneBrushModelToScriptModel(ent1Extensions.FindAirdropCrateCollisionId());
                
Extensions.CloneBrushModelToScriptModel(ent2Extensions.FindAirdropCrateCollisionId());

                
Extensions.SetAngles(ent, new Vector(000));
                
Extensions.SetAngles(ent1, new Vector(000));
                
Extensions.SetAngles(ent2, new Vector(000));
            }
            if (
map == "mp_terminal_cls")
            {
                
Entity ent SpawnModel("script_model""com_plasticcase_trap_friendly", new Vector(3703f2882f16f));
                
Extensions.CloneBrushModelToScriptModel(entExtensions.FindAirdropCrateCollisionId());

                
Extensions.SetAngles(ent, new Vector(000));
            }
            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(15630f2160f, -454f));
                
Extensions.CloneBrushModelToScriptModel(entExtensions.FindAirdropCrateCollisionId()); 
                
Extensions.CloneBrushModelToScriptModel(entExtensions.FindAirdropCrateCollisionId()); 
                
Extensions.CloneBrushModelToScriptModel(ent2Extensions.FindAirdropCrateCollisionId());

                
Extensions.SetAngles(ent, new Vector(000));
                
Extensions.SetAngles(ent1, new Vector(000));
                
Extensions.SetAngles(ent2, new Vector(000));
            }
            if (
map == "mp_underground")
            {
                
Entity ent SpawnModel("script_model""com_plasticcase_trap_friendly", new Vector(2004f3631f, -195f));
                
Entity ent1 SpawnModel("script_model""com_plasticcase_trap_friendly", new Vector(630f12038f, -190f));
                
Extensions.CloneBrushModelToScriptModel(entExtensions.FindAirdropCrateCollisionId());
                
Extensions.CloneBrushModelToScriptModel(ent1Extensions.FindAirdropCrateCollisionId());

                
Extensions.SetAngles(ent, new Vector(000));
                
Extensions.SetAngles(ent1, new Vector(000));
             }
             if (
map == "mp_radar")
             {
                
Entity ent SpawnModel("script_model","com_plasticcase_trap_friendly",new Vector(14652f, -8786f1693f));
                
Entity ent1 SpawnModel("script_model","com_plasticcase_trap_friendly",new Vector(-6585f, -260f2637f));
                
Extensions.CloneBrushModelToScriptModel(entExtensions.FindAirdropCrateCollisionId());
                
Extensions.CloneBrushModelToScriptModel(ent1Extensions.FindAirdropCrateCollisionId());

                
Extensions.SetAngles(ent, new Vector(000));
                
Extensions.SetAngles(ent1, new Vector(000));
               
             }
             if (
map == "mp_alpha")
             {
                
Entity ent SpawnModel("script_model","com_plasticcase_trap_friendly",new Vector(1104f, -759f225f));
                
Extensions.CloneBrushModelToScriptModel(entExtensions.FindAirdropCrateCollisionId());

                
Extensions.SetAngles(ent, new Vector(000));
             }
             if (
map == "mp_seatown")
             {
                
Entity ent SpawnModel("script_model""com_plasticcase_trap_friendly", new Vector(-2245f425f62f));
                
Extensions.CloneBrushModelToScriptModel(entExtensions.FindAirdropCrateCollisionId());

                
Extensions.SetAngles(ent, new Vector(000));
            }
        }
    }

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<
ServerClientTeleport = new List<ServerClient>();
        List<
intTeleportIn = new List<int>();
        
Dictionary<string, List<Vector>> Spawn = new Dictionary<string, List<Vector>>();
        
Dictionary<stringintRequests = new Dictionary<stringint>();
        static 
Random rnd = new Random();
        
int TimeBeforeTeleport 2;
        
int TeleportRequests 0;

        private 
void setSpawnPoints()
        {
            List<
Vectortemp = new List<Vector>();
            
temp.Add(new Vector(-271.3662f266.284f, -520.870f));
            
temp.Add(new Vector(-2263.284f949.1547f, -210.875f));
            
temp.Add(new Vector(-2938.689f, -6255.507f, -260.125f));
            
temp.Add(new Vector(-3638.923f5949.7f259.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.7238f1448.964f, -351.875f));
            
Spawn.Add("mp_exchange"temp);

            
temp = new List<Vector>();
            
temp.Add(new Vector(-44.36094f, -1280.527f140.55347f));
            
temp.Add(new Vector(920.0093f1231.334f135.8516f));
            
temp.Add(new Vector(-1428.351f, -102.2619f507.9496f));
            
Spawn.Add("mp_aground_ss"temp);

            
temp = new List<Vector>();
            
temp.Add(new Vector(-6171.717f2894.179f1120.125f));
            
temp.Add(new Vector(-6585.529f, -260.9605f2682.154f));
            
temp.Add(new Vector(14652.04f, -8786.891f1738.83f));
            
Spawn.Add("mp_radar"temp);

            
temp = new List<Vector>();
            
temp.Add(new Vector(-32.43702f2558.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.704f3560.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.148f1847.2f, -55.875f));
            
temp.Add(new Vector(1104.961f, -759.7462f265.7924f));
            
Spawn.Add("mp_alpha"temp);

            
temp = new List<Vector>();
            
temp.Add(new Vector(-226.2296f, -3242.486f0.1249986f));
            
temp.Add(new Vector(-1069.226f, -2045.814f0.1249996f));
            
temp.Add(new Vector(-582.5754f1011.445f620.2016f));
            
temp.Add(new Vector(-5161.83f3684.327f768.755f));
            
this.Spawn.Add("mp_paris"temp);

            
temp = new List<Vector>();
            
temp.Add(new Vector(3227.455f, -469.4347f608.125f));
            
Spawn.Add("mp_plaza2"temp);

            
temp = new List<Vector>();
            
temp.Add(new Vector(587f670f, -1023f));
            
temp.Add(new Vector(-582f1011f620f));
            
temp.Add(new Vector(-2265f, -513f62f));
            
Spawn.Add("mp_seatown"temp);

            
temp = new List<Vector>();
            
temp.Add(new Vector(899.2142f, -1429.847f8.125f));
            
temp.Add(new Vector(79.62947f863.9869f8.125f));
            
Spawn.Add("mp_hardhat"temp);

            
temp = new List<Vector>();
            
temp.Add(new Vector(3997.784f2506.632f, -2303.875f));
            
temp.Add(new Vector(000f000f, -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.527f140.55347f));
            
temp.Add(new Vector(920.093f1231.334f135.8516f));
            
temp.Add(new Vector(-1428.351f, -102.2619f507.9496f));
            
Spawn.Add("mp_aground_ss"temp);

            
temp = new List<Vector>();
            
temp.Add(new Vector(586f915f, -191f));
            
temp.Add(new Vector(-1452f, -2557f704f));
            
temp.Add(new Vector(966f350f, -191f));
            
temp.Add(new Vector(-416f, -3732f1344f));
            
Spawn.Add("mp_village"temp);

            
temp = new List<Vector>();
            
temp.Add(new Vector(1160.039f39.55522f128.125f));
            
temp.Add(new Vector(1008.875f880.8221f0.1250042f));
            
temp.Add(new Vector(-2253.238f416.5072f101.6263f));
            
Spawn.Add("mp_seatown"temp);

            
temp = new List<Vector>();
            
temp.Add(new Vector(-18324.55f1122.394f704.125f));
            
temp.Add(new Vector(-17807.55f, -18404.08f704.125f));
            
temp.Add(new Vector(14277.75f, -15290.69f704.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.55f1122.394f704.125f));
            
temp.Add(new Vector(-17807.55f, -18404.08f704.125f));
            
temp.Add(new Vector(14277.75f, -15290.69f704.125f));
            
Spawn.Add("mp_bravo"temp);

            
temp = new List<Vector>();
            
temp.Add(new Vector(630.1912f12038.72f, -145.6458f));
            
temp.Add(new Vector(2004.319f3631.84f, -150.1404f));
            
Spawn.Add("mp_underground"temp);

            
temp = new List<Vector>();
            
temp.Add(new Vector(2998.332f6793.157f, -162.6727f));
            
temp.Add(new Vector(1796.947f, -3192.199f, -462.0486f));
            
temp.Add(new Vector(15630f2160f, -414f));
            
temp.Add(new Vector(-1005f, -989f, -354f));
            
Spawn.Add("mp_lambeth"temp);

            
temp = new List<Vector>();
            
temp.Add(new Vector(2620.134f6179.184f192f));
            
temp.Add(new Vector(3703.275f2882.768f61.00654f));
            
Spawn.Add("mp_terminal_cls"temp);

        }


        private List<
VectorgetRandomSpawn()
        {
            
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<
Vectorspawns getRandomSpawn();
            
Vector newLocation spawns[rnd.Next(spawns.Count)];
            
setPos(cnewLocation);
        }

        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 cVector v)
        {
            
c.OriginX v.X;
            
c.OriginY v.Y;
            
c.OriginZ v.Z;
        }

        public 
override ChatType OnSay(string MessageServerClient 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.NameTeleportRequests 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 (
== 0)
                            
iPrintLnBold("You cannot teleport anymore for this map!"Client);
                        else
                        {
                            
Requests[Client.Name] = 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 sourceElapsedEventArgs e)
        {
            for (
int i 0!= 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 4,161 11-09-2013, 09:21
Last Post: clemi555
  AntiNoScope Plugin clemi555 5 4,744 11-08-2013, 19:13
Last Post: clemi555
  [Release] Bunker Plugin 1.3 archit 68 41,513 10-30-2013, 11:59
Last Post: clacki
  Help Modifying plugin maverigh 5 5,667 10-19-2013, 10:29
Last Post: Nekochan
Shocked [Request] Switch plugin axel-le-meilleur 6 5,176 10-19-2013, 06:59
Last Post: iRoNinja
  [Release] Yurio Map Plugin Yurio 101 62,264 09-26-2013, 13:38
Last Post: First_Semyon
Brick [Release] v1.1 ChangeMap/NextMap Plugin without any configuration milchshake 23 18,634 09-23-2013, 13:18
Last Post: SgtLegend
  Help !say Plugin (like the !say from GodPlugin) Hallla 0 2,711 09-13-2013, 09:31
Last Post: Hallla
Rainbow [Release] MW3: Random Weapon Plugin V1 Nekochan 50 33,266 09-11-2013, 15:11
Last Post: EnVi Sweden Rocks
  Search Plugin Fluid Killcam N3xT_974 1 3,063 09-10-2013, 20:27
Last Post: Nekochan

Forum Jump:


Users browsing this thread:
2 Guest(s)

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