Miese Corona Zeiten push für Lenhardt

This commit is contained in:
Siga
2020-05-10 19:19:53 +02:00
parent 15e4cec8ee
commit efbff34c21
159 changed files with 8042 additions and 8695 deletions

View File

@@ -1,70 +1,65 @@
/***
/***
@overview Life of German - Wanted (Wanted.cs)
@author kookroach
@copyright (c) 2008 - 2019 Life of German
@copyright (c) 2008 - 2019 Life of German
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using GTANetworkAPI;
using ReallifeGamemode.Database.Entities;
using ReallifeGamemode.Server.Extensions;
using ReallifeGamemode.Database.Models;
using ReallifeGamemode.Server.Services;
using ReallifeGamemode.Server.Extensions;
namespace ReallifeGamemode.Server.Wanted
{
public class WantedEscapeTimer
{
public static Dictionary<int, int> waTimer { get; set; } = new Dictionary<int, int>(); //zeit in ms
/*
public static void WantedTimer()
{
//System.Timers.Timer timer = new System.Timers.Timer(2500);
//timer.Start();
//timer.Elapsed += Timer_Elapsed;
}
*/
public static void ResetWantedTimeToElapse(Player client)
{
User user = client.GetUser();
if (user.FactionId == 1 || user.FactionId == 3)
return;
waTimer[user.Id] = 300000;
}
public static void Timer_Elapsed()
{
foreach (var player in NAPI.Pools.GetAllPlayers())
{
User user = player.GetUser();
if (user != null && user.Wanteds > 0)
public static Dictionary<int, int> waTimer { get; set; } = new Dictionary<int, int>(); //zeit in ms
/*
public static void WantedTimer()
{
if (!waTimer.ContainsKey(user.Id))
ResetWantedTimeToElapse(player);
//System.Timers.Timer timer = new System.Timers.Timer(2500);
//timer.Start();
//timer.Elapsed += Timer_Elapsed;
}
*/
bool isNearCop = false;
foreach (var playerCop in NAPI.Pools.GetAllPlayers())
{
if (!playerCop.IsLoggedIn()) continue;
public static void ResetWantedTimeToElapse(Player client)
{
User user = client.GetUser();
if (user.FactionId == 1 || user.FactionId == 3)
return;
User cop = playerCop.GetUser();
if (cop != null && (cop.FactionId == 1 || cop.FactionId == 3))
waTimer[user.Id] = 300000;
}
public static void Timer_Elapsed()
{
foreach (var player in NAPI.Pools.GetAllPlayers())
{
if (cop.GetData<bool>("duty") && playerCop.Position.DistanceTo2D(player.Position) <= 500)
{
//Schriftzug 'abgetaucht' zerstören :(
isNearCop = true;
break;
User user = player.GetUser();
if (user != null && user.Wanteds > 0)
{
if (!waTimer.ContainsKey(user.Id))
ResetWantedTimeToElapse(player);
}
//Hier abgetaucht schriftzug einfügen :)
}
}
bool isNearCop = false;
foreach (var playerCop in NAPI.Pools.GetAllPlayers())
{
if (!playerCop.IsLoggedIn()) continue;
User cop = playerCop.GetUser();
if (cop != null && (cop.FactionId == 1 || cop.FactionId == 3))
{
if (cop.GetData<bool>("duty") && playerCop.Position.DistanceTo2D(player.Position) <= 500)
{
//Schriftzug 'abgetaucht' zerstören :(
isNearCop = true;
break;
}
//Hier abgetaucht schriftzug einfügen :)
}
}
if (!waTimer.ContainsKey(user.Id))
waTimer[user.Id] = 300000;
@@ -82,12 +77,15 @@ namespace ReallifeGamemode.Server.Wanted
case null:
player.SetSharedData("blipColor", 0);
break;
case 8:
player.SetSharedData("blipColor", 83);
break;
case 7:
player.SetSharedData("blipColor", 52);
break;
case 4:
player.SetSharedData("blipColor", 5);
break;
@@ -95,13 +93,12 @@ namespace ReallifeGamemode.Server.Wanted
}
dbContext.SaveChanges();
}
}
if (!isNearCop)
waTimer[user.Id] -= 2500;
if (!isNearCop)
waTimer[user.Id] -= 2500;
}
}
}
}
}
}
}
}