Miese Corona Zeiten push für Lenhardt
This commit is contained in:
@@ -1,16 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using GTANetworkAPI;
|
||||
using GTANetworkAPI;
|
||||
using ReallifeGamemode.Database.Models;
|
||||
using ReallifeGamemode.Server.Extensions;
|
||||
using ReallifeGamemode.Server.Job;
|
||||
using ReallifeGamemode.Server.Managers;
|
||||
using ReallifeGamemode.Database.Models;
|
||||
using ReallifeGamemode.Server.Util;
|
||||
using ReallifeGamemode.Server.Services;
|
||||
using ReallifeGamemode.Database;
|
||||
using ReallifeGamemode.Server.Types;
|
||||
using ReallifeGamemode.Server.Util;
|
||||
|
||||
/**
|
||||
* @overview Life of German Reallife - Event Login (Login.cs)
|
||||
@@ -21,50 +16,50 @@ using ReallifeGamemode.Server.Types;
|
||||
namespace ReallifeGamemode.Server.Events
|
||||
{
|
||||
public class Disconnect : Script
|
||||
{
|
||||
[ServerEvent(Event.PlayerDisconnected)]
|
||||
public void OnPlayerDisconnected(Player player, DisconnectionType type, string reason)
|
||||
{
|
||||
if (!player.IsLoggedIn()) return;
|
||||
[ServerEvent(Event.PlayerDisconnected)]
|
||||
public void OnPlayerDisconnected(Player player, DisconnectionType type, string reason)
|
||||
{
|
||||
if (!player.IsLoggedIn()) return;
|
||||
|
||||
if (type == DisconnectionType.Left)
|
||||
{
|
||||
NAPI.Util.ConsoleOutput(player.Name + " left");
|
||||
}
|
||||
if (type == DisconnectionType.Kicked)
|
||||
{
|
||||
NAPI.Util.ConsoleOutput(player.Name + " kicked");
|
||||
}
|
||||
if (type == DisconnectionType.Timeout)
|
||||
{
|
||||
NAPI.Util.ConsoleOutput(player.Name + " Timeoutet");
|
||||
}
|
||||
if (type == DisconnectionType.Left)
|
||||
{
|
||||
NAPI.Util.ConsoleOutput(player.Name + " left");
|
||||
}
|
||||
if (type == DisconnectionType.Kicked)
|
||||
{
|
||||
NAPI.Util.ConsoleOutput(player.Name + " kicked");
|
||||
}
|
||||
if (type == DisconnectionType.Timeout)
|
||||
{
|
||||
NAPI.Util.ConsoleOutput(player.Name + " Timeoutet");
|
||||
}
|
||||
|
||||
if (GlobalHelper.DutyAdmins.Contains(player))
|
||||
{
|
||||
GlobalHelper.DutyAdmins.Remove(player);
|
||||
}
|
||||
if (GlobalHelper.DutyAdmins.Contains(player))
|
||||
{
|
||||
GlobalHelper.DutyAdmins.Remove(player);
|
||||
}
|
||||
|
||||
if (player.GetUser().IsAdmin(AdminLevel.MAPPING))
|
||||
{
|
||||
ChatService.BroadcastAdmin("!{#FFFF00}*** " + player.Name + " hat den Server verlassen", AdminLevel.MAPPING);
|
||||
}
|
||||
if (player.GetUser().IsAdmin(AdminLevel.MAPPING))
|
||||
{
|
||||
ChatService.BroadcastAdmin("!{#FFFF00}*** " + player.Name + " hat den Server verlassen", AdminLevel.MAPPING);
|
||||
}
|
||||
|
||||
JobBase job = JobManager.GetJob(player.GetUser().JobId ?? -1);
|
||||
if (job != null) job.StopJob(player, true);
|
||||
JobBase job = JobManager.GetJob(player.GetUser().JobId ?? -1);
|
||||
if (job != null) job.StopJob(player, true);
|
||||
|
||||
using (var saveUser = new DatabaseContext())
|
||||
{
|
||||
var user = player.GetUser(saveUser);
|
||||
Vector3 pos = player.Position;
|
||||
using (var saveUser = new DatabaseContext())
|
||||
{
|
||||
var user = player.GetUser(saveUser);
|
||||
Vector3 pos = player.Position;
|
||||
|
||||
user.PositionX = pos.X;
|
||||
user.PositionY = pos.Y;
|
||||
user.PositionZ = pos.Z;
|
||||
saveUser.SaveChanges();
|
||||
user.Dead = player.HasData("isDead") ? (bool)player.GetData<bool>("isDead") : false;
|
||||
}
|
||||
player.SetData("isLoggedIn", false);
|
||||
user.PositionX = pos.X;
|
||||
user.PositionY = pos.Y;
|
||||
user.PositionZ = pos.Z;
|
||||
saveUser.SaveChanges();
|
||||
user.Dead = player.HasData("isDead") ? (bool)player.GetData<bool>("isDead") : false;
|
||||
}
|
||||
player.SetData("isLoggedIn", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user