Merge branch 'develop' into feature/user-backend
This commit is contained in:
@@ -13,7 +13,7 @@ using reallife_gamemode.Model;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @overview Life of German Reallife - Admin Commands (Admin.cs)
|
* @overview Life of German Reallife - Admin Commands (Admin.cs)
|
||||||
* @author VegaZ, hydrant
|
* @author VegaZ, hydrant, xSprite
|
||||||
* @copyright (c) 2008 - 2018 Life of German
|
* @copyright (c) 2008 - 2018 Life of German
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -62,9 +62,10 @@ namespace reallife_gamemode.Server.Commands
|
|||||||
Vehicle v = NAPI.Vehicle.CreateVehicle(hash, player.Position, player.Rotation.Z, color1, color2);
|
Vehicle v = NAPI.Vehicle.CreateVehicle(hash, player.Position, player.Rotation.Z, color1, color2);
|
||||||
|
|
||||||
player.SetIntoVehicle(v.Handle, -1);
|
player.SetIntoVehicle(v.Handle, -1);
|
||||||
|
player.SendChatMessage("Maxspeed: + " +player.Vehicle.MaxSpeed + "");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Command("fixveh")]
|
[Command("fv")]
|
||||||
public void CmdAdminFixveh(Client player)
|
public void CmdAdminFixveh(Client player)
|
||||||
{
|
{
|
||||||
if (ClientExtension.IsLoggedIn(player) == false)
|
if (ClientExtension.IsLoggedIn(player) == false)
|
||||||
@@ -78,7 +79,7 @@ namespace reallife_gamemode.Server.Commands
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!player.IsInVehicle) // Man darf keine Autos erstellen, wenn man selbst in einem sitzt (verhindert Bugs)
|
if (!player.IsInVehicle)
|
||||||
{
|
{
|
||||||
player.SendChatMessage("~r~[FEHLER]~s~ Du sitzt momentan nicht in einem Fahrzeug.");
|
player.SendChatMessage("~r~[FEHLER]~s~ Du sitzt momentan nicht in einem Fahrzeug.");
|
||||||
return;
|
return;
|
||||||
@@ -87,7 +88,7 @@ namespace reallife_gamemode.Server.Commands
|
|||||||
player.Vehicle.Repair();
|
player.Vehicle.Repair();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Command("delveh")]
|
[Command("vdestroy")]
|
||||||
public void CmdAdminDelveh(Client player)
|
public void CmdAdminDelveh(Client player)
|
||||||
{
|
{
|
||||||
if (ClientExtension.IsLoggedIn(player) == false)
|
if (ClientExtension.IsLoggedIn(player) == false)
|
||||||
@@ -113,7 +114,7 @@ namespace reallife_gamemode.Server.Commands
|
|||||||
player.Vehicle.Delete();
|
player.Vehicle.Delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Command("goto", "~m~Benutzung: ~s~/goto [Name]")]
|
[Command("to", "~m~Benutzung: ~s~/to [Name]")]
|
||||||
public void CmdAdminGoto(Client player, string name)
|
public void CmdAdminGoto(Client player, string name)
|
||||||
{
|
{
|
||||||
if (ClientExtension.IsLoggedIn(player) == false)
|
if (ClientExtension.IsLoggedIn(player) == false)
|
||||||
@@ -138,7 +139,24 @@ namespace reallife_gamemode.Server.Commands
|
|||||||
player.Position = target.Position;
|
player.Position = target.Position;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Command("gotoxyz", "~m~Benutzung: ~s~/gotoxyz [X] [Y] [Z]")]
|
[Command("position")]
|
||||||
|
public void CmdAdminShowPos(Client player)
|
||||||
|
{
|
||||||
|
if (ClientExtension.IsLoggedIn(player) == false)
|
||||||
|
{
|
||||||
|
ChatService.PlayerNotLoggedIn(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
|
||||||
|
{
|
||||||
|
ChatService.NotAuthorized(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
player.SendChatMessage("Position: X Y Z: " + player.Position + "");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Command("gotox", "~m~Benutzung: ~s~/gotox [X] [Y] [Z]")]
|
||||||
public void CmdAdminGotoxyz(Client player, float x, float y, float z)
|
public void CmdAdminGotoxyz(Client player, float x, float y, float z)
|
||||||
{
|
{
|
||||||
if (ClientExtension.IsLoggedIn(player) == false)
|
if (ClientExtension.IsLoggedIn(player) == false)
|
||||||
@@ -155,7 +173,7 @@ namespace reallife_gamemode.Server.Commands
|
|||||||
player.Position = new Vector3(x, y, z);
|
player.Position = new Vector3(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Command("gethere", "~m~Benutzung: ~s~/goto [Name]")]
|
[Command("gh", "~m~Benutzung: ~s~/gh [Name]")]
|
||||||
public void CmdAdminGethere(Client player, string name)
|
public void CmdAdminGethere(Client player, string name)
|
||||||
{
|
{
|
||||||
if (ClientExtension.IsLoggedIn(player) == false)
|
if (ClientExtension.IsLoggedIn(player) == false)
|
||||||
@@ -178,6 +196,7 @@ namespace reallife_gamemode.Server.Commands
|
|||||||
}
|
}
|
||||||
|
|
||||||
target.Position = player.Position;
|
target.Position = player.Position;
|
||||||
|
target.SendChatMessage("Du wurdest von " + player.Name + " teleportiert.");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Command("ipl", "~m~Benutzung: ~s~/ipl [Load / Remove] [Name]")]
|
[Command("ipl", "~m~Benutzung: ~s~/ipl [Load / Remove] [Name]")]
|
||||||
@@ -248,6 +267,260 @@ namespace reallife_gamemode.Server.Commands
|
|||||||
}
|
}
|
||||||
|
|
||||||
target.GiveWeapon(wHash, ammo);
|
target.GiveWeapon(wHash, ammo);
|
||||||
|
target.SendChatMessage("~b~Du hast von " +player.Name +" eine/n " + wHash + " mit einer Munition von " +ammo + " erhalten.");
|
||||||
|
player.SendChatMessage("~b~Du hast " + target.Name + " eine/n " + wHash + " mit einer Munition von " + ammo + " gegeben.");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Command("sethp", "~m~Benutzung: ~s~/sethp [Spieler] (Leben)")]
|
||||||
|
public void CmdAdminSetHp(Client player, string name, int hp = 100)
|
||||||
|
{
|
||||||
|
if (ClientExtension.IsLoggedIn(player) == false)
|
||||||
|
{
|
||||||
|
ChatService.PlayerNotLoggedIn(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
|
||||||
|
{
|
||||||
|
ChatService.NotAuthorized(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Client target = ClientService.GetClientByName(name);
|
||||||
|
if (target == null)
|
||||||
|
{
|
||||||
|
ChatService.PlayerNotFound(target);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
target.Health = hp;
|
||||||
|
target.SendChatMessage("~b~Dein Leben wurde von " + player.Name + " auf " + hp + " gesetzt.");
|
||||||
|
player.SendChatMessage("~b~Du hast das Leben von " + target.Name + " auf " + hp + " gesetzt.");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Command("setarmor", "~m~Benutzung: ~s~/setarmor [Spieler] (Armor)")]
|
||||||
|
public void CmdAdminSetArmor(Client player, string name, int armor = 100)
|
||||||
|
{
|
||||||
|
if (ClientExtension.IsLoggedIn(player) == false)
|
||||||
|
{
|
||||||
|
ChatService.PlayerNotLoggedIn(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
|
||||||
|
{
|
||||||
|
ChatService.NotAuthorized(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Client target = ClientService.GetClientByName(name);
|
||||||
|
if (target == null)
|
||||||
|
{
|
||||||
|
ChatService.PlayerNotFound(target);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
target.Armor = armor;
|
||||||
|
target.SendChatMessage("~b~Deine Rüstung wurde von " + player.Name + " auf " + armor + " gesetzt.");
|
||||||
|
player.SendChatMessage("~b~Du hast die Rüstung von " + target.Name + " auf " + armor + " gesetzt.");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Command("setskin", "~m~Benutzung: ~s~/setskin [Spieler] [Skin]")]
|
||||||
|
public void CmdAdminSetSkin(Client player, string name, string Skin)
|
||||||
|
{
|
||||||
|
if (ClientExtension.IsLoggedIn(player) == false)
|
||||||
|
{
|
||||||
|
ChatService.PlayerNotLoggedIn(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
|
||||||
|
{
|
||||||
|
ChatService.NotAuthorized(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Client target = ClientService.GetClientByName(name);
|
||||||
|
if (target == null)
|
||||||
|
{
|
||||||
|
ChatService.PlayerNotFound(target);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var skin = NAPI.Util.PedNameToModel(Skin);
|
||||||
|
target.SendChatMessage("~b~Dein Skin wurde von " + player.Name + " zu " + skin + " gesetzt.");
|
||||||
|
player.SendChatMessage("~b~Du hast den Skin von " + target.Name + " zu " + skin + " gesetzt.");
|
||||||
|
target.SetSkin(NAPI.Util.PedNameToModel(Skin));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Command("vcolor", "~m~Benutzung: ~s~/vcolor [Farb-ID1] [Farb-ID2]")]
|
||||||
|
public void CmdAdminColor(Client player, int color1, int color2)
|
||||||
|
{
|
||||||
|
if (ClientExtension.IsLoggedIn(player) == false)
|
||||||
|
{
|
||||||
|
ChatService.PlayerNotLoggedIn(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
|
||||||
|
{
|
||||||
|
ChatService.NotAuthorized(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!player.IsInVehicle)
|
||||||
|
{
|
||||||
|
player.SendChatMessage("~r~[FEHLER]~s~ Du sitzt momentan in keinem Fahrzeug!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
player.Vehicle.PrimaryColor = color1;
|
||||||
|
player.Vehicle.SecondaryColor = color2;
|
||||||
|
player.SendChatMessage("Farb-ID1 " + color1 + ", Farb-ID2 " + color2 + "");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Command("aw", "~m~Benutzung: ~s~/aw [Spieler] [Nachricht]")]
|
||||||
|
public void CmdAdminMsg(Client player, string name, string msg)
|
||||||
|
{
|
||||||
|
if (ClientExtension.IsLoggedIn(player) == false)
|
||||||
|
{
|
||||||
|
ChatService.PlayerNotLoggedIn(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
|
||||||
|
{
|
||||||
|
ChatService.NotAuthorized(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Client target = ClientService.GetClientByName(name);
|
||||||
|
if (target == null)
|
||||||
|
{
|
||||||
|
ChatService.PlayerNotFound(target);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (target == player)
|
||||||
|
{
|
||||||
|
ChatService.ErrorMsg(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
target.SendChatMessage("~y~PM von "+ player.Name + ": " + msg +" ");
|
||||||
|
player.SendChatMessage("~y~PM an "+ target.Name + ": " + msg + " ");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Command("takeweapon", "~m~Benutzung: ~s~/takeweapon [Spieler]")]
|
||||||
|
public void CmdAdminTakeWeapon(Client player, string name)
|
||||||
|
{
|
||||||
|
if (ClientExtension.IsLoggedIn(player) == false)
|
||||||
|
{
|
||||||
|
ChatService.PlayerNotLoggedIn(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
|
||||||
|
{
|
||||||
|
ChatService.NotAuthorized(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Client target = ClientService.GetClientByName(name);
|
||||||
|
if (target == null)
|
||||||
|
{
|
||||||
|
ChatService.PlayerNotFound(target);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
player.RemoveAllWeapons();
|
||||||
|
target.SendChatMessage("~b~Deine Waffen wurden dir von " + player.Name + "(Admin) abgenommen");
|
||||||
|
player.SendChatMessage("~b~Dem Spieler " + target.Name + " wurden erfolgreich alle Waffen abgenommen ");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Command("rsethp", "~m~Benutzung: ~s~/rsethp [Radius] (Leben)")]
|
||||||
|
public void CmdAdminRangeSetHP(Client player, float radius, int hp = 100)
|
||||||
|
{
|
||||||
|
if (ClientExtension.IsLoggedIn(player) == false)
|
||||||
|
{
|
||||||
|
ChatService.PlayerNotLoggedIn(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
|
||||||
|
{
|
||||||
|
ChatService.NotAuthorized(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var peopleInRange = NAPI.Player.GetPlayersInRadiusOfPlayer(radius, player);
|
||||||
|
|
||||||
|
foreach (var managedClient in peopleInRange)
|
||||||
|
{
|
||||||
|
managedClient.Health = hp;
|
||||||
|
managedClient.SendChatMessage("~b~Admin "+ player.Name + " hat im Radius von " + radius + " die HP auf " + hp + " gesetzt.");
|
||||||
|
}
|
||||||
|
player.SendChatMessage("~b~Das Leben von " + peopleInRange.Count + " Spielern wurde auf "+ hp + " gesetzt.");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Command("rsetarmor", "~m~Benutzung: ~s~/rsetarmor [Radius] (Armor)")]
|
||||||
|
public void CmdAdminRangeSetArmor(Client player, float radius, int Armor = 100)
|
||||||
|
{
|
||||||
|
if (ClientExtension.IsLoggedIn(player) == false)
|
||||||
|
{
|
||||||
|
ChatService.PlayerNotLoggedIn(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
|
||||||
|
{
|
||||||
|
ChatService.NotAuthorized(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var peopleInRange = NAPI.Player.GetPlayersInRadiusOfPlayer(radius, player);
|
||||||
|
|
||||||
|
foreach (var managedClient in peopleInRange)
|
||||||
|
{
|
||||||
|
managedClient.Health = Armor;
|
||||||
|
managedClient.SendChatMessage("~b~Admin " + player.Name + " hat im Radius von " + radius + " die Rüstung auf " + Armor + " gesetzt.");
|
||||||
|
}
|
||||||
|
player.SendChatMessage("~b~Die Rüstung von " + peopleInRange.Count + " Spielern wurde auf " + Armor + " gesetzt.");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Command("time", "~m~Benutzung: ~s~/time [Stunde] (Minuten) (Sekunden)")]
|
||||||
|
public void CmdAdminSetTime(Client player, int hour, int min = 0, int sec = 0)
|
||||||
|
{
|
||||||
|
if (ClientExtension.IsLoggedIn(player) == false)
|
||||||
|
{
|
||||||
|
ChatService.PlayerNotLoggedIn(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
|
||||||
|
{
|
||||||
|
ChatService.NotAuthorized(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
NAPI.World.SetTime(hour, min, sec);
|
||||||
|
NAPI.Chat.SendChatMessageToAll("Serverzeit auf " + hour + ":" + min + ":" + sec + " gestellt");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[Command("rgiveweapon", "~m~Benutzung: ~s~/rgiveweapon [Radius] [Waffe] [Munition]")]
|
||||||
|
public void CmdAdminRangeGiveWeapon(Client player, float radius, string weapon, int munition)
|
||||||
|
{
|
||||||
|
if (ClientExtension.IsLoggedIn(player) == false)
|
||||||
|
{
|
||||||
|
ChatService.PlayerNotLoggedIn(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
|
||||||
|
{
|
||||||
|
ChatService.NotAuthorized(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
WeaponHash wHash = NAPI.Util.WeaponNameToModel(weapon);
|
||||||
|
|
||||||
|
if (wHash == default(WeaponHash))
|
||||||
|
{
|
||||||
|
player.SendChatMessage("~r~[FEHLER]~s~ Diese Waffe existiert nicht.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var peopleInRange = NAPI.Player.GetPlayersInRadiusOfPlayer(radius, player);
|
||||||
|
|
||||||
|
foreach (var managedClient in peopleInRange)
|
||||||
|
{
|
||||||
|
managedClient.GiveWeapon(wHash, munition);
|
||||||
|
managedClient.SendChatMessage("~b~Admin " +player.Name + " hat im Radius von " + radius + " eine/n " + weapon +" mit " + munition +" Munition vergeben.");
|
||||||
|
}
|
||||||
|
player.SendChatMessage("~b~Du hast " + peopleInRange.Count +" Spielern eine " + weapon + " mit " + munition + " Munition gegeben");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Command("save", "~m~Benutzung: ~s~/save [Typ = ~g~Blip, ~r~Marker, Ped, Pickup, TextLabel, ~g~Vehicle")]
|
[Command("save", "~m~Benutzung: ~s~/save [Typ = ~g~Blip, ~r~Marker, Ped, Pickup, TextLabel, ~g~Vehicle")]
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ namespace reallife_gamemode.Server.Events
|
|||||||
[ServerEvent(Event.PlayerSpawn)]
|
[ServerEvent(Event.PlayerSpawn)]
|
||||||
public void OnPlayerSpawn(Client player)
|
public void OnPlayerSpawn(Client player)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ using System.Text;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @overview Life of German Reallife - Chat Service (ChatService.cs)
|
* @overview Life of German Reallife - Chat Service (ChatService.cs)
|
||||||
* @author hydrant
|
* @author hydrant, xSprite
|
||||||
* @copyright (c) 2008 - 2018 Life of German
|
* @copyright (c) 2008 - 2018 Life of German
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -27,5 +27,9 @@ namespace reallife_gamemode.Server.Services
|
|||||||
{
|
{
|
||||||
player.SendChatMessage("~r~[FEHLER]~s~ Du bist nicht eingeloggt.");
|
player.SendChatMessage("~r~[FEHLER]~s~ Du bist nicht eingeloggt.");
|
||||||
}
|
}
|
||||||
|
public static void ErrorMsg(Client player)
|
||||||
|
{
|
||||||
|
player.SendChatMessage("~r~[FEHLER]~s~ Die Aktion wurde nicht ausgeführt.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user