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
Code:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Addon; namespace Teleport { public class Class1 : CPlugin { Dictionary<string, Vector> flagsorigin = new Dictionary<string, Vector>(); Dictionary<string, Vector> flagsdesti = new Dictionary<string, Vector>(); public override void OnServerLoad() { ServerPrint("Teleport plugin loaded!"); } public override void OnMapChange() { makeflags(); } public override void OnFastRestart() { makeflags(); } public static double Distance(Vector vec1, Vector vec2) { return Math.Sqrt(Math.Pow(vec1.X - vec2.X, 2) + Math.Pow(vec1.Y - vec2.Y, 2) + Math.Pow(vec1.Z - vec2.Z, 2)); } public override void OnAddonFrame() { foreach (string key in flagsorigin.Keys) { if (key.Split(',')[0] == GetDvar("mapname")) { if (GetClients() != null) { foreach (ServerClient Client in GetClients()) { if (Distance(new Vector(Client.OriginX, Client.OriginY, Client.OriginZ), flagsorigin[key]) <= 50f) { Client.OriginX = flagsdesti[key].X; Client.OriginY = flagsdesti[key].Y; Client.OriginZ = flagsdesti[key].Z; } } } } } } void makeflags() { try { string flag = GetServerCFG("TELEPORTER", "flags", "0"); if (flag != "0") { for (int i = 1; i <= int.Parse(flag); i++) { string flaged = GetServerCFG("TELEPORTER", string.Format("flag{0}", i.ToString()), "null"); if (flaged != null) { string map = flaged.Split(',')[0]; string vector = flaged.Split(',')[1]; string vector2 = vector.Split('(')[1]; string vector3 = vector2.Split(')')[0]; string vec1 = vector3.Split('_')[0]; string vec2 = vector3.Split('_')[1]; string vec3 = vector3.Split('_')[2]; Vector vec = new Vector(Convert.ToSingle(vec1), Convert.ToSingle(vec2), Convert.ToSingle(vec3)); if(!flagsorigin.ContainsValue(vec)) flagsorigin.Add(string.Format("{0},{1}", map, i.ToString()), vec); vector = flaged.Split(',')[2]; vector2 = vector.Split('(')[1]; vector3 = vector2.Split(')')[0]; vec1 = vector3.Split('_')[0]; vec2 = vector3.Split('_')[1]; vec3 = vector3.Split('_')[2]; vec = new Vector(Convert.ToSingle(vec1), Convert.ToSingle(vec2), Convert.ToSingle(vec3)); if (!flagsdesti.ContainsValue(vec)) flagsdesti.Add(string.Format("{0},{1}", map, i.ToString()), vec); } } foreach (string key in flagsdesti.Keys) { if (key.Split(',')[0] == GetDvar("mapname")) { Entity en = SpawnModel("script_brushmodel", "prop_flag_neutral", flagsdesti[key]); } } foreach (string key in flagsdesti.Keys) { if (key.Split(',')[0] == GetDvar("mapname")) { Entity en = SpawnModel("script_brushmodel", "prop_flag_neutral", flagsorigin[key]); } } } } catch (Exception e) { ServerPrint(e.ToString()); } } } }


Attached Files
.rar   teleport.rar (Size: 3.2 KB / Downloads: 190)
.rar   teleport 1.2.rar (Size: 2.9 KB / Downloads: 119)
.rar   Teleport 1.3.rar (Size: 2.94 KB / Downloads: 77)
.rar   Teleport 1.4.rar (Size: 2.94 KB / Downloads: 125)
.rar   teleport 1.5.rar (Size: 12.84 KB / Downloads: 62)
.rar   teleport 1.6.rar (Size: 21.24 KB / Downloads: 362)
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-Cdeveloper. 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]

Reply

#6
Pretty sure removing:

Code:
//no of flags global

Should fix the error
[Image: b_560_95_1.png]
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-Cdeveloper. 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 6,494 11-09-2013, 09:21
Last Post: clemi555
  AntiNoScope Plugin clemi555 5 7,593 11-08-2013, 19:13
Last Post: clemi555
  [Release] Bunker Plugin 1.3 archit 68 55,808 10-30-2013, 11:59
Last Post: clacki
  Help Modifying plugin maverigh 5 7,643 10-19-2013, 10:29
Last Post: Nekochan
Shocked [Request] Switch plugin axel-le-meilleur 6 8,295 10-19-2013, 06:59
Last Post: iRoNinja
  Make area detect. flag Teleport lewisbibo 4 6,723 10-12-2013, 18:10
Last Post: EnVi Sweden Rocks
  [Release] Yurio Map Plugin Yurio 101 82,123 09-26-2013, 13:38
Last Post: First_Semyon
Brick [Release] v1.1 ChangeMap/NextMap Plugin without any configuration milchshake 23 25,160 09-23-2013, 13:18
Last Post: SgtLegend
  Help !say Plugin (like the !say from GodPlugin) Hallla 0 3,655 09-13-2013, 09:31
Last Post: Hallla
Rainbow [Release] MW3: Random Weapon Plugin V1 Nekochan 50 44,656 09-11-2013, 15:11
Last Post: EnVi Sweden Rocks

Forum Jump:


Users browsing this thread:
1 Guest(s)

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