maybe fix knast
This commit is contained in:
@@ -35,9 +35,10 @@ namespace ReallifeGamemode.Server.Wanted
|
||||
|
||||
public static void Timer_Elapsed()
|
||||
{
|
||||
using var dbContext = new DatabaseContext();
|
||||
foreach (var player in NAPI.Pools.GetAllPlayers())
|
||||
{
|
||||
User user = player.GetUser();
|
||||
User user = player.GetUser(dbContext);
|
||||
if (user != null && user.Wanteds > 0)
|
||||
{
|
||||
if (!waTimer.ContainsKey(user.Id))
|
||||
@@ -68,30 +69,10 @@ namespace ReallifeGamemode.Server.Wanted
|
||||
{
|
||||
ResetWantedTimeToElapse(player);
|
||||
player.SendChatMessage("~y~Du hast erfolgtreich einen Wanted abgetaucht.");
|
||||
using (var dbContext = new DatabaseContext())
|
||||
user.Wanteds -= 1;
|
||||
if (user.Wanteds == 0)
|
||||
{
|
||||
player.GetUser(dbContext).Wanteds -= 1;
|
||||
if (player.GetUser(dbContext).Wanteds == 0)
|
||||
{
|
||||
switch (player.GetUser(dbContext).FactionId)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
user.SetBlipAndNametagColor();
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user