Modified Whitelist, Disconnect Event only on logged-in players

This commit is contained in:
hydrant
2018-10-02 22:58:58 +02:00
parent 5fe0173855
commit 3af8694d01
2 changed files with 15 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using GTANetworkAPI;
@@ -20,10 +21,20 @@ namespace reallife_gamemode.Server.Events
{
class Connect : Script
{
private List<string> whitelistNames = new List<string>()
{
"VegasZ",
"datgame_",
"xSprite",
"xPrike",
"balboistderbeste"
};
[ServerEvent(Event.PlayerConnected)]
public void OnPlayerConnected(Client player)
{
if(!(player.SocialClubName == "VegasZ") || !(player.SocialClubName == "datgame_") || !(player.SocialClubName == "xSprite"))
if(!whitelistNames.Any(x => x == player.SocialClubName))
{
player.TriggerEvent("disableLogin");
player.Kick();

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using GTANetworkAPI;
using reallife_gamemode.Server.Extensions;
/**
* @overview Life of German Reallife - Event Login (Login.cs)
@@ -17,6 +18,8 @@ namespace reallife_gamemode.Server.Events
[ServerEvent(Event.PlayerDisconnected)]
public void OnPlayerDisconnected(Client player, DisconnectionType type, string reason)
{
if (!player.IsLoggedIn()) return;
if (type == DisconnectionType.Left)
{
NAPI.Util.ConsoleOutput(player.Name + " left");