Merge
This commit is contained in:
@@ -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)]
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -20,11 +20,18 @@ namespace ReallifeGamemode.Server.Events
|
||||
string username = player.Name;
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
if (password.Length < 6)
|
||||
{
|
||||
player.TriggerEvent("SERVER:Login_Error", "Das Passwort muss aus mindestens 6 Zeichen bestehen.");
|
||||
return;
|
||||
}
|
||||
if (dbContext.Users.Where(u => u.SocialClubName == player.SocialClubName).Count() >= 3)
|
||||
{
|
||||
player.TriggerEvent("SERVER:Login_Error", "Es sind schon 3 Konten mit dieser Socialclub-ID registriert.");
|
||||
return;
|
||||
}
|
||||
else if (!dbContext.Users.Any(u => u.Name.ToLower() == username.ToLower().Trim()))
|
||||
|
||||
if (!dbContext.Users.Any(u => u.Name.ToLower() == username.ToLower().Trim()))
|
||||
{
|
||||
var user = new User
|
||||
{
|
||||
|
||||
@@ -6,6 +6,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using Newtonsoft.Json;
|
||||
using ReallifeGamemode.Database.Entities;
|
||||
using ReallifeGamemode.Database.Models;
|
||||
using ReallifeGamemode.Server.Managers;
|
||||
using ReallifeGamemode.Server.Services;
|
||||
using ReallifeGamemode.Server.Types;
|
||||
using ReallifeGamemode.Server.Util;
|
||||
@@ -340,7 +341,25 @@ namespace ReallifeGamemode.Server.Extensions
|
||||
nearestCuffPlayer.AddAttachment("handcuffs", true);
|
||||
player.SyncAnimation("doUncuff");
|
||||
nearestCuffPlayer.SyncAnimation("getUncuff");
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -809,7 +809,7 @@ namespace ReallifeGamemode.Server.Managers
|
||||
[RemoteEvent("CLIENT:InteractionMenu_CallService_Sani")]
|
||||
public void CallServiceSani(Player player)
|
||||
{
|
||||
if (player.GetUser().FactionId == 2)
|
||||
if (player.GetUser().FactionId == 2 && player.IsDuty())
|
||||
{
|
||||
player.SendNotification("~r~[Fehler] ~w~Du kannst keinen Sanitäter rufen.");
|
||||
return;
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace ReallifeGamemode.Server.Managers
|
||||
{
|
||||
if (player.IsInVehicle)
|
||||
{
|
||||
player.TriggerEvent("Error", "Du kannst dein Kofferraum nicht betätigen.");
|
||||
player.TriggerEvent("Error", "Du kannst deinen Kofferraum gerade nicht öffnen.");
|
||||
}
|
||||
Vehicle veh = NAPI.Pools.GetAllVehicles().ToList().Where(v => v.Position.DistanceTo(player.Position) <= 2).FirstOrDefault();
|
||||
if (veh == null)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -35,11 +38,17 @@ namespace ReallifeGamemode.Server.Util
|
||||
List<string> nextAnimations = animations.Skip(1).ToList();
|
||||
player.SyncAnimation(animationName);
|
||||
|
||||
if (nextAnimations.Count != 0)
|
||||
if (nextAnimations.Count is 0)
|
||||
{
|
||||
player.TriggerEvent("SERVER:QueueAnimation", animationName);
|
||||
animationPair.Add(player, nextAnimations);
|
||||
animationPair.Remove(player);
|
||||
return;
|
||||
}
|
||||
|
||||
player.TriggerEvent("SERVER:QueueAnimation", animationName);
|
||||
if (animationPair.ContainsKey(player))
|
||||
animationPair[player] = nextAnimations;
|
||||
else
|
||||
animationPair.Add(player, nextAnimations);
|
||||
}
|
||||
|
||||
/// <summary>Check if Player has any Animation playing.
|
||||
@@ -55,6 +64,8 @@ namespace ReallifeGamemode.Server.Util
|
||||
/// <param name="animationName">Name of requested animation</param>
|
||||
public static bool HasAnimation(this Player player, dynamic animationName)
|
||||
{
|
||||
string data = player.GetData<string>("Animation");
|
||||
bool x = player.GetData<string>("Animation") == animationName;
|
||||
return player.HasData("Animation") && (player.GetData<string>("Animation") == animationName);
|
||||
}
|
||||
|
||||
@@ -63,6 +74,7 @@ namespace ReallifeGamemode.Server.Util
|
||||
if (!player.HasData("Animation"))
|
||||
return;
|
||||
|
||||
player.ClearAttachments();
|
||||
player.ResetData("Animation");
|
||||
player.ResetSharedData("AnimationData");
|
||||
}
|
||||
@@ -82,9 +94,11 @@ namespace ReallifeGamemode.Server.Util
|
||||
}
|
||||
|
||||
[RemoteEvent("CLIENT:ClearAnimationData")]
|
||||
public void ClearAnimationData(Player player, Player target)
|
||||
public void ClearAnimationData(Player player, bool checkTransition)
|
||||
{
|
||||
target.ClearAnimation();
|
||||
player.ClearAnimation();
|
||||
if (checkTransition)
|
||||
AnimPairTransition(player);
|
||||
}
|
||||
|
||||
[ServerEvent(Event.PlayerWeaponSwitch)]
|
||||
|
||||
Reference in New Issue
Block a user