Cleaned up admin commands

This commit is contained in:
hydrant
2018-10-28 17:37:22 +01:00
parent 580c34f32f
commit d2c52661fc

View File

@@ -39,6 +39,7 @@ namespace reallife_gamemode.Server.Commands
string publicMessage = "~b~(( " + player.GetUser().AdminLevel.GetName() + " " + player.Name + ": " + message + " ))";
NAPI.Chat.SendChatMessageToAll(publicMessage);
}
[Command("team", "~m~Benutzung: ~s~/team")]
public void CmdAdminTeam(Client player)
{
@@ -59,6 +60,7 @@ namespace reallife_gamemode.Server.Commands
}
}
}
[Command("dimension")]
public void CmdAdminDimension(Client player)
{
@@ -69,6 +71,7 @@ namespace reallife_gamemode.Server.Commands
}
player.SendChatMessage("Deine Dimension ist ~g~" + player.Dimension);
}
[Command("to", "~m~Benutzung: ~s~/to [Name]")]
public void CmdAdminGoto(Client player, string name)
{
@@ -89,6 +92,7 @@ namespace reallife_gamemode.Server.Commands
if (player.IsInVehicle && player.VehicleSeat == -1) player.Vehicle.Position = target.Position;
else player.Position = target.Position;
}
[Command("position")]
public void CmdAdminShowPos(Client player)
{
@@ -100,6 +104,7 @@ namespace reallife_gamemode.Server.Commands
player.SendChatMessage("Position: X Y Z: " + player.Position);
}
[Command("gh", "~m~Benutzung: ~s~/gh [Name]")]
public void CmdAdminGethere(Client player, string name)
{
@@ -121,6 +126,7 @@ namespace reallife_gamemode.Server.Commands
else target.Position = player.Position;
target.SendChatMessage("Du wurdest von " + player.Name + " teleportiert.");
}
[Command("aw", "~m~Benutzung: ~s~/aw [Spieler] [Nachricht]", GreedyArg = true)]
public void CmdAdminMsg(Client player, string name, string msg)
{
@@ -146,6 +152,7 @@ namespace reallife_gamemode.Server.Commands
string Message = "~y~PM von " + player.GetUser().AdminLevel.GetName() + " " + player.Name + ": " + msg + "";
NAPI.Chat.SendChatMessageToPlayer(target, Message);
}
[Command("factionlist", "~m~Benutzung: ~s~/factionlist")]
public void CmdAdminFactionlist(Client player)
{
@@ -179,6 +186,7 @@ namespace reallife_gamemode.Server.Commands
ChatService.BroadcastAdmin("~r~[ADMINCHAT]: " + player.GetUser().AdminLevel.GetName() + " " + player.Name + "~w~: " + message, AdminLevel.ADMIN);
}
[Command("freeze", "~m~Benutzung: ~s~/freeze [Spieler]")]
public void CmdAdminFreeze(Client player, string targetname)
{
@@ -198,6 +206,7 @@ namespace reallife_gamemode.Server.Commands
target.SendChatMessage("Du wurdest von ~y~" + player.Name + "~s~ gefreezed.");
target.Freeze(true);
}
[Command("unfreeze", "~m~Benutzung: ~s~/unfreeze [Spieler]")]
public void CmdAdminUnfreeze(Client player, string targetname)
{
@@ -217,6 +226,7 @@ namespace reallife_gamemode.Server.Commands
target.SendChatMessage("Du wurdest von ~y~" + player.Name + "~s~ unfreezed.");
target.Freeze(false);
}
[Command("gotolist")] //TODO Als Browser anzeigeN??
public void CmdAdminGotoList(Client player)
{
@@ -235,6 +245,7 @@ namespace reallife_gamemode.Server.Commands
}
player.SendChatMessage(gotoString);
}
[Command("mark")]
public void CmdAdminMark(Client player)
{
@@ -246,6 +257,7 @@ namespace reallife_gamemode.Server.Commands
player.SetData("mark", player.Position);
player.SendNotification("~y~Mark ~s~gespeichert", true);
}
[Command("gotomark")]
public void CmdAdminGotoMark(Client player)
{
@@ -264,6 +276,7 @@ namespace reallife_gamemode.Server.Commands
if (player.IsInVehicle && player.VehicleSeat == -1) player.Vehicle.Position = player.GetData("mark");
else player.Position = player.GetData("mark");
}
[Command("clearchat", "~m~Benutzung: ~s~/clearchat")]
public void CmdAdminClearchat(Client player)
{
@@ -390,6 +403,7 @@ namespace reallife_gamemode.Server.Commands
else player.Position = playerPosition;
}
}
[Command("setdimension", "~m~Benutzung: ~s~/setdimension [Spieler] [Dimension]")]
public void CmdAdminSetDimension(Client player, string targetname, uint dimension)
{
@@ -409,6 +423,7 @@ namespace reallife_gamemode.Server.Commands
target.SendChatMessage("~s~Deine Dimension wurde auf ~g~" + dimension + "~s~ geändert.");
player.SendChatMessage("~s~Die Dimension von ~y~" + target.Name + " ~s~wurde auf ~g~" + dimension + "~s~ geändert.");
}
[Command("kick", "~m~Benutzung: ~s~/kick [Player] [Grund]")]
public void CmdAdminKick(Client player, string targetname, string reason)
{
@@ -432,6 +447,7 @@ namespace reallife_gamemode.Server.Commands
target.Kick();
NAPI.Chat.SendChatMessageToAll("~y~INFO: ~w~" + targetPlayername + " wurde von " + player.GetUser().AdminLevel.GetName() + " " + adminPlayername + " gekickt: " + reason);
}
[Command("ip", "~m~Benutzung: ~s~/ip [Spieler]")]
public void CmdAdminIp(Client player, string targetname)
{
@@ -449,6 +465,7 @@ namespace reallife_gamemode.Server.Commands
}
player.SendChatMessage("IP von ~y~" + NAPI.Player.GetPlayerName(target) + ": ~g~" + target.Address);
}
[Command("ban", "~m~Benutzung: ~s~/ban [User] [Zeit in Minuten(0 für Permanent)] [Grund] ", GreedyArg = true)]
public void CmdAdminBan(Client admin, string user, int mins, string reason)
{
@@ -468,6 +485,7 @@ namespace reallife_gamemode.Server.Commands
target.GetUser().BanPlayer(admin, reason, mins);
}
[Command("unban", "~m~Benutzung: ~s~/unban [Name] ", GreedyArg = true)]
public void CmdAdminUnban(Client admin, string userName)
{
@@ -520,6 +538,7 @@ namespace reallife_gamemode.Server.Commands
string message = "~y~INFO: ~s~Der Spieler ~y~" + user.Name + " ~s~wurde von ~y~" + admin.Name + " ~s~entbannt.";
ChatService.BroadcastAdmin(message, AdminLevel.ADMIN);
}
[Command("goto", "~m~Benutzung: ~s~/goto [Ort]")]
public void CmdAdminGotoPoint(Client player, string location)
{
@@ -543,6 +562,7 @@ namespace reallife_gamemode.Server.Commands
}
}
[Command("spec", "~m~Benutzung: ~s~/spec [Player]")]
public void CmdAdminSpectate(Client player, string name)
{
@@ -577,6 +597,7 @@ namespace reallife_gamemode.Server.Commands
}
}
[Command("slap", "~m~Benutzung: ~s~/slap [Spieler] (Höhe)")]
public void CmdAdminSlap(Client player, string name, int wert = 5)
{
@@ -596,6 +617,7 @@ namespace reallife_gamemode.Server.Commands
target.Position = new Vector3(target.Position.X, target.Position.Y, target.Position.Z + wert);
player.SendChatMessage("Du hast " + target.Name + " geslappt. Höhe: " + wert + "");
}
[Command("takeweapon", "~m~Benutzung: ~s~/takeweapon [Spieler]")]
public void CmdAdminTakeWeapon(Client player, string name)
{
@@ -638,6 +660,7 @@ namespace reallife_gamemode.Server.Commands
target.SendChatMessage("~b~Deine HP wurden von " + player.Name + " auf " + hp + " gesetzt.");
player.SendChatMessage("~b~Du hast die HP von " + target.Name + " auf " + hp + " gesetzt.");
}
[Command("clothes", "~m~Benutzung: ~s~/clothes [Spieler] [Slot] [Component ID] (Textur)")]
public void CmdAdminClothes(Client player, string name, int slot, int component, int texture = 0)
{
@@ -656,6 +679,7 @@ namespace reallife_gamemode.Server.Commands
target.SetClothes(slot, component, texture);
}
[Command("props", "~m~Benutzung: ~s~/props [Spieler] [Slot] [Component ID] (Textur)")]
public void CmdAdminProps(Client player, string name, int slot, int component, int texture = 0)
{
@@ -674,6 +698,7 @@ namespace reallife_gamemode.Server.Commands
target.SetAccessories(slot, component, texture);
}
[Command("gotox", "~m~Benutzung: ~s~/gotox [X] [Y] [Z]")]
public void CmdAdminGotoxyz(Client player, float x, float y, float z)
{
@@ -685,7 +710,6 @@ namespace reallife_gamemode.Server.Commands
if (player.IsInVehicle && player.VehicleSeat == -1) player.Vehicle.Position = new Vector3(x, y, z);
else player.Position = new Vector3(x, y, z);
}
#endregion
@@ -725,6 +749,7 @@ namespace reallife_gamemode.Server.Commands
player.SetIntoVehicle(v.Handle, -1);
}
[Command("fv")]
public void CmdAdminFixveh(Client player)
{
@@ -741,6 +766,7 @@ namespace reallife_gamemode.Server.Commands
}
player.Vehicle.Repair();
}
[Command("vdestroy")]
public void CmdAdminDelveh(Client player)
{
@@ -761,6 +787,7 @@ namespace reallife_gamemode.Server.Commands
player.Vehicle.Delete();
}
[Command("vcolor", "~m~Benutzung: ~s~/vcolor [Farb-ID1] [Farb-ID2]")]
public void CmdAdminColor(Client player, int color1, int color2)
{
@@ -780,6 +807,7 @@ namespace reallife_gamemode.Server.Commands
player.Vehicle.SecondaryColor = color2;
player.SendChatMessage("Farb-ID1 " + color1 + ", Farb-ID2 " + color2 + "");
}
[Command("giveweapon", "~m~Benutzung: ~s~/giveweapon [Spieler] [Waffe] [Munition]")]
public void CmdAdminGiveweapon(Client player, string name, string weapon, int ammo)
{
@@ -814,6 +842,7 @@ namespace reallife_gamemode.Server.Commands
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("arevive", "~m~Benutzung: ~s~/arevive [Spieler]")]
public void CmdAdminRevive(Client player, string name)
{
@@ -840,6 +869,7 @@ namespace reallife_gamemode.Server.Commands
NAPI.Player.SpawnPlayer(target, target.Position);
target.Health = 100;
}
[Command("setarmor", "~m~Benutzung: ~s~/setarmor [Spieler] (Armor)")]
public void CmdAdminSetArmor(Client player, string name, int armor = 100)
{
@@ -883,8 +913,9 @@ namespace reallife_gamemode.Server.Commands
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));
target.SetSkin(skin);
}
[Command("vmod", "~m~Benutzung: ~s~/vmod [Slot] [Mod ID]")]
public void CmdAdminVmod(Client player, int slot, int mod)
{
@@ -903,6 +934,7 @@ namespace reallife_gamemode.Server.Commands
if (mod == -1) player.Vehicle.RemoveMod(slot);
else player.Vehicle.SetMod(slot, mod);
}
[Command("aneon", "~m~Benutzung: ~s~/aneon [R][G][B]")]
public void CmdAdminNeon(Client player, int r, int g, int b)
{
@@ -941,6 +973,7 @@ namespace reallife_gamemode.Server.Commands
Vehicle veh = NAPI.Player.GetPlayerVehicle(player);
NAPI.Vehicle.SetVehicleTyreSmokeColor(veh, new Color(r, g, b));
}
[Command("ipl", "~m~Benutzung: ~s~/ipl [Load / Remove] [Name]")]
public void CmdAdminIpl(Client player, string option, string name)
{
@@ -967,6 +1000,7 @@ namespace reallife_gamemode.Server.Commands
player.SendChatMessage("~m~Benutzung: ~s~/ipl [Load / Remove] [Name]");
}
}
[Command("rsethp", "~m~Benutzung: ~s~/rsethp [Radius] (Leben)")]
public void CmdAdminRangeSetHP(Client player, float radius, int hp = 100)
{
@@ -1017,6 +1051,7 @@ namespace reallife_gamemode.Server.Commands
managedClient.Health = 100;
}
}
[Command("rsetarmor", "~m~Benutzung: ~s~/rsetarmor [Radius] (Armor)")]
public void CmdAdminRangeSetArmor(Client player, float radius, int Armor = 100)
{
@@ -1035,6 +1070,7 @@ namespace reallife_gamemode.Server.Commands
}
player.SendChatMessage("~b~Die Rüstung von " + peopleInRange.Count + " Spielern wurde auf " + Armor + " gesetzt.");
}
[Command("rgiveweapon", "~m~Benutzung: ~s~/rgiveweapon [Radius] [Waffe] [Munition]")]
public void CmdAdminRangeGiveWeapon(Client player, float radius, string weapon, int munition)
{
@@ -1062,6 +1098,7 @@ namespace reallife_gamemode.Server.Commands
}
player.SendChatMessage("~b~Du hast " + peopleInRange.Count + " Spielern eine " + weapon + " mit " + munition + " Munition gegeben");
}
[Command("time", "~m~Benutzung: ~s~/time [Stunde] (Minuten) (Sekunden)")]
public void CmdAdminSetTime(Client player, int hour, int min = 0, int sec = 0)
{
@@ -1077,6 +1114,7 @@ namespace reallife_gamemode.Server.Commands
return;
}
[Command("ainvite", "~m~Benutzung: ~s~/ainvite [Name] [Fraktion]")]
public void CmdAdminAinvite(Client player, string name, int faction)
{
@@ -1127,6 +1165,7 @@ namespace reallife_gamemode.Server.Commands
dbContext.SaveChanges();
}
}
[Command("makeleader", "~m~Benutzung: ~s~/makeleader [Name] [Fraktion]")]
public void CmdAdminMakeleader(Client player, string name, int faction)
{
@@ -1166,6 +1205,7 @@ namespace reallife_gamemode.Server.Commands
dbContext.SaveChanges();
}
}
[Command("save", "~m~Benutzung: ~s~/save [Typ = ~g~Blip, Goto (X), ~r~Marker, Ped, Pickup, TextLabel, ~g~Vehicle, FVehicle, SVehicle] (Beschreibung) = (X)")]
public void CmdAdminSave(Client player, string typ, string description = null)
{
@@ -1249,6 +1289,7 @@ namespace reallife_gamemode.Server.Commands
}
}
#region loadCommand
[Command("load", "~m~Benutzung: ~s~/load [Typ = OnlineBunkers, ArcadiusBusinessCentre, MazeBankBuilding, LomBank, MazeBankWest, ClubWareHouse, SpecialLocations, GRHYacht, DHYacht, PYacht, AircraftCarrier, BridgeTC, BridgeTN, NorthYankton, ONeilsFarmB, ONeilsFarm, Morgue")]
public void CmdAdminloadlocation(Client player, string typ)
@@ -1475,6 +1516,7 @@ namespace reallife_gamemode.Server.Commands
}
#endregion
//
[Command("managefactionranks", "~m~Benutzung: ~s~/managefactionranks [Fraktions-ID]")]
public void CmdFactionManageFactionRanks(Client player, int factionID)
@@ -1774,31 +1816,5 @@ namespace reallife_gamemode.Server.Commands
{
SaveManager.SaveAllOnSave();
}
/*
[Command("restart")]
public void CmdAdminRestart(Client player)
{
if (ClientExtension.IsLoggedIn(player) == false)
{
ChatService.PlayerNotLoggedIn(player);
return;
}
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
{
ChatService.NotAuthorized(player);
return;
}
var users = NAPI.Pools.GetAllPlayers();
foreach(Client user in users)
{
user.SendChatMessage("~r~Server startet neu.~s~ Bitte verbinde dich über ~y~F1~s~ neu.");
user.Kick();
}
NAPI.Resource.StopResource("reallife-gamemode");
}*/
}
}