wanted abtauchen blinken

This commit is contained in:
hydrant
2021-04-11 21:53:08 +02:00
parent f258896e56
commit 523e193317
3 changed files with 101 additions and 54 deletions

View File

@@ -27,12 +27,8 @@ namespace ReallifeGamemode.Server.Wanted
}
*/
public static void ResetWantedTimeToElapse(Player client)
public static void ResetWantedTimeToElapse(User user)
{
User user = client.GetUser();
if (user.FactionId == 1 || user.FactionId == 3)
return;
waTimer[user.Id] = WantedEscapeTime;
}
@@ -45,7 +41,7 @@ namespace ReallifeGamemode.Server.Wanted
if (user != null && user.Wanteds > 0)
{
if (!waTimer.ContainsKey(user.Id))
ResetWantedTimeToElapse(player);
ResetWantedTimeToElapse(user);
bool isNearCop = false;
foreach (var playerCop in NAPI.Pools.GetAllPlayers())
@@ -70,7 +66,7 @@ namespace ReallifeGamemode.Server.Wanted
if (waTimer[user.Id] <= 0)
{
ResetWantedTimeToElapse(player);
ResetWantedTimeToElapse(user);
player.SendChatMessage("~y~Du hast erfolgreich einen Wanted abgetaucht.");
user.Wanteds -= 1;
if (user.Wanteds == 0)
@@ -82,7 +78,15 @@ namespace ReallifeGamemode.Server.Wanted
waTimer[user.Id] = WantedEscapeTime;
}
else if (!isNearCop)
{
player.TriggerEvent("SERVER:SetWantedFlash", true);
waTimer[user.Id] -= 2500;
}
else if (isNearCop)
{
player.TriggerEvent("SERVER:SetWantedFlash", false);
ResetWantedTimeToElapse(user);
}
}
}
}