Merge branch 'develop' of ssh://development.life-of-german.org:451/log-gtav/reallife-gamemode into develop
This commit is contained in:
@@ -9,7 +9,11 @@ using reallife_gamemode.Server.Util;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @overview Life of German Reallife - Admin Commands (Admin.cs)
|
* @overview Life of German Reallife - Admin Commands (Admin.cs)
|
||||||
|
<<<<<<< HEAD
|
||||||
|
* @author VegaZ, hydrant, balbo
|
||||||
|
=======
|
||||||
* @author VegaZ, hydrant, xSprite
|
* @author VegaZ, hydrant, xSprite
|
||||||
|
>>>>>>> 5e0e0d82f2d05dda2954836a69347d4433839f85
|
||||||
* @copyright (c) 2008 - 2018 Life of German
|
* @copyright (c) 2008 - 2018 Life of German
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -250,7 +254,7 @@ namespace reallife_gamemode.Server.Commands
|
|||||||
Client target = ClientService.GetClientByName(name);
|
Client target = ClientService.GetClientByName(name);
|
||||||
if (target == null)
|
if (target == null)
|
||||||
{
|
{
|
||||||
ChatService.PlayerNotFound(target);
|
ChatService.PlayerNotFound(player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -284,7 +288,7 @@ namespace reallife_gamemode.Server.Commands
|
|||||||
Client target = ClientService.GetClientByName(name);
|
Client target = ClientService.GetClientByName(name);
|
||||||
if (target == null)
|
if (target == null)
|
||||||
{
|
{
|
||||||
ChatService.PlayerNotFound(target);
|
ChatService.PlayerNotFound(player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -310,7 +314,7 @@ namespace reallife_gamemode.Server.Commands
|
|||||||
Client target = ClientService.GetClientByName(name);
|
Client target = ClientService.GetClientByName(name);
|
||||||
if (target == null)
|
if (target == null)
|
||||||
{
|
{
|
||||||
ChatService.PlayerNotFound(target);
|
ChatService.PlayerNotFound(player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -336,7 +340,7 @@ namespace reallife_gamemode.Server.Commands
|
|||||||
Client target = ClientService.GetClientByName(name);
|
Client target = ClientService.GetClientByName(name);
|
||||||
if (target == null)
|
if (target == null)
|
||||||
{
|
{
|
||||||
ChatService.PlayerNotFound(target);
|
ChatService.PlayerNotFound(player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -387,7 +391,7 @@ namespace reallife_gamemode.Server.Commands
|
|||||||
Client target = ClientService.GetClientByName(name);
|
Client target = ClientService.GetClientByName(name);
|
||||||
if (target == null)
|
if (target == null)
|
||||||
{
|
{
|
||||||
ChatService.PlayerNotFound(target);
|
ChatService.PlayerNotFound(player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (target == player)
|
if (target == player)
|
||||||
@@ -415,7 +419,7 @@ namespace reallife_gamemode.Server.Commands
|
|||||||
Client target = ClientService.GetClientByName(name);
|
Client target = ClientService.GetClientByName(name);
|
||||||
if (target == null)
|
if (target == null)
|
||||||
{
|
{
|
||||||
ChatService.PlayerNotFound(target);
|
ChatService.PlayerNotFound(player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
player.RemoveAllWeapons();
|
player.RemoveAllWeapons();
|
||||||
@@ -488,7 +492,11 @@ namespace reallife_gamemode.Server.Commands
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
[Command("val")]
|
||||||
|
public void Val(Client player)
|
||||||
|
{
|
||||||
|
NAPI.Chat.SendChatMessageToAll("Value of " + player.Name + ": " + player.Handle.Value);
|
||||||
|
}
|
||||||
[Command("rgiveweapon", "~m~Benutzung: ~s~/rgiveweapon [Radius] [Waffe] [Munition]")]
|
[Command("rgiveweapon", "~m~Benutzung: ~s~/rgiveweapon [Radius] [Waffe] [Munition]")]
|
||||||
public void CmdAdminRangeGiveWeapon(Client player, float radius, string weapon, int munition)
|
public void CmdAdminRangeGiveWeapon(Client player, float radius, string weapon, int munition)
|
||||||
{
|
{
|
||||||
@@ -551,5 +559,238 @@ namespace reallife_gamemode.Server.Commands
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Command("a", "~m~Benutzung: ~s~/a [Nachricht]")]
|
||||||
|
public void CmdAdminA(Client player, string message)
|
||||||
|
{
|
||||||
|
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
|
||||||
|
{
|
||||||
|
ChatService.NotAuthorized(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Client> playerlist = NAPI.Pools.GetAllPlayers();
|
||||||
|
foreach (Client currentPlayer in playerlist)
|
||||||
|
{
|
||||||
|
if (currentPlayer.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? false)
|
||||||
|
{
|
||||||
|
NAPI.Chat.SendChatMessageToPlayer(currentPlayer, "~r~Admin " + NAPI.Player.GetPlayerName(player) + "~w~: " + message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[Command("team", "~m~Benutzung: ~s~/team")]
|
||||||
|
public void CmdAdminTeam(Client player)
|
||||||
|
{
|
||||||
|
if (!player.GetUser()?.IsAdmin(AdminLevel.SUPPORTER) ?? true)
|
||||||
|
{
|
||||||
|
ChatService.NotAuthorized(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
NAPI.Chat.SendChatMessageToPlayer(player, "Online Teammitglieder:");
|
||||||
|
|
||||||
|
List<Client> playerlist = NAPI.Pools.GetAllPlayers();
|
||||||
|
foreach (Client currentPlayer in playerlist)
|
||||||
|
{
|
||||||
|
if (currentPlayer.GetUser()?.IsAdmin(AdminLevel.SUPPORTER) ?? false)
|
||||||
|
{
|
||||||
|
NAPI.Chat.SendChatMessageToPlayer(player, "~w~" + NAPI.Player.GetPlayerName(currentPlayer));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Command("setweather", "~m~Benutzung: ~s~/setweather [WEATHER]")]
|
||||||
|
public void CmdAdminSetweather(Client player, string weather)
|
||||||
|
{
|
||||||
|
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
|
||||||
|
{
|
||||||
|
ChatService.NotAuthorized(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Weather weatherBefore = NAPI.World.GetWeather();
|
||||||
|
NAPI.World.SetWeather(weather);
|
||||||
|
Weather weatherAfter = NAPI.World.GetWeather();
|
||||||
|
|
||||||
|
if (!weatherBefore.Equals(weatherAfter))
|
||||||
|
{
|
||||||
|
NAPI.Chat.SendChatMessageToPlayer(player, "~w~Wetter geändert: " + NAPI.World.GetWeather());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NAPI.Chat.SendChatMessageToPlayer(player, "~w~Wetter konnte nicht geändert werden");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Command("freeze", "~m~Benutzung: ~s~/freeze [Player]")]
|
||||||
|
public void CmdAdminFreeze(Client player, string targetname)
|
||||||
|
{
|
||||||
|
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
|
||||||
|
{
|
||||||
|
ChatService.NotAuthorized(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Client target = ClientService.GetClientByName(targetname);
|
||||||
|
if (target == null)
|
||||||
|
{
|
||||||
|
ChatService.PlayerNotFound(target);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
target.Freeze(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Command("unfreeze", "~m~Benutzung: ~s~/freeze [Player]")]
|
||||||
|
public void CmdAdminUnfreeze(Client player, string targetname)
|
||||||
|
{
|
||||||
|
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
|
||||||
|
{
|
||||||
|
ChatService.NotAuthorized(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Client target = ClientService.GetClientByName(targetname);
|
||||||
|
if (target == null)
|
||||||
|
{
|
||||||
|
ChatService.PlayerNotFound(target);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
target.Freeze(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Command("kick", "~m~Benutzung: ~s~/kick [Player] [Grund]")]
|
||||||
|
public void CmdAdminKick(Client player, string targetname, string reason)
|
||||||
|
{
|
||||||
|
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
|
||||||
|
{
|
||||||
|
ChatService.NotAuthorized(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Client target = ClientService.GetClientByName(targetname);
|
||||||
|
if (target == null)
|
||||||
|
{
|
||||||
|
ChatService.PlayerNotFound(target);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
string targetPlayername = NAPI.Player.GetPlayerName(target);
|
||||||
|
string adminPlayername = NAPI.Player.GetPlayerName(player);
|
||||||
|
|
||||||
|
NAPI.Chat.SendChatMessageToPlayer(target, "~r~KICKINFO: ~w~Du wurdest von " + adminPlayername + " vom Server gekickt: " + reason);
|
||||||
|
target.Kick();
|
||||||
|
NAPI.Chat.SendChatMessageToAll("~y~INFO: ~w~" + targetPlayername + " wurde von " + adminPlayername + " gekickt: " + reason);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Command("clearchat", "~m~Benutzung: ~s~/clearchat")]
|
||||||
|
public void CmdAdminClearchat(Client player)
|
||||||
|
{
|
||||||
|
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
|
||||||
|
{
|
||||||
|
ChatService.NotAuthorized(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < 20; i++)
|
||||||
|
{
|
||||||
|
NAPI.Chat.SendChatMessageToAll("");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Command("up", "~m~Benutzung: ~s~/up [Wert]")]
|
||||||
|
public void CmdAdminUp(Client player, int value = 5)
|
||||||
|
{
|
||||||
|
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
|
||||||
|
{
|
||||||
|
ChatService.NotAuthorized(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector3 playerPosition = new Vector3(player.Position.X, player.Position.Y, player.Position.Z + value);
|
||||||
|
player.Position = playerPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Command("dn", "~m~Benutzung: ~s~/dn [Wert]")]
|
||||||
|
public void CmdAdminDn(Client player, int value = 5)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
|
||||||
|
{
|
||||||
|
ChatService.NotAuthorized(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector3 playerPosition = new Vector3(player.Position.X, player.Position.Y, player.Position.Z - value);
|
||||||
|
player.Position = playerPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Command("rt", "~m~Benutzung: ~s~/rt [Wert]")]
|
||||||
|
public void CmdAdminRt(Client player, int value = 5)
|
||||||
|
{
|
||||||
|
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
|
||||||
|
{
|
||||||
|
ChatService.NotAuthorized(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
float playerHeading = player.Heading;
|
||||||
|
|
||||||
|
if (playerHeading < 45 || playerHeading >= 315)
|
||||||
|
{
|
||||||
|
Vector3 playerPosition = new Vector3(player.Position.X + value, player.Position.Y, player.Position.Z);
|
||||||
|
player.Position = playerPosition;
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (playerHeading < 315 && playerHeading >= 225)
|
||||||
|
{
|
||||||
|
Vector3 playerPosition = new Vector3(player.Position.X, player.Position.Y - value, player.Position.Z);
|
||||||
|
player.Position = playerPosition;
|
||||||
|
}
|
||||||
|
else if (playerHeading >= 135 && playerHeading < 225)
|
||||||
|
{
|
||||||
|
Vector3 playerPosition = new Vector3(player.Position.X - value, player.Position.Y, player.Position.Z);
|
||||||
|
player.Position = playerPosition;
|
||||||
|
}
|
||||||
|
else if (playerHeading >= 45 && playerHeading < 135)
|
||||||
|
{
|
||||||
|
Vector3 playerPosition = new Vector3(player.Position.X, player.Position.Y + value, player.Position.Z);
|
||||||
|
player.Position = playerPosition;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Command("lt", "~m~Benutzung: ~s~/lt [Wert]")]
|
||||||
|
public void CmdAdminLt(Client player, int value = 5)
|
||||||
|
{
|
||||||
|
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
|
||||||
|
{
|
||||||
|
ChatService.NotAuthorized(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
float playerHeading = player.Heading;
|
||||||
|
|
||||||
|
if (playerHeading < 45 || playerHeading >= 315)
|
||||||
|
{
|
||||||
|
Vector3 playerPosition = new Vector3(player.Position.X - value, player.Position.Y, player.Position.Z);
|
||||||
|
player.Position = playerPosition;
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (playerHeading < 315 && playerHeading >= 225)
|
||||||
|
{
|
||||||
|
Vector3 playerPosition = new Vector3(player.Position.X, player.Position.Y + value, player.Position.Z);
|
||||||
|
player.Position = playerPosition;
|
||||||
|
}
|
||||||
|
else if (playerHeading >= 135 && playerHeading < 225)
|
||||||
|
{
|
||||||
|
Vector3 playerPosition = new Vector3(player.Position.X + value, player.Position.Y, player.Position.Z);
|
||||||
|
player.Position = playerPosition;
|
||||||
|
}
|
||||||
|
else if (playerHeading >= 45 && playerHeading < 135)
|
||||||
|
{
|
||||||
|
Vector3 playerPosition = new Vector3(player.Position.X, player.Position.Y - value, player.Position.Z);
|
||||||
|
player.Position = playerPosition;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user