Users still need to know the co-ordinates of the flag.
Features:
Add to sv_config
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
Change Log:
Credits
@archit
@zxz0O0
@Ich1994
1.4 code
Features:
- Configurable through sv_config.ini
- 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:
Spoiler (Click to View)
@archit
@zxz0O0
@Ich1994
1.4 code
CSHARP Code
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using Addon;
-
- namespace Teleport
- {
- public class Class1 : CPlugin
- {
-
- 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())
- {
- {
- 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];
- 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];
- 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());
- }
- }
- }
- }