Add Login Security

This commit is contained in:
VegaZ
2018-09-23 12:16:40 +02:00
parent 1538b41ffb
commit 12486929cf
5 changed files with 46 additions and 3 deletions

View File

@@ -20,6 +20,7 @@ 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 (!player.GetUser()?.IsAdmin(AdminLevel.SUPPORTER) ?? true)
{
ChatService.NotAuthorized(player);
@@ -33,6 +34,7 @@ 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 (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
{
ChatService.NotAuthorized(player);
@@ -53,6 +55,7 @@ namespace reallife_gamemode.Server.Commands
[Command("fixveh")]
public void CmdAdminFixveh(Client player)
{
if (ChatService.PlayerLoggedIn(player) == false) return;
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
{
ChatService.NotAuthorized(player);
@@ -71,6 +74,7 @@ namespace reallife_gamemode.Server.Commands
[Command("delveh")]
public void CmdAdminDelveh(Client player)
{
if (ChatService.PlayerLoggedIn(player) == false) return;
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
{
ChatService.NotAuthorized(player);
@@ -92,6 +96,7 @@ 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 (!player.GetUser()?.IsAdmin(AdminLevel.SUPPORTER) ?? true)
{
ChatService.NotAuthorized(player);
@@ -112,6 +117,7 @@ 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 (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
{
ChatService.NotAuthorized(player);
@@ -124,6 +130,7 @@ 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 (!player.GetUser()?.IsAdmin(AdminLevel.SUPPORTER) ?? true)
{
ChatService.NotAuthorized(player);
@@ -144,6 +151,7 @@ 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 (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
{
ChatService.NotAuthorized(player);
@@ -171,6 +179,7 @@ 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 (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
{
ChatService.NotAuthorized(player);
@@ -204,13 +213,16 @@ 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 (!player.GetUser()?.IsAdmin(AdminLevel.SUPPORTER) ?? true)
{
ChatService.NotAuthorized(player);
return;
}
switch (typ)
{
case "Blip":
player.TriggerEvent("saveBlip");
break;
case "Ped":
break;
case "Vehicle":
if (player.IsInVehicle)