Wanted Escape Timer Start
This commit is contained in:
@@ -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] -------------------------------------------------------");
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
80
ReallifeGamemode.Server/Wanted/WantedEscapeTimer.cs
Normal file
80
ReallifeGamemode.Server/Wanted/WantedEscapeTimer.cs
Normal file
@@ -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<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(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<bool>("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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user