• 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Release Flag plugin for developers
#11
(09-09-2012, 13:25)surtek Wrote:
(09-09-2012, 13:18)OrangePL Wrote: Why two threads?

2 different plugins.

Plugins are same.
Code and creators are different lol
C++/Obj-C developer. Neko engine wip
Steam: Click
  Reply
#12
(09-09-2012, 14:00)JayDi Wrote:
(09-09-2012, 13:25)surtek Wrote:
(09-09-2012, 13:18)OrangePL Wrote: Why two threads?

2 different plugins.

Plugins are same.
Code and creators are different lol

not quite the same.
  Reply
#13
I copied this code to microsoft visual C# 2010 express and build in mw3 plugin folder and when i try to load the console, it doesnt say that the plugin is loaded, but other plugin does load. And when i join the server, i dont see any flags in resistance or terminal or seatown(the last 2 i made by own)
this is the code:
Code:
using System;
using System.Collections.Generic;
using Addon;
using System.Threading;
using System.IO;
using System.Collections;
namespace flags
{
    public class flags : CPlugin
    {
        Dictionary<int, int> Client_HudElem_lm = new Dictionary<int, int>();

        public override void OnServerLoad()
        {
            ServerPrint("Flags plugin by Litgar loaded!");
        }

        public override void OnMapChange()
        {
            string map = GetDvar("mapname");
            if (map == "mp_terminal_cls")
            {
                Entity w = SpawnModel("script_model", "prop_flag_neutral", new Vector(650f, 3880f, 340f));
                Entity w1 = SpawnModel("script_model", "prop_flag_neutral", new Vector(-1000f, 6000f, 320f));
            }
            if (map == "mp_seatown")
            {
                Entity w = SpawnModel("script_model", "prop_flag_neutral", new Vector(1200f, 500f, 180f));
                Entity w1 = SpawnModel("script_model", "prop_flag_neutral", new Vector(1500f, 500f, 565f));
            }
            if (map == "mp_paris")
            {
                Entity w = SpawnModel("script_model", "prop_flag_neutral", new Vector(-2179.646f, -205.2038f, 185.125f));
                Entity w1 = SpawnModel("script_model", "prop_flag_neutral", new Vector(-585.984f, 875.5912f, 1293.608f));
            }
        }


        public override void OnAddonFrame()
        {
            List<ServerClient> clients;
            try
            {
                clients = GetClients();
                if (clients != null && clients.Count > 0)
                {
                    foreach (ServerClient c in GetClients())
                    {
                        if (c.Other.isAlive == true)
                        {
                            HudElem hl = GetHudElement(Client_HudElem_lm[c.ClientNum]);
                            string map = GetDvar("mapname");


                            /////////
                            if (map == "mp_terminal_cls")
                            {

                                if ((Difference(c.OriginY, 3880f) <= 100) && (Difference(c.OriginX, 650f) <= 100) && c.OriginZ >= 340f)
                                {
                                    hl.SetString("Press ^3F^7 to ^1Teleport");

                                    if (c.Other.ButtonPressed(Buttons.Activate))
                                    {
                                        iPrintLnBold("^2Teleportation!", c);
                                        Thread.Sleep(500);
                                        c.OriginX = 650f;
                                        c.OriginY = 3880f;
                                        c.OriginZ = 340f;
                                    }
                                }

                                else if ((Difference(c.OriginY, 6000f) <= 100) && (Difference(c.OriginX, -1000f) <= 100) && c.OriginZ >= 320f)
                                {
                                    hl.SetString("Press ^3F^7 to ^1Teleport");
                                    if (c.Other.ButtonPressed(Buttons.Activate))
                                    {
                                        iPrintLnBold("^2Teleportation!", c);
                                        c.OriginX = -1000f;
                                        c.OriginY = 6000f;
                                        c.OriginZ = 320f;
                                    }
                                }
                                else
                                {
                                    hl.SetString("");
                                }
                                /////////
                                if (map == "mp_paris")
                                {

                                    if ((Difference(c.OriginY, -205.2038f) <= 100) && (Difference(c.OriginX, -2179.646f) <= 100) && c.OriginZ >= 185.125f)
                                    {
                                        hl.SetString("Press ^3F^7 to ^1Teleport");

                                        if (c.Other.ButtonPressed(Buttons.Activate))
                                        {
                                            iPrintLnBold("^2Teleportation!", c);
                                            Thread.Sleep(500);
                                            c.OriginX = -549.5192f;
                                            c.OriginY = 931.428f;
                                            c.OriginZ = 1300.724f;
                                        }
                                    }

                                    else if ((Difference(c.OriginY, 875.5912f) <= 100) && (Difference(c.OriginX, -585.984f) <= 100) && c.OriginZ >= 1293.608f)
                                    {
                                        hl.SetString("Press ^3F^7 to ^1Teleport");
                                        if (c.Other.ButtonPressed(Buttons.Activate))
                                        {
                                            iPrintLnBold("^2Teleportation!", c);
                                            c.OriginX = -2113.61f;
                                            c.OriginY = -117.1516f;
                                            c.OriginZ = 185.125f;
                                        }
                                    }
                                    else
                                    {
                                        hl.SetString("");
                                    }
                                    /////////
                                    if (map == "mp_seatown")
                                    {

                                        if ((Difference(c.OriginY, 500f) <= 100) && (Difference(c.OriginX, 1200f) <= 100) && c.OriginZ >= 180f)
                                        {
                                            hl.SetString("Press ^3F^7 to ^1Teleport");

                                            if (c.Other.ButtonPressed(Buttons.Activate))
                                            {
                                                iPrintLnBold("^2Teleportation!", c);
                                                Thread.Sleep(500);
                                                c.OriginX = 1200f;
                                                c.OriginY = 500f;
                                                c.OriginZ = 180f;
                                            }
                                        }

                                        else if ((Difference(c.OriginY, 500f) <= 100) && (Difference(c.OriginX, 1500f) <= 100) && c.OriginZ >= 565f)
                                        {
                                            hl.SetString("Press ^3F^7 to ^1Teleport");
                                            if (c.Other.ButtonPressed(Buttons.Activate))
                                            {
                                                iPrintLnBold("^2Teleportation!", c);
                                                c.OriginX = 1500f;
                                                c.OriginY = 500f;
                                                c.OriginZ = 565f;
                                            }
                                        }
                                        else
                                        {
                                            hl.SetString("");
                                        }
                                    }

                                }
                            }

                        }
                    }
                }
            }

            catch (Exception z)
            {
                ServerPrint("Error flag: " + z.Message);
            }

        }

        public static float Difference(float loc, float loc2)
        {
            return Math.Abs(loc - loc2);
        }

        public override void OnPlayerDisconnect(ServerClient client)
        {
            if (Client_HudElem_lm.ContainsKey(client.ClientNum))
            {
                HudElem info2 = GetHudElement(Client_HudElem_lm[client.ClientNum]);
                info2.Type = HudElementTypes.None;
                Client_HudElem_lm.Remove(client.ClientNum);
            }
        }

        public override void OnPlayerConnect(ServerClient client)
        {
            int HudElemNum1 = CreateHud_lm(client.ClientNum);
            if (Client_HudElem_lm.ContainsKey(client.ClientNum))
                Client_HudElem_lm[client.ClientNum] = HudElemNum1;
            else
                Client_HudElem_lm.Add(client.ClientNum, HudElemNum1);
        }

        private int CreateHud_lm(int ClientNum)
        {
            HudElem hud = CreateNewHudElem();
            hud.Type = HudElementTypes.Text;
            hud.ShowToEnt = ClientNum;
            hud.HideInMenu = true;
            hud.Font = HudElementFonts.Default;
            hud.FontScale = 1.5f;
            hud.PointType = 120;
            hud.OriginY = 180f;
            hud.OriginX = -100f;
            hud.SetString("");
            return hud.HudElementNum;
        }

    }
}
  Reply
#14
Just a wild guess,did you change the CPU to x86?
  Reply
#15
And how i have to do that??
  Reply
#16
This code work fine in my server.
  Reply
#17
Configuration Manager in Visual Studio? There should be a warning if you didn't
  Reply
#18
i have a problem with these, i add the cords that i want in terminal and it works fine... but it doesnt work in fallen, idk why. Can u help me guys? thanks a lot.
P.S About the entities i added it in a bunker plugin so its not in these plugin.. and it doesnt give me any error so idk... lawl
Code:
using System;
using System.Collections.Generic;
using Addon;
using System.Threading;
using System.IO;
using System.Collections;
namespace flags
{
    public class flags : CPlugin
    {
        Dictionary<int, int> Client_HudElem_lm = new Dictionary<int, int>();

        public override void OnServerLoad()
        {
            ServerPrint("Flags plugin by Litgar loaded!");
        }


        public override void OnAddonFrame()
        {
            List<ServerClient> clients;
            try
            {
                clients = GetClients();
                if (clients != null && clients.Count > 0)
                {
                    foreach (ServerClient c in GetClients())
                    {
                        if (c.Other.isAlive == true)
                        {
                            HudElem hl = GetHudElement(Client_HudElem_lm[c.ClientNum]);
                            string map = GetDvar("mapname");


                            /////////
                            if (map == "mp_terminal_cls")
                            {


                                if ((Difference(c.OriginY, 5064f) <= 100) && (Difference(c.OriginX, 3031f) <= 100) && c.OriginZ >= 192f)
                                {
                                    hl.SetString("Press ^2F^7 to ^1Teleport^7, to ^2 Second ^7 bunker");

                                    if (c.Other.ButtonPressed(Buttons.Activate))
                                    {
                                        iPrintLnBold("^1Teleportation!", c);
                                        Thread.Sleep(500);
                                        c.OriginX = 1875f;
                                        c.OriginY = 8040f;
                                        c.OriginZ = 192f;
                                    }
                                }

                                else if ((Difference(c.OriginY, 8040f) <= 100) && (Difference(c.OriginX, 1875f) <= 100) && c.OriginZ >= 192f)
                                {
                                    hl.SetString("Press ^2F^7 to ^1Teleport^7, back to ^2 First ^7 bunker");

                                    if (c.Other.ButtonPressed(Buttons.Activate))
                                    {
                                        iPrintLnBold("^1Teleportation!", c);
                                        c.OriginX = 3031f;
                                        c.OriginY = 5064f;
                                        c.OriginZ = 192f;
                                    }
                                }
                                else
                                {
                                    hl.SetString("");
                                    if ((Difference(c.OriginY, 7051f) <= 100) && (Difference(c.OriginX, 1715f) <= 100) && c.OriginZ >= 192f)
                                    {
                                        hl.SetString("Press ^2F^7 to ^1Teleport^7, to ^2 Third ^7 bunker");

                                        if (c.Other.ButtonPressed(Buttons.Activate))
                                        {
                                            iPrintLnBold("^1Teleportation!", c);
                                            Thread.Sleep(500);
                                            c.OriginX = 536f;
                                            c.OriginY = 7607f;
                                            c.OriginZ = 206f;
                                        }
                                    }

                                    else if ((Difference(c.OriginY, 7607f) <= 100) && (Difference(c.OriginX, 536f) <= 100) && c.OriginZ >= 206f)
                                    {
                                        hl.SetString("Press ^2F^7 to ^1Teleport^7, back to ^2 Second ^7 bunker");

                                        if (c.Other.ButtonPressed(Buttons.Activate))
                                        {
                                            iPrintLnBold("^1Teleportation!", c);
                                            c.OriginX = 1715f;
                                            c.OriginY = 7051f;
                                            c.OriginZ = 192f;
                                        }
                                    }
                                    else
                                    {
                                        hl.SetString("");
                                        if ((Difference(c.OriginY, 4752f) <= 100) && (Difference(c.OriginX, 663f) <= 100) && c.OriginZ >= 632f)
                                        {
                                            hl.SetString("Press ^2F^7 to ^1Teleport^7, to ^2 First ^7 bunker");

                                            if (c.Other.ButtonPressed(Buttons.Activate))
                                            {
                                                iPrintLnBold("^1Teleportation!", c);
                                                Thread.Sleep(500);
                                                c.OriginX = 3794f;
                                                c.OriginY = 2021f;
                                                c.OriginZ = 193f;
                                            }
                                        }

                                        else if ((Difference(c.OriginY, 2021f) <= 100) && (Difference(c.OriginX, 3794f) <= 100) && c.OriginZ >= 193f)
                                        {
                                            hl.SetString("Press ^2F^7 to ^1Teleport^7, back to the ^2 map");

                                            if (c.Other.ButtonPressed(Buttons.Activate))
                                            {
                                                iPrintLnBold("^1Teleportation!", c);
                                                c.OriginX = 663f;
                                                c.OriginY = 4752f;
                                                c.OriginZ = 632f;
                                            }
                                        }
                                        else
                                        {
                                            hl.SetString("");
                                        }
                                    }
                                    //////////

                                    if (map == "mp_lambeth")
                                    {
                                        if ((Difference(c.OriginY, 1349f) <= 100) && (Difference(c.OriginX, 806f) <= 100) && c.OriginZ >= 117f)
                                        {
                                            hl.SetString("Press ^2F^7 to ^1Teleport^7, ^2 Out ^7 of map");

                                            if (c.Other.ButtonPressed(Buttons.Activate))
                                            {
                                                iPrintLnBold("^1Teleportation!", c);
                                                Thread.Sleep(500);
                                                c.OriginX = -797f;
                                                c.OriginY = 3866f;
                                                c.OriginZ = -239f;
                                            }
                                        }

                                        else if ((Difference(c.OriginY, 3866f) <= 100) && (Difference(c.OriginX, -797f) <= 100) && c.OriginZ >= -239f)
                                        {
                                            hl.SetString("Press ^2F^7 to ^1Teleport^7, back to the map");

                                            if (c.Other.ButtonPressed(Buttons.Activate))
                                            {
                                                iPrintLnBold("^1Teleportation!", c);
                                                c.OriginX = 806f;
                                                c.OriginY = 1349f;
                                                c.OriginZ = 117f;
                                            }
                                        }
                                        else
                                        {
                                            hl.SetString("");

                                        }
                                    }

                                }
                            }
                        }
                    }
                }

            }

            catch (Exception z)
            {
                ServerPrint("Error flag: " + z.Message);

            }
        }

        
        

        public static float Difference(float loc, float loc2)
        {
            return Math.Abs(loc - loc2);
        }

        public override void OnPlayerDisconnect(ServerClient client)
        {
            if (Client_HudElem_lm.ContainsKey(client.ClientNum))
            {
                HudElem info2 = GetHudElement(Client_HudElem_lm[client.ClientNum]);
                info2.Type = HudElementTypes.None;
                Client_HudElem_lm.Remove(client.ClientNum);
            }
        }

        public override void OnPlayerConnect(ServerClient client)
        {
            int HudElemNum1 = CreateHud_lm(client.ClientNum);
            if (Client_HudElem_lm.ContainsKey(client.ClientNum))
                Client_HudElem_lm[client.ClientNum] = HudElemNum1;
            else
                Client_HudElem_lm.Add(client.ClientNum, HudElemNum1);
        }

        private int CreateHud_lm(int ClientNum)
        {
            HudElem hud = CreateNewHudElem();
            hud.Type = HudElementTypes.Text;
            hud.ShowToEnt = ClientNum;
            hud.HideInMenu = true;
            hud.Font = HudElementFonts.Default;
            hud.FontScale = 1.5f;
            hud.PointType = 120;
            hud.OriginY = 180f;
            hud.OriginX = -100f;
            hud.SetString("");
            return hud.HudElementNum;
        }

    }
}
  Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
Wink Plugin with !ban !kick and !tampban clemi555 3 1,737 11-09-2013, 09:21
Last Post: clemi555
  AntiNoScope Plugin clemi555 5 2,005 11-08-2013, 19:13
Last Post: clemi555
  [Release] Bunker Plugin 1.3 archit 68 18,621 10-30-2013, 11:59
Last Post: clacki
  Help Modifying plugin maverigh 5 2,684 10-19-2013, 10:29
Last Post: Nekochan
Shocked [Request] Switch plugin axel-le-meilleur 6 1,926 10-19-2013, 06:59
Last Post: iRoNinja
  Make area detect. flag Teleport lewisbibo 4 1,963 10-12-2013, 18:10
Last Post: EnVi Sweden Rocks
  [Release] Yurio Map Plugin Yurio 101 30,219 09-26-2013, 13:38
Last Post: First_Semyon
Brick [Release] v1.1 ChangeMap/NextMap Plugin without any configuration milchshake 23 9,647 09-23-2013, 13:18
Last Post: SgtLegend
  Help !say Plugin (like the !say from GodPlugin) Hallla 0 1,158 09-13-2013, 09:31
Last Post: Hallla
Rainbow [Release] MW3: Random Weapon Plugin V1 Nekochan 50 14,812 09-11-2013, 15:11
Last Post: EnVi Sweden Rocks

Forum Jump:


Users browsing this thread: 1 Guest(s)