Made small changes for Admin Commands
This commit is contained in:
@@ -20,7 +20,11 @@ namespace reallife_gamemode.Server.Commands
|
||||
[Command("o", "~m~Benutzung: ~s~/o [Nachricht]", GreedyArg = true)]
|
||||
public void CmdAdminO(Client player, string message)
|
||||
{
|
||||
if (ChatService.PlayerLoggedIn(player) == false) return;
|
||||
if (ClientExtension.IsLoggedIn(player) == false)
|
||||
{
|
||||
ChatService.PlayerNotLoggedIn(player);
|
||||
return;
|
||||
}
|
||||
if (!player.GetUser()?.IsAdmin(AdminLevel.SUPPORTER) ?? true)
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
@@ -34,7 +38,11 @@ namespace reallife_gamemode.Server.Commands
|
||||
[Command("veh", "~m~Benutzung: ~s~/veh [Fahrzeug] (Farbe 1) (Farbe 2)")]
|
||||
public void CmdAdminVeh(Client player, VehicleHash hash, int color1 = 111, int color2 = 111)
|
||||
{
|
||||
if (ChatService.PlayerLoggedIn(player) == false) return;
|
||||
if (ClientExtension.IsLoggedIn(player) == false)
|
||||
{
|
||||
ChatService.PlayerNotLoggedIn(player);
|
||||
return;
|
||||
}
|
||||
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
@@ -55,7 +63,11 @@ namespace reallife_gamemode.Server.Commands
|
||||
[Command("fixveh")]
|
||||
public void CmdAdminFixveh(Client player)
|
||||
{
|
||||
if (ChatService.PlayerLoggedIn(player) == false) return;
|
||||
if (ClientExtension.IsLoggedIn(player) == false)
|
||||
{
|
||||
ChatService.PlayerNotLoggedIn(player);
|
||||
return;
|
||||
}
|
||||
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
@@ -74,7 +86,11 @@ namespace reallife_gamemode.Server.Commands
|
||||
[Command("delveh")]
|
||||
public void CmdAdminDelveh(Client player)
|
||||
{
|
||||
if (ChatService.PlayerLoggedIn(player) == false) return;
|
||||
if (ClientExtension.IsLoggedIn(player) == false)
|
||||
{
|
||||
ChatService.PlayerNotLoggedIn(player);
|
||||
return;
|
||||
}
|
||||
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
@@ -96,7 +112,11 @@ namespace reallife_gamemode.Server.Commands
|
||||
[Command("goto", "~m~Benutzung: ~s~/goto [Name]")]
|
||||
public void CmdAdminGoto(Client player, string name)
|
||||
{
|
||||
if (ChatService.PlayerLoggedIn(player) == false) return;
|
||||
if (ClientExtension.IsLoggedIn(player) == false)
|
||||
{
|
||||
ChatService.PlayerNotLoggedIn(player);
|
||||
return;
|
||||
}
|
||||
if (!player.GetUser()?.IsAdmin(AdminLevel.SUPPORTER) ?? true)
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
@@ -117,7 +137,11 @@ namespace reallife_gamemode.Server.Commands
|
||||
[Command("gotoxyz", "~m~Benutzung: ~s~/gotoxyz [X] [Y] [Z]")]
|
||||
public void CmdAdminGotoxyz(Client player, float x, float y, float z)
|
||||
{
|
||||
if (ChatService.PlayerLoggedIn(player) == false) return;
|
||||
if (ClientExtension.IsLoggedIn(player) == false)
|
||||
{
|
||||
ChatService.PlayerNotLoggedIn(player);
|
||||
return;
|
||||
}
|
||||
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
@@ -130,7 +154,11 @@ namespace reallife_gamemode.Server.Commands
|
||||
[Command("gethere", "~m~Benutzung: ~s~/goto [Name]")]
|
||||
public void CmdAdminGethere(Client player, string name)
|
||||
{
|
||||
if (ChatService.PlayerLoggedIn(player) == false) return;
|
||||
if (ClientExtension.IsLoggedIn(player) == false)
|
||||
{
|
||||
ChatService.PlayerNotLoggedIn(player);
|
||||
return;
|
||||
}
|
||||
if (!player.GetUser()?.IsAdmin(AdminLevel.SUPPORTER) ?? true)
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
@@ -151,7 +179,11 @@ namespace reallife_gamemode.Server.Commands
|
||||
[Command("ipl", "~m~Benutzung: ~s~/ipl [Load / Remove] [Name]")]
|
||||
public void CmdAdminIpl(Client player, string option, string name)
|
||||
{
|
||||
if (ChatService.PlayerLoggedIn(player) == false) return;
|
||||
if (ClientExtension.IsLoggedIn(player) == false)
|
||||
{
|
||||
ChatService.PlayerNotLoggedIn(player);
|
||||
return;
|
||||
}
|
||||
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
@@ -179,7 +211,11 @@ namespace reallife_gamemode.Server.Commands
|
||||
[Command("giveweapon", "~m~Benutzung: ~s~/giveweapon [Spieler] [Waffe] [Munition]")]
|
||||
public void CmdAdminGiveweapon(Client player, string name, string weapon, int ammo)
|
||||
{
|
||||
if (ChatService.PlayerLoggedIn(player) == false) return;
|
||||
if (ClientExtension.IsLoggedIn(player) == false)
|
||||
{
|
||||
ChatService.PlayerNotLoggedIn(player);
|
||||
return;
|
||||
}
|
||||
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
@@ -213,7 +249,11 @@ namespace reallife_gamemode.Server.Commands
|
||||
[Command("save", "~m~Benutzung: ~s~/save [Typ = ~g~Blip, ~r~Marker, Ped, Pickup, TextLabel, ~g~Vehicle")]
|
||||
public void CmdAdminSave(Client player, string typ)
|
||||
{
|
||||
if (ChatService.PlayerLoggedIn(player) == false) return;
|
||||
if (ClientExtension.IsLoggedIn(player) == false)
|
||||
{
|
||||
ChatService.PlayerNotLoggedIn(player);
|
||||
return;
|
||||
}
|
||||
if (!player.GetUser()?.IsAdmin(AdminLevel.SUPPORTER) ?? true)
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
|
||||
@@ -23,5 +23,10 @@ namespace reallife_gamemode.Server.Extensions
|
||||
return dbContext.Users.FirstOrDefault(u => u.Name == client.Name);
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsLoggedIn(Client player)
|
||||
{
|
||||
return player.GetData("isLoggedIn");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,10 +23,9 @@ namespace reallife_gamemode.Server.Services
|
||||
player.SendChatMessage("~r~[FEHLER]~s~ Der Spieler wurde nicht gefunden.");
|
||||
}
|
||||
|
||||
public static bool PlayerLoggedIn(Client player)
|
||||
public static void PlayerNotLoggedIn(Client player)
|
||||
{
|
||||
if(player.GetData("isLoggedIn") == false) player.SendChatMessage("~r~[FEHLER]~s~ Du bist nicht eingeloggt.");
|
||||
return player.GetData("isLoggedIn");
|
||||
player.SendChatMessage("~r~[FEHLER]~s~ Du bist nicht eingeloggt.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user