Closes #15, #13
This commit is contained in:
2021-04-07 21:58:36 +02:00
parent 0566531268
commit 26fa0ba2aa
6 changed files with 49 additions and 43 deletions

View File

@@ -106,11 +106,7 @@ namespace ReallifeGamemode.Server.Commands
[Command("hup")]
public void CmdAnim(Player player)
{
if (player.HasAnimation("hup")) { player.ClearAnimation(); return; }
if (player.HasAnimation())
return;
player.SyncAnimation("hup");
player.ToggleSurrender();
}
[Command("event", "~m~Benutzung: ~s~/event [Nachricht]", GreedyArg = true)]

View File

@@ -15,17 +15,15 @@ namespace ReallifeGamemode.Server.Events
public class EnterVehicleAttempt : Script
{
public static GTANetworkAPI.Vehicle Roller;
[ServerEvent(Event.PlayerEnterVehicleAttempt)]
public void OnPlayerEnterVehicleAttempt(Player player, GTANetworkAPI.Vehicle vehicle, sbyte seat)
{
if ((VehicleHash)vehicle.Model == VehicleHash.Dune3)
{
if (seat == 1) seat = 0;
else if (seat == 0) seat = 1;
}
if (seat != 0) return;
if (player.HasAnimation())
player.StopAnimation();
User u = player.GetUser();
if (vehicle.GetServerVehicle() is FactionVehicle veh)
@@ -84,7 +82,6 @@ namespace ReallifeGamemode.Server.Events
return;
}
}
}
if (vehicle.GetServerVehicle() is SchoolVehicle sVeh)
{

View File

@@ -974,19 +974,7 @@ namespace ReallifeGamemode.Server.Events
[RemoteEvent("keyPress:ControllH")]
public void KeyPressControllH(Player player)
{
if (player.HasAnimation("hup"))
{
PositionManager.cuffPoints.Remove(player);
player.ClearAnimation();
return;
}
if (player.HasAnimation())
return;
player.SyncAnimation("hup");
if (player.GetUser().Wanteds > 0)
PositionManager.cuffPoints.Add(player);
player.ToggleSurrender();
}
#endregion User Key

View File

@@ -344,5 +344,22 @@ namespace ReallifeGamemode.Server.Extensions
PositionManager.cuffPoints.Remove(nearestCuffPlayer);
}
}
public static void ToggleSurrender(this Player player)
{
if (player.HasAnimation("hup"))
{
PositionManager.cuffPoints.Remove(player);
player.ClearAnimation();
return;
}
if (player.HasAnimation())
return;
player.SyncAnimation("hup");
if (player.GetUser().Wanteds > 0)
PositionManager.cuffPoints.Add(player);
}
}
}

View File

@@ -13,6 +13,9 @@ namespace ReallifeGamemode.Server.Util
public static void SyncAnimation(this Player player, dynamic animationName)
{
if (player.IsInVehicle)
return;
if (!player.HasData("Animation"))
player.SetData("Animation", String.Empty);
@@ -71,6 +74,7 @@ namespace ReallifeGamemode.Server.Util
if (!player.HasData("Animation"))
return;
player.ClearAttachments();
player.ResetData("Animation");
player.ResetSharedData("AnimationData");
}