• 3 Vote(s) - 4.33 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Release Flag plugin for users 1.6
#1
Users still need to know the co-ordinates of the flag.

Features:
  1. Configurable through sv_config.ini
  2. Unlimited flags per map(before server crashes)

Add to sv_config
Code:
[TELEPORTER]
Convert=false
//True or false will convert older type entries into ones that are compatible  with newer plugin

For having flags on mp_carbon for example:
Create a new file name mp_carbon.flag in plugins\teleport and add these
Format of a flag co-ordinates
Code:
flag
{
Origin:-2839,-6048,3945
Destination:-2254,-5562,3755
}
flag
{
Origin:-2826,-6003,3922
Destination:-2254,-5562,3755
}
flag
{
Origin:-2837,-5961,3898
Destination:-2254,-5562,3755
}

Change Log:
Credits
@archit
@zxz0O0
@Ich1994

1.4 code
CSHARP Code
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using Addon;
  6.  
  7. namespace Teleport
  8. {
  9. public class Class1 : CPlugin
  10. {
  11.  
  12. Dictionary<string, Vector> flagsorigin = new Dictionary<string, Vector>();
  13. Dictionary<string, Vector> flagsdesti = new Dictionary<string, Vector>();
  14. public override void OnServerLoad()
  15. {
  16. ServerPrint("Teleport plugin loaded!");
  17. }
  18. public override void OnMapChange()
  19. {
  20. makeflags();
  21. }
  22. public override void OnFastRestart()
  23. {
  24. makeflags();
  25. }
  26. public static double Distance(Vector vec1, Vector vec2)
  27. {
  28. return Math.Sqrt(Math.Pow(vec1.X - vec2.X, 2) + Math.Pow(vec1.Y - vec2.Y, 2) + Math.Pow(vec1.Z - vec2.Z, 2));
  29. }
  30.  
  31. public override void OnAddonFrame()
  32. {
  33. foreach (string key in flagsorigin.Keys)
  34. {
  35. if (key.Split(',')[0] == GetDvar("mapname"))
  36. {
  37. if (GetClients() != null)
  38. {
  39. foreach (ServerClient Client in GetClients())
  40. {
  41. if (Distance(new Vector(Client.OriginX, Client.OriginY, Client.OriginZ), flagsorigin[key]) <= 50f)
  42. {
  43. Client.OriginX = flagsdesti[key].X;
  44. Client.OriginY = flagsdesti[key].Y;
  45. Client.OriginZ = flagsdesti[key].Z;
  46. }
  47. }
  48. }
  49. }
  50. }
  51. }
  52. void makeflags()
  53. {
  54. try
  55. {
  56. string flag = GetServerCFG("TELEPORTER", "flags", "0");
  57. if (flag != "0")
  58. {
  59.  
  60. for (int i = 1; i <= int.Parse(flag); i++)
  61. {
  62. string flaged = GetServerCFG("TELEPORTER", string.Format("flag{0}", i.ToString()), "null");
  63. if (flaged != null)
  64. {
  65. string map = flaged.Split(',')[0];
  66. string vector = flaged.Split(',')[1];
  67. string vector2 = vector.Split('(')[1];
  68. string vector3 = vector2.Split(')')[0];
  69. string vec1 = vector3.Split('_')[0];
  70. string vec2 = vector3.Split('_')[1];
  71. string vec3 = vector3.Split('_')[2];
  72. Vector vec = new Vector(Convert.ToSingle(vec1), Convert.ToSingle(vec2), Convert.ToSingle(vec3));
  73. if(!flagsorigin.ContainsValue(vec))
  74. flagsorigin.Add(string.Format("{0},{1}", map, i.ToString()), vec);
  75. vector = flaged.Split(',')[2];
  76. vector2 = vector.Split('(')[1];
  77. vector3 = vector2.Split(')')[0];
  78. vec1 = vector3.Split('_')[0];
  79. vec2 = vector3.Split('_')[1];
  80. vec3 = vector3.Split('_')[2];
  81. vec = new Vector(Convert.ToSingle(vec1), Convert.ToSingle(vec2), Convert.ToSingle(vec3));
  82. if (!flagsdesti.ContainsValue(vec))
  83. flagsdesti.Add(string.Format("{0},{1}", map, i.ToString()), vec);
  84.  
  85. }
  86.  
  87. }
  88. foreach (string key in flagsdesti.Keys)
  89. {
  90. if (key.Split(',')[0] == GetDvar("mapname"))
  91. {
  92. Entity en = SpawnModel("script_brushmodel", "prop_flag_neutral", flagsdesti[key]);
  93. }
  94. }
  95.  
  96. foreach (string key in flagsdesti.Keys)
  97. {
  98. if (key.Split(',')[0] == GetDvar("mapname"))
  99. {
  100. Entity en = SpawnModel("script_brushmodel", "prop_flag_neutral", flagsorigin[key]);
  101. }
  102. }
  103.  
  104. }
  105. }
  106. catch (Exception e)
  107. {
  108. ServerPrint(e.ToString());
  109. }
  110. }
  111. }
  112. }


Attached Files
.rar   teleport.rar (Size: 3.2 KB / Downloads: 130)
.rar   teleport 1.2.rar (Size: 2.9 KB / Downloads: 71)
.rar   Teleport 1.3.rar (Size: 2.94 KB / Downloads: 21)
.rar   Teleport 1.4.rar (Size: 2.94 KB / Downloads: 66)
.rar   teleport 1.5.rar (Size: 12.84 KB / Downloads: 15)
.rar   teleport 1.6.rar (Size: 21.24 KB / Downloads: 288)
[-] The following 11 users say Thank You to archit for this post:
  • 99IRock, clacki, d0h!, hillbilly, itsmods.com76, jari333, JariZ, narkos, Nekochan, Pozzuh, surtek
  Reply
#2
I tried to load the plugin, but i got an error:
The format of the input string is incorrect.

    at System.Number.StringToNumber (String str, Number Styles options, Buffer Number & number, NumberFormatException info info, Boolean parseDecimal)

    at System.Number.ParseInt32 (String s, Number Styles style, NumberFormatException info info)

    at System.Int32.Parse (String s)

    at teleport.Class1.makeflags ()

I added the [teleporter] in the sv_config
  Reply
#3
write your [TELEPORTER] section from sv_config
  Reply
#4
Very cool.
C++/Obj-C developer. Neko engine wip
Steam: Click
  Reply
#5
(09-09-2012, 08:58)jari333 Wrote: I tried to load the plugin, but i got an error:
The format of the input string is incorrect.

    at System.Number.StringToNumber (String str, Number Styles options, Buffer Number & number, NumberFormatException info info, Boolean parseDecimal)

    at System.Number.ParseInt32 (String s, Number Styles style, NumberFormatException info info)

    at System.Int32.Parse (String s)

    at teleport.Class1.makeflags ()

I added the [teleporter] in the sv_config

same error

using..

[TELEPORTER]
flags=3//no of flags global
flag1=mp_dome,(1343.3_1742.7_-254.8),(1322_1455.7_-255)//flag must be followed by a number
flag2=mp_paris,(-2179.646_-205.2038_185.125),(-549.5192_931.428_1300.724)
flag3=mp_paris,(-585.984_875.5912_1293.608),(-2113.61_-117.1516_185.125)
[Image: b_560_95_1.png]


[Image: b_560_95_1.png]

[-] The following 1 user says Thank You to hillbilly for this post:
  • gamble06
  Reply
#6
Pretty sure removing:

Code:
//no of flags global

Should fix the error
[Image: b_560_95_1.png]
[-] The following 2 users say Thank You to Nukem for this post:
  • gamble06, hillbilly
  Reply
#7
(09-09-2012, 16:48)Nukem Wrote: Pretty sure removing:

Code:
//no of flags global

Should fix the error

it does, thanks.
[Image: b_560_95_1.png]


[Image: b_560_95_1.png]

  Reply
#8
comments are read by GetServerCFG?
  Reply
#9
(09-09-2012, 16:54)archit Wrote: comments are read by GetServerCFG?

It's default inifile class.
Also if it working without comment stuff it means comments are not supported.. lol
C++/Obj-C developer. Neko engine wip
Steam: Click
  Reply
#10
Pretty sure comments can be added by a # character instead of a //
  Reply


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

Forum Jump:


Users browsing this thread: 1 Guest(s)