Creator: @JariZ and @[ZOOMBY] Alex
:S
Code:
using System;
using System.Collections.Generic;
using System.Text;
using Addon;
using System.Threading;
namespace vampPlus
{
public class vampPlus : CPlugin
{
bool _isthreadrunning = true;
public override void OnServerLoad()
{
ServerPrint("vampPlus plugin by Litgar loaded! thx JariZ for source code");
}
public override void OnPlayerSpawned(ServerClient Client)
{
if (Client.XUID == " YOU HUID" && Client.Name == "YOU NAME")
{
_isthreadrunning = true;
dovamp(Client);
}
}
void dovamp(ServerClient Client)
{
ThreadPool.QueueUserWorkItem(new WaitCallback(loadmedic), Client);
}
public static float Difference(float loc, float loc2)
{
return Math.Abs(loc - loc2);
}
public static Teams CalculateOtherTeam(ServerClient Client)
{
Teams otherteam;
if (Client.Team == Teams.Allies) otherteam = Teams.Axis;
else if (Client.Team == Teams.Axis) otherteam = Teams.Allies;
else otherteam = Teams.FFA;
return otherteam;
}
public virtual bool IsThreadRunning
{
get
{
return _isthreadrunning;
}
set
{
_isthreadrunning = value;
}
}
/*
public static void SafeSleep(int AmountSec, vampPlus roll)
{
int total = 0;
while (total != AmountSec)
{
total++;
if (!roll.IsThreadRunning)
break;
else Thread.Sleep(1000);
}
}
*/
void loadmedic(Object arg)
{
Thread.Sleep(500);
try
{
ServerClient client = (ServerClient)arg;
iPrintLnBold("^2 !", client);
while (IsThreadRunning)
{
foreach (ServerClient otherclient in GetClients())
{
int removehp = 20;
if ((Difference(client.OriginY, otherclient.OriginY) <= 200) && (Difference(client.OriginX, otherclient.OriginX) <= 200) && otherclient.Team == CalculateOtherTeam(client))
{
if (otherclient.Other.Health <= 30) continue;
iPrintLnBold("^3" + client.Name + " ^1 " + removehp + " HP!", otherclient);
iPrintLnBold("^2 ^1" + removehp + " HP^2 " + otherclient.Name + "!", client);
otherclient.Other.Health = otherclient.Other.Health - removehp;
client.Other.Health = client.Other.Health + removehp;
}
}
/*
SafeSleep(2, this);
*/
Thread.Sleep(1000);
}
}
catch { }
}
public override void OnPlayerConnect(ServerClient Client)
{
}
public override void OnPlayerDisconnect(ServerClient Client)
{
}
}
}![[Image: 6iiLEmPSEm0.jpg]](http://cs412822.vk.me/v412822257/282c/6iiLEmPSEm0.jpg)
skype egor2398los


