*WhitelistStatus hinzugefügt *Servervariablen hinzugefügt: /setsvar
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
using System.Linq;
|
||||
using GTANetworkAPI;
|
||||
using ReallifeGamemode.Database.Models;
|
||||
using ReallifeGamemode.Server.Extensions;
|
||||
using ReallifeGamemode.Server.Managers;
|
||||
using ReallifeGamemode.Server.Services;
|
||||
using ReallifeGamemode.Server.Types;
|
||||
@@ -29,21 +30,39 @@ namespace ReallifeGamemode.Server.Events
|
||||
|
||||
bool registered = false;
|
||||
|
||||
var whitelistStatus = Managers.SVarManager.SVars.FirstOrDefault(v => v.Variable == "WhitelistStatus").Value;
|
||||
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
registered = dbContext.Users.Where(u => u.Name == player.Name).Any();
|
||||
|
||||
if (!dbContext.WhitelistEntries.Any(w => w.SocialClubName == player.SocialClubName))
|
||||
switch (whitelistStatus)
|
||||
{
|
||||
string msg2 = "~m~*** " + player.Name + "[" + player.SocialClubName + "] (" + player.Address + ") hat versucht, sich einzuloggen, steht aber nicht auf der Whitelist.";
|
||||
ChatService.BroadcastAdmin(msg2, AdminLevel.ADMIN);
|
||||
case 0: //Whitelist aus
|
||||
break;
|
||||
|
||||
NAPI.Util.ConsoleOutput(player.Name + " tried to join without whitelist entry");
|
||||
case 1: //Whitelist aktiv (Main-Server)
|
||||
if (dbContext.Users.FirstOrDefault(u => u.SocialClubName == player.SocialClubName).AdminLevel < AdminLevel.MAPPING)
|
||||
{
|
||||
NAPI.Util.ConsoleOutput(player.Name + " versucht sich einzuloggen während die Whitelist an ist. [STATUS 1]");
|
||||
player.Kick();
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
ChatService.SendMessage(player, "~m~Du stehst nicht auf der Whitelist");
|
||||
case 2: //Whitelist aktiv (Test-Server)
|
||||
if (!dbContext.WhitelistEntries.Any(w => w.SocialClubName == player.SocialClubName))
|
||||
{
|
||||
string msg2 = "~m~*** " + player.Name + "[" + player.SocialClubName + "] (" + player.Address + ") hat versucht, sich einzuloggen, steht aber nicht auf der Whitelist.";
|
||||
ChatService.BroadcastAdmin(msg2, AdminLevel.ADMIN);
|
||||
|
||||
player.Kick();
|
||||
return;
|
||||
NAPI.Util.ConsoleOutput(player.Name + " tried to join without whitelist entry [STATUS 2]");
|
||||
|
||||
ChatService.SendMessage(player, "~m~Du stehst nicht auf der Whitelist");
|
||||
|
||||
player.Kick();
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +83,7 @@ namespace ReallifeGamemode.Server.Events
|
||||
string msg = "~m~*** " + player.Name + " [" + player.SocialClubName + "] [ID: " + player.Handle.Value + "] (" + player.Address + ")";
|
||||
if(player.HasData("togip"))
|
||||
{
|
||||
ChatService.SendMessage(player, msg);
|
||||
ChatService.SendMessage(player, msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user