Posts: 3,704
Threads: 147
Joined: Jan 2011
Reputation:
119
(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-Cdeveloper. Neko engine wip
Steam: Click
Posts: 322
Threads: 43
Joined: Mar 2012
Reputation:
-4
(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.
Posts: 47
Threads: 2
Joined: Jul 2012
Reputation:
0
09-12-2012, 11:14
(This post was last modified: 09-12-2012, 11:55 by JariZ.)
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;
}
}
}
Posts: 285
Threads: 15
Joined: Nov 2011
Reputation:
12
Just a wild guess,did you change the CPU to x86?
Posts: 47
Threads: 2
Joined: Jul 2012
Reputation:
0
And how i have to do that??
Posts: 322
Threads: 43
Joined: Mar 2012
Reputation:
-4
This code work fine in my server.
Posts: 285
Threads: 15
Joined: Nov 2011
Reputation:
12
Configuration Manager in Visual Studio? There should be a warning if you didn't
Posts: 40
Threads: 5
Joined: Jan 2013
Reputation:
0
04-06-2013, 17:52
(This post was last modified: 04-06-2013, 17:53 by Dr3am95.)
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;
}
}
}
|