Add AnimationSync
This commit is contained in:
@@ -34,6 +34,17 @@ namespace ReallifeGamemode.Server.Commands
|
||||
{
|
||||
#region Todo
|
||||
|
||||
[Command("syncanim", "~m~Benutzung: ~s~/anim [animName]")]
|
||||
public void CmdSncAnim(Player player, string animName)
|
||||
{
|
||||
if (!player.GetUser()?.IsAdmin(AdminLevel.SUPPORTER) ?? true)
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
return;
|
||||
}
|
||||
player.PlaySyncAnimation(animName);
|
||||
}
|
||||
|
||||
[Command("anim", "~m~Benutzung: ~s~/anim [animDict] [animName]")]
|
||||
public void CmdAnim(Player player, string animDict, string animName)
|
||||
{
|
||||
@@ -43,11 +54,8 @@ namespace ReallifeGamemode.Server.Commands
|
||||
return;
|
||||
}
|
||||
NAPI.Player.PlayPlayerAnimation(player, (int)(AnimationFlags.Loop | AnimationFlags.AllowPlayerControl | AnimationFlags.Cancellable), animDict, animName);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
[Command("eat", "~m~Benutzung: ~s~/eat [Item]")]
|
||||
public void CmdAdminEat(Player player, string item)
|
||||
{
|
||||
@@ -144,36 +152,38 @@ namespace ReallifeGamemode.Server.Commands
|
||||
|
||||
#region ahelp
|
||||
|
||||
/* [Command("ahelp", "~m~Benutzung: ~s~/ahelp")]
|
||||
public void CmdAdminHelp(Player player)
|
||||
{
|
||||
if (!player.GetUser()?.IsAdmin(AdminLevel.MAPPING) ?? true)
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (player.GetUser().AdminLevel)
|
||||
{
|
||||
case AdminLevel.MAPPING:
|
||||
ChatService.SendMessage(player, "~b~ " + "/team, /tc, /position");
|
||||
break;
|
||||
/* [Command("ahelp", "~m~Benutzung: ~s~/ahelp")]
|
||||
public void CmdAdminHelp(Player player)
|
||||
{
|
||||
if (!player.GetUser()?.IsAdmin(AdminLevel.MAPPING) ?? true)
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (player.GetUser().AdminLevel)
|
||||
{
|
||||
case AdminLevel.MAPPING:
|
||||
ChatService.SendMessage(player, "~b~ " + "/team, /tc, /position");
|
||||
break;
|
||||
|
||||
case AdminLevel.SUPPORTER:
|
||||
player.TriggerEvent("showShelp");
|
||||
break;
|
||||
|
||||
case AdminLevel.ADMIN:
|
||||
player.TriggerEvent("showAhelp");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
case AdminLevel.SUPPORTER:
|
||||
player.TriggerEvent("showShelp");
|
||||
break;
|
||||
|
||||
case AdminLevel.ADMIN:
|
||||
player.TriggerEvent("showAhelp");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
#endregion ahelp
|
||||
|
||||
#region Mapping / Entwicklung
|
||||
|
||||
[Command("team", "~m~Benutzung: ~s~/team")]
|
||||
public void CmdAdminTeam(Player player)
|
||||
{
|
||||
@@ -234,7 +244,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
switch (typ.ToLower())
|
||||
{
|
||||
case "ip":
|
||||
if(player.HasData("togip"))
|
||||
if (player.HasData("togip"))
|
||||
{
|
||||
player.ResetData("togip");
|
||||
player.SendNotification("~g~[Info]~w~ Ip´s werden nun ausgeblendet.");
|
||||
@@ -258,6 +268,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
player.SendNotification("~g~[Info]~w~ Deathlogs werden nun angezeigt.");
|
||||
}
|
||||
break;
|
||||
|
||||
case "lc":
|
||||
if (player.HasData("toglc"))
|
||||
{
|
||||
@@ -299,6 +310,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
}
|
||||
user.SetBlipAndNametagColor();
|
||||
}
|
||||
|
||||
[Command("aduty", "~m~Benutzung: ~s~/aduty")]
|
||||
public void CmdAdminAduty(Player player)
|
||||
{
|
||||
@@ -314,11 +326,10 @@ namespace ReallifeGamemode.Server.Commands
|
||||
ChatService.Broadcast("~g~[SUPPORT] " + player.Name + " hat sich zum Support angemeldet");
|
||||
|
||||
player.TriggerEvent("toggleADutyMode", true);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if(player.GetData<bool>("SAdminduty"))
|
||||
if (player.GetData<bool>("SAdminduty"))
|
||||
{
|
||||
CmdAdminTSupport(player);
|
||||
}
|
||||
@@ -338,7 +349,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
ChatService.NotAuthorized(player);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
message = Regex.Replace(message, "(~[a-zA-Z]~)|(!{(.*)})", "");
|
||||
message = Regex.Replace(message, "#([0-9A-Fa-f]{6})", m => "!{" + m.Groups[0].Value + "}");
|
||||
|
||||
@@ -467,8 +478,6 @@ namespace ReallifeGamemode.Server.Commands
|
||||
target.Kick();
|
||||
|
||||
ChatService.BroadcastAdmin("~y~SKICK: ~w~" + targetPlayername + " wurde von " + player.GetUser().AdminLevel.GetName() + " " + adminPlayername + " gekickt: " + reason, AdminLevel.SUPPORTER);
|
||||
|
||||
|
||||
}
|
||||
|
||||
[Command("clearchat", "~m~Benutzung: ~s~/clearchat")]
|
||||
@@ -780,12 +789,10 @@ namespace ReallifeGamemode.Server.Commands
|
||||
string adminPlayername = NAPI.Player.GetPlayerName(player);
|
||||
|
||||
ChatService.SendMessage(target, "~r~KICKINFO: ~w~Du wurdest von " + adminPlayername + " vom Server gekickt: " + reason);
|
||||
|
||||
|
||||
target.Kick();
|
||||
|
||||
ChatService.Broadcast("~y~INFO: ~w~" + targetPlayername + " wurde von " + player.GetUser().AdminLevel.GetName() + " " + adminPlayername + " gekickt: " + reason);
|
||||
|
||||
|
||||
}
|
||||
|
||||
[Command("warn", "~m~Benutzung: ~s~/warn [Player] [Grund]", GreedyArg = true)]
|
||||
@@ -810,8 +817,8 @@ namespace ReallifeGamemode.Server.Commands
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
User userwarn = player.GetUser(dbContext);
|
||||
|
||||
userwarn.warn ++;
|
||||
|
||||
userwarn.warn++;
|
||||
dbContext.SaveChanges();
|
||||
if (userwarn.warn >= 3)
|
||||
{
|
||||
@@ -949,6 +956,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
else player.Position = new Vector3(p.X, p.Y, p.Z);
|
||||
}
|
||||
}
|
||||
|
||||
[Command("destroyped", "~m~Benutzung: ~s~/destroyped [PedNr]")]
|
||||
public void CmdAdminAddPPed(Player player, int PedNr)
|
||||
{
|
||||
@@ -960,6 +968,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
player.TriggerEvent("CLIENT:DestroyPed", PedNr);
|
||||
//NAPI.Ped.CreatePed(PedHash.Bankman, new Vector3(player.Position.X, player.Position.Y, player.Position.Z), player.Heading, dimension);
|
||||
}
|
||||
|
||||
[Command("addpped", "~m~Benutzung: ~s~/addpped [PedNr] [model] [dimension] [Dynamic] [Freezed] [Collision(0-3)] [Weapon] [AttackProof] [Fire/Explosion-Proof] [DrownProof]")]
|
||||
public void CmdAdminAddPPed(Player player, Array PedNr, string model, uint dimension = 0, bool dynamic = false, bool freeze = false, int collision = 0, string weapon = "none", bool attackproof = false, bool fireexplosionproof = false, bool drownproof = false)
|
||||
{
|
||||
@@ -971,6 +980,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
player.TriggerEvent("CLIENT:AddPed", PedNr, model, player.Position.X, player.Position.Y, player.Position.Z, player.Heading, dimension, dynamic, freeze, collision, weapon, attackproof, fireexplosionproof, drownproof);
|
||||
//NAPI.Ped.CreatePed(PedHash.Bankman, new Vector3(player.Position.X, player.Position.Y, player.Position.Z), player.Heading, dimension);
|
||||
}
|
||||
|
||||
[Command("addmped", "~m~Benutzung: ~s~/addmped [model] [dimension]")]
|
||||
public void CmdAdminAddMPed(Player player, int model, uint dimension = 0)
|
||||
{
|
||||
@@ -982,6 +992,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
player.TriggerEvent("CLIENT:AddPedModel", model, player.Position.X, player.Position.Y, player.Position.Z, player.Heading, dimension);
|
||||
//NAPI.Ped.CreatePed(PedHash.Bankman, new Vector3(player.Position.X, player.Position.Y, player.Position.Z), player.Heading, dimension);
|
||||
}
|
||||
|
||||
[Command("addgped", "~m~Benutzung: ~s~/addgped")]
|
||||
public void CmdAdminAddGPed(Player player, int model, uint dimension = 0)
|
||||
{
|
||||
@@ -995,6 +1006,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
|
||||
//Peter.freezePosition(true);
|
||||
}
|
||||
|
||||
[Command("addgpedmore", "~m~Benutzung: ~s~/addgpedMore")]
|
||||
public void CmdAdminAddGPedMore(Player player, int model, uint dimension = 0)
|
||||
{
|
||||
@@ -1256,7 +1268,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
foreach (Vehicle v in vehiclesInRange)
|
||||
{
|
||||
ServerVehicle serverVehicle = VehicleManager.GetServerVehicleFromVehicle(v);
|
||||
if(serverVehicle == null)
|
||||
if (serverVehicle == null)
|
||||
{
|
||||
VehicleManager.DeleteVehicle(v);
|
||||
v.Trailer?.Delete();
|
||||
@@ -1462,7 +1474,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
}
|
||||
ChatService.SendMessage(target, "!{#8181E9}Deine Akte wurde vom Admin " + player.Name + " gelöscht. Grund: " + reason);
|
||||
ChatService.BroadcastFaction("!{#8181E9}HQ: Die Akte von " + target.Name + " wurde vom Admin " + player.Name + " gelöscht. Grund: " + reason + ".", new List<int>() { 1, 3 });
|
||||
|
||||
|
||||
target.TriggerEvent("jailTime", 0);
|
||||
targetUser.Wanteds = 0;
|
||||
|
||||
@@ -1687,6 +1699,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
#endregion Admin
|
||||
|
||||
#region ALevel1337
|
||||
|
||||
/*NUR ZUM TESTEN
|
||||
[Command("fakedeath", "~m~Benutzung:~s~ /fakedeath")]
|
||||
public void CmdAdmFakeDeath(Player player)
|
||||
@@ -1718,7 +1731,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
ChatService.NotAuthorized(player);
|
||||
return;
|
||||
}
|
||||
player.SetSharedData("blipColor", blipId);
|
||||
player.SetSharedData("blipColor", blipId);
|
||||
}
|
||||
|
||||
[Command("setsvar", "~m~Benutzung:~s~ /setsvar [ID] [WERT]")]
|
||||
@@ -1996,7 +2009,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
{
|
||||
if (!managedPlayer.IsLoggedIn()) return;
|
||||
managedPlayer.GetUser(dbContext).Wage += wage;
|
||||
|
||||
|
||||
ChatService.SendMessage(managedPlayer, "~b~Admin " + player.Name + " hat im Radius von " + radius + " den Verdienst um $" + wage + " erhöht.");
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
@@ -2130,12 +2143,14 @@ namespace ReallifeGamemode.Server.Commands
|
||||
player.SendChatMessage("Modifier steht auf" + modifier);
|
||||
player.TriggerEvent("SERVER:WeaponModifier2", player, modifier, 1);
|
||||
}
|
||||
|
||||
[Command("wepmmod", "~m~Benutzung: ~s~/wepmmod [Variable]")]
|
||||
public void CmdWeaponMeeleModifier(Player player, float modifier)
|
||||
{
|
||||
player.SendChatMessage("MeeleModifier steht auf" + modifier);
|
||||
player.TriggerEvent("SERVER:WeaponModifier2", player, 1, modifier);
|
||||
}
|
||||
|
||||
[Command("gotocp", "~m~Benutzung: ~s~/gotocp")]
|
||||
public void CmdAdminGotocp(Player admin)
|
||||
{
|
||||
@@ -2379,7 +2394,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
NAPI.Player.SpawnPlayer(managedPlayer, managedPlayer.Position);
|
||||
managedPlayer.Health = 100;
|
||||
|
||||
Medic.delReviveTask(managedPlayer);
|
||||
Medic.delReviveTask(managedPlayer);
|
||||
}
|
||||
|
||||
ChatService.SendMessage(player, "~b~Du hast " + playerRevided + " Spieler wiederbelebt.");
|
||||
@@ -2452,10 +2467,10 @@ namespace ReallifeGamemode.Server.Commands
|
||||
{
|
||||
ChatService.PlayerNotFound(player);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
Faction f = dbContext.Factions.FirstOrDefault(x => x.Id == faction);
|
||||
if (f == null)
|
||||
{
|
||||
@@ -2663,6 +2678,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
player.SetIntoVehicle(vehicle, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
case "noobvehicle":
|
||||
if (player.IsInVehicle)
|
||||
{
|
||||
@@ -3056,6 +3072,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
player.TriggerEvent("manageFactionRanks", json);
|
||||
}
|
||||
}
|
||||
|
||||
[Command("setdoor", "~m~Benutzung: ~s~/setdoor [open/shut] [Tür] [Boolean:Permanet] [Boolean:Lose]")]
|
||||
public void CmdAdminSetDoorOpen(Player player, string status, int door, bool permanent = false, bool lose = true)
|
||||
{
|
||||
@@ -3080,6 +3097,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Command("aplaysound", "~m~Benutzung: ~s~/aplaysound [Dateiname] [mp3/wav] [volume 0.0 - 100.0]", Alias = "aps")]
|
||||
public void CmdAdminPlaySound(Player player, string sound, string typ, double volume = 100)
|
||||
{
|
||||
@@ -3090,6 +3108,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
}
|
||||
player.TriggerEvent("CLIENT:PlaySound", sound, typ, volume);
|
||||
}
|
||||
|
||||
[Command("astopsound", "~m~Benutzung: ~s~/astopsound", Alias = "ass")]
|
||||
public void CmdAdminStopSound(Player player)
|
||||
{
|
||||
@@ -3100,6 +3119,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
}
|
||||
player.TriggerEvent("CLIENT:StopSound");
|
||||
}
|
||||
|
||||
[Command("aspeed", "~m~Benutzung: ~s~/aspeed [Modifier1] [Modifier2]")] //TODO: Überarbeiten ?? SetPlayerVelocity ??
|
||||
public void CmdAdminAspeed(Player player, int modifier, int modifier2 = 1)
|
||||
{
|
||||
@@ -3521,13 +3541,13 @@ namespace ReallifeGamemode.Server.Commands
|
||||
public void CmdAdminCheckStats(Player player, string nameOrId)
|
||||
{
|
||||
User user = player.GetUser();
|
||||
if(!user.IsAdmin(AdminLevel.SUPPORTER))
|
||||
if (!user.IsAdmin(AdminLevel.SUPPORTER))
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
}
|
||||
|
||||
Player target = PlayerService.GetPlayerByNameOrId(nameOrId);
|
||||
if(target == null || !target.IsLoggedIn())
|
||||
if (target == null || !target.IsLoggedIn())
|
||||
{
|
||||
ChatService.PlayerNotFound(player);
|
||||
return;
|
||||
@@ -3543,7 +3563,6 @@ namespace ReallifeGamemode.Server.Commands
|
||||
ChatService.SendMessage(player, $"Stats von {target.Name} - HandMoney: {handmoney.ToMoneyString()}, BankMoney: {bankmoney.ToMoneyString()}, DriverLicense: {driverLicense.ToString()}, BikeLicense: {bikeLicense.ToString()}, FlyingLicense: {flyingLicense.ToString()}, WeaponLicense: {weaponLicense.ToString()}");
|
||||
}
|
||||
|
||||
|
||||
#endregion ALevel1337
|
||||
|
||||
#region ALevel1338
|
||||
@@ -3662,9 +3681,8 @@ namespace ReallifeGamemode.Server.Commands
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(player.HasData("Adminduty") && player.GetData<bool>("Adminduty"))
|
||||
player.TriggerEvent("ADMIN:NoClip");
|
||||
if (player.HasData("Adminduty") && player.GetData<bool>("Adminduty"))
|
||||
player.TriggerEvent("ADMIN:NoClip");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
34
ReallifeGamemode.Server/Util/AnimationSync.cs
Normal file
34
ReallifeGamemode.Server/Util/AnimationSync.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using GTANetworkAPI;
|
||||
|
||||
namespace ReallifeGamemode.Server.Util
|
||||
{
|
||||
public static class AnimationSync
|
||||
{
|
||||
public static void PlaySyncAnimation(this Player player, string animationName)
|
||||
{
|
||||
if (!player.HasData("Animation"))
|
||||
player.SetData("Animation", String.Empty);
|
||||
|
||||
string currentAnimation = player.GetData<string>("Animation");
|
||||
string newAnimation = animationName;
|
||||
|
||||
if (currentAnimation.Equals(newAnimation))
|
||||
return;
|
||||
|
||||
player.SetSharedData("AnimationData", newAnimation);
|
||||
}
|
||||
|
||||
public static void ClearAnimation(this Player player)
|
||||
{
|
||||
if (!player.HasData("Animation"))
|
||||
return;
|
||||
|
||||
player.ResetData("Animation");
|
||||
player.ResetSharedData("AnimationData");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user