diff --git a/ReallifeGamemode.Server/Commands/UserCommands.cs b/ReallifeGamemode.Server/Commands/UserCommands.cs index ecd1e741..c297e6ad 100644 --- a/ReallifeGamemode.Server/Commands/UserCommands.cs +++ b/ReallifeGamemode.Server/Commands/UserCommands.cs @@ -40,9 +40,10 @@ namespace ReallifeGamemode.Server.Commands { ChatService.SendMessage(client, "~g~[PAYCHECK] -------------------------------------------------------"); ChatService.SendMessage(client, "~g~[PAYCHECK]~s~ Lohn : ~g~+$" + Economy.Paychecks[user.Id].Wage); + ChatService.SendMessage(client, "~g~[PAYCHECK]~s~ Finanzhilfe : ~g~+$" + (int)Economy.Paychecks[user.Id].FinancialHelp); ChatService.SendMessage(client, "~g~[PAYCHECK]~s~ Fahrzeugsteuer : ~r~-$" + Economy.Paychecks[user.Id].VehicleTaxation); ChatService.SendMessage(client, "~g~[PAYCHECK]~s~ Grundsteuer (Haus) : ~r~-$" + Economy.Paychecks[user.Id].PropertyTaxation); - ChatService.SendMessage(client, "~g~[PAYCHECK]~s~ Steuer : ~r~" + (int)(Economy.Paychecks[user.Id].FinancialInterest * 100) + " %"); + ChatService.SendMessage(client, "~g~[PAYCHECK]~s~ Einkommen Steuer : ~r~" + (int)(Economy.Paychecks[user.Id].FinancialInterest * 100) + " %"); ChatService.SendMessage(client, ""); ChatService.SendMessage(client, "~g~[PAYCHECK]~s~ Ausgaben : ~r~-$" + (Economy.Paychecks[user.Id].Wage - Economy.Paychecks[user.Id].Amount)); ChatService.SendMessage(client, "~g~[PAYCHECK] -------------------------------------------------------"); diff --git a/ReallifeGamemode.Server/Finance/Economy.cs b/ReallifeGamemode.Server/Finance/Economy.cs index b9014656..0bd9001a 100644 --- a/ReallifeGamemode.Server/Finance/Economy.cs +++ b/ReallifeGamemode.Server/Finance/Economy.cs @@ -24,7 +24,7 @@ namespace ReallifeGamemode.Server.Finance public static (int, float, float) GetEconomyClass(Client client, int wage) { int bankAccount = client.GetUser().GetBankAccount().Balance; - float financialHelp = (float)Math.Pow(-1.0005, -bankAccount) * -1000; + float financialHelp = -(float)Math.Pow(1.0005, -bankAccount) * -1000; float financialInterest = 1 - (float)Math.Pow(1.00006, -wage) * 1; if (financialInterest >= 0.7) financialInterest = 0.7f; diff --git a/ReallifeGamemode.Server/Main.cs b/ReallifeGamemode.Server/Main.cs index 98dbdb40..bcf7ce20 100644 --- a/ReallifeGamemode.Server/Main.cs +++ b/ReallifeGamemode.Server/Main.cs @@ -3,6 +3,7 @@ using GTANetworkAPI; using ReallifeGamemode.Server.Classes; using ReallifeGamemode.Server.Managers; using ReallifeGamemode.Server.Util; +using ReallifeGamemode.Server.Wanted; /** * @overview Life of German Reallife - Main Class (Main.cs) @@ -62,6 +63,10 @@ namespace ReallifeGamemode.Server }; NAPI.Data.SetWorldData("blipTemplate", tempBlip); + + WantedEscapeTimer.WantedTimer(); + + } } } \ No newline at end of file diff --git a/ReallifeGamemode.Server/Wanted/WantedEscapeTimer.cs b/ReallifeGamemode.Server/Wanted/WantedEscapeTimer.cs new file mode 100644 index 00000000..ffa7f1ad --- /dev/null +++ b/ReallifeGamemode.Server/Wanted/WantedEscapeTimer.cs @@ -0,0 +1,80 @@ +/*** +@overview Life of German - Wanted (Wanted.cs) +@author kookroach +@copyright (c) 2008 - 2019 Life of German +*/ + + +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading; +using GTANetworkAPI; +using ReallifeGamemode.Server.Entities; +using ReallifeGamemode.Server.Extensions; +using ReallifeGamemode.Server.Services; + +namespace ReallifeGamemode.Server.Wanted +{ + public class WantedEscapeTimer + { + + public static Dictionary waTimer { get; set; } = new Dictionary(); //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(Client client) + { + User user = client.GetUser(); + if (user.FactionId == 1 || user.FactionId == 3) + return; + + waTimer[user.Id] = 300000; + } + + + private static void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) + { + foreach (var player in NAPI.Pools.GetAllPlayers()) + { + User user = player.GetUser(); + if(user.Wanteds > 0) + { + if (!waTimer.ContainsKey(user.Id)) + ResetWantedTimeToElapse(player); + + bool isNearCop = false; + foreach (var playerCop in NAPI.Pools.GetAllPlayers()) + { + User cop = playerCop.GetUser(); + if (cop.FactionId == 1 || cop.FactionId == 3) + { + if (cop.GetData("duty") && playerCop.Position.DistanceTo2D(player.Position) <= 500) + { + //Schriftzug 'abgetaucht' zerstören :( + isNearCop = true; + break; + + } + //Hier abgetaucht schriftzug einfügen :) + } + } + + if (waTimer[user.Id] <= 0) + { + ResetWantedTimeToElapse(player); + user.Wanteds -= 1; + } + + if (!isNearCop) + waTimer[user.Id] -= 2500; + } + } + } + } +}