Fix Fehler Wanted-Meldung bei Tod + KnastTimer

This commit is contained in:
Mac_Slash
2020-04-13 18:22:45 +02:00
parent fbce02adf1
commit bc7b4724ca
3 changed files with 19 additions and 6 deletions

View File

@@ -74,7 +74,7 @@ export default function (globalData: IGlobalData): void {
});
mp.events.add("jailTime", (time) => {
jailTime = time;
jailTime = JSON.parse(time);
});
mp.events.add("GangwarScore", (attacker, defender, attscore, defscore) => {
@@ -240,7 +240,15 @@ export default function (globalData: IGlobalData): void {
})
if (jailTime > 0) {
mp.game.graphics.drawText("~y~Knastzeit: ~ " + jailTime + " Minuten", [0.92, 0.52],
mp.game.graphics.drawText("~y~Knast: ", [0.889, 0.52],
{
font: 4,
color: [255, 255, 255, 255],
scale: [0.5, 0.5],
outline: true,
centre: false
})
mp.game.graphics.drawText("ca. ~r~" + jailTime + "~w~ Min", [0.935, 0.52],
{
font: 4,
color: [255, 255, 255, 255],

View File

@@ -9,6 +9,8 @@ using ReallifeGamemode.Server.Factions.Medic;
using ReallifeGamemode.Database.Models;
using ReallifeGamemode.Server.Services;
using ReallifeGamemode.Services;
using System.Diagnostics;
using Newtonsoft.Json;
namespace ReallifeGamemode.Server.Wanted
{
@@ -90,16 +92,16 @@ namespace ReallifeGamemode.Server.Wanted
int timeMinutes = 0;
if (((int)(user.JailTime / 60)) <= 1 && user.JailTime != 0)
if (((int)(client.GetUser().JailTime / 60)) <= 1 && client.GetUser().JailTime != 0)
{
timeMinutes = 1;
}
else
{
timeMinutes = (int)(user.JailTime / 60);
timeMinutes = (int)(client.GetUser().JailTime / 60);
}
client.TriggerEvent("jailTime", timeMinutes);
client.TriggerEvent("jailTime", JsonConvert.SerializeObject(timeMinutes));
ChatService.SendMessage(client, "!{#FF614A}* Du bist nun im Gefängnis für " + timeMinutes + " Minute/n.");
ChatService.BroadcastFaction("!{#8181E9}HQ: " + user.Name + " wurde ins Gefängnis geliefert.", new List<int>() { 1, 3 });
switch (user.FactionId)
@@ -121,7 +123,7 @@ namespace ReallifeGamemode.Server.Wanted
}
else
{
ChatService.BroadcastFaction("!{#8181E9}HQ: Der Verdächtigte " + player.Name + " wurde soeben ins Krankenhaus eingeliefert.", new System.Collections.Generic.List<int>() { 1, 3 });
ChatService.BroadcastFaction("!{#8181E9}HQ: Der Verdächtigte " + user.Name + " wurde soeben ins Krankenhaus eingeliefert.", new System.Collections.Generic.List<int>() { 1, 3 });
}
}
}

View File

@@ -66,6 +66,9 @@ namespace ReallifeGamemode.Server.Wanted
}
}
if (!waTimer.ContainsKey(user.Id))
waTimer[user.Id] = 300000;
if (waTimer[user.Id] <= 0)
{
ResetWantedTimeToElapse(player);