Modified Whitelist, Disconnect Event only on logged-in players
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using GTANetworkAPI;
|
using GTANetworkAPI;
|
||||||
@@ -20,10 +21,20 @@ namespace reallife_gamemode.Server.Events
|
|||||||
{
|
{
|
||||||
class Connect : Script
|
class Connect : Script
|
||||||
{
|
{
|
||||||
|
private List<string> whitelistNames = new List<string>()
|
||||||
|
{
|
||||||
|
"VegasZ",
|
||||||
|
"datgame_",
|
||||||
|
"xSprite",
|
||||||
|
"xPrike",
|
||||||
|
"balboistderbeste"
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
[ServerEvent(Event.PlayerConnected)]
|
[ServerEvent(Event.PlayerConnected)]
|
||||||
public void OnPlayerConnected(Client player)
|
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.TriggerEvent("disableLogin");
|
||||||
player.Kick();
|
player.Kick();
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using GTANetworkAPI;
|
using GTANetworkAPI;
|
||||||
|
using reallife_gamemode.Server.Extensions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @overview Life of German Reallife - Event Login (Login.cs)
|
* @overview Life of German Reallife - Event Login (Login.cs)
|
||||||
@@ -17,6 +18,8 @@ namespace reallife_gamemode.Server.Events
|
|||||||
[ServerEvent(Event.PlayerDisconnected)]
|
[ServerEvent(Event.PlayerDisconnected)]
|
||||||
public void OnPlayerDisconnected(Client player, DisconnectionType type, string reason)
|
public void OnPlayerDisconnected(Client player, DisconnectionType type, string reason)
|
||||||
{
|
{
|
||||||
|
if (!player.IsLoggedIn()) return;
|
||||||
|
|
||||||
if (type == DisconnectionType.Left)
|
if (type == DisconnectionType.Left)
|
||||||
{
|
{
|
||||||
NAPI.Util.ConsoleOutput(player.Name + " left");
|
NAPI.Util.ConsoleOutput(player.Name + " left");
|
||||||
|
|||||||
Reference in New Issue
Block a user