This Plugin is a tactical Crouch Plugin.
If someone stands up he cannot move.
If someone spawns he have a 3 Second pardon time = He can stand/sprint for the first 3 seconds.
Known bugs:
V1.1
Force Crouch.rar (Size: 2.86 KB / Downloads: 84)
Thanks to:
Source:
If someone stands up he cannot move.
If someone spawns he have a 3 Second pardon time = He can stand/sprint for the first 3 seconds.
Known bugs:
- None
V1.1
- Fixed the "Ladder-Bug"
- Inital Release
Force Crouch.rar (Size: 2.86 KB / Downloads: 84)
Thanks to:
Source:
Click to view (Click to View)
Code:
using System;
using System.Collections.Generic;
using System.Timers;
using Addon;
namespace Force_Crouch
{
public class Force_Crouch : CPlugin
{
Dictionary<int,Vector> Freezed=new Dictionary<int,Vector>();
Dictionary<int, int> SpawnStand = new Dictionary<int, int>();
Timer Interval_100ms=new Timer();
public override void OnServerLoad()
{
ServerPrint("Tactical Crouch Plugin loaded!");
Interval_100ms.Elapsed += new ElapsedEventHandler(Interval_250ms_Handler);
Interval_100ms.Interval = 250;
Interval_100ms.Start();
}
public override void OnPlayerDisconnect(ServerClient Client)
{
if (Freezed.ContainsKey(Client.ClientNum))
Freezed.Remove(Client.ClientNum);
if (SpawnStand.ContainsKey(Client.ClientNum))
SpawnStand.Remove(Client.ClientNum);
}
public override void OnPlayerSpawned(ServerClient Client)
{
SpawnStand.Add(Client.ClientNum, 3000);
}
public override int OnPlayerDamaged(ServerClient Attacker, ServerClient Victim, string Weapon, int Damage)
{
if (Victim.Other.Health - Damage <= 0)
{
if (Freezed.ContainsKey(Victim.ClientNum))
Freezed.Remove(Victim.ClientNum);
if (SpawnStand.ContainsKey(Victim.ClientNum))
SpawnStand.Remove(Victim.ClientNum);
}
return Damage;
}
private void setPos(ServerClient c, Vector v)
{
c.OriginX = v.X;
c.OriginY = v.Y;
c.OriginZ = v.Z;
}
public void Interval_250ms_Handler(object source, ElapsedEventArgs e)
{
List<int> remove=new List<int>();
foreach (ServerClient it in GetClients())
{
if (SpawnStand.ContainsKey(it.ClientNum))
{
SpawnStand[it.ClientNum] -= 250;
if (SpawnStand[it.ClientNum] <= 0)
{
remove.Add(it.ClientNum);
}
}
}
foreach (int it in remove)
SpawnStand.Remove(it);
foreach (ServerClient Client in GetClients())
{
if (Client.Team != Teams.Spectator)
{
if (Client.Stance == Stances.Stand && !SpawnStand.ContainsKey(Client.ClientNum) && !Client.Other.isClimbing)
{
if (Freezed.ContainsKey(Client.ClientNum))
{
setPos(Client, Freezed[Client.ClientNum]);
Client.Other.Velocity = new Vector(0, 0, 0);
}
else
{
Freezed.Add(Client.ClientNum, new Vector(Client.OriginX, Client.OriginY, Client.OriginZ));
iPrintLnBold("Only crouch and prone!", Client);
}
}
else
if (Freezed.ContainsKey(Client.ClientNum))
Freezed.Remove(Client.ClientNum);
}
}
}
}
} }
}
foreach (int it in remove)
SpawnStand.Remove(it);
}
}
}