diff --git a/ReallifeGamemode.Client/Business/cardealer.ts b/ReallifeGamemode.Client/Business/cardealer.ts
index 96b5822c..b6667a31 100644
--- a/ReallifeGamemode.Client/Business/cardealer.ts
+++ b/ReallifeGamemode.Client/Business/cardealer.ts
@@ -72,7 +72,7 @@ export default function carDealer(globalData: IGlobalData) {
priceItem.SetRightLabel("~g~$~s~ " + moneyFormat(price));
break;
case 'Fraktion':
- priceItem.SetRightLabel("~g~$~s~ " + moneyFormat(price * 3));
+ priceItem.SetRightLabel("~g~$~s~ " + moneyFormat(price * 1.5));
break;
}
}
diff --git a/ReallifeGamemode.Client/Interaction/bankmenu.ts b/ReallifeGamemode.Client/Interaction/bankmenu.ts
index 791c9899..b886c0a6 100644
--- a/ReallifeGamemode.Client/Interaction/bankmenu.ts
+++ b/ReallifeGamemode.Client/Interaction/bankmenu.ts
@@ -137,9 +137,11 @@ export default function bankMenuHandle(globalData: IGlobalData) {
mp.events.add('removeFactionBankmenu', () => {
- mp.gui.cursor.show(false, false);
- factionBankmenu.Close(true);
- globalData.InMenu = false;
+ if (globalData.InMenu && factionBankmenu) {
+ mp.gui.cursor.show(false, false);
+ factionBankmenu.Close(true);
+ globalData.InMenu = false;
+ }
});
diff --git a/ReallifeGamemode.Client/admin/anticheat.ts b/ReallifeGamemode.Client/admin/anticheat.ts
index a5a248d6..078a8b86 100644
--- a/ReallifeGamemode.Client/admin/anticheat.ts
+++ b/ReallifeGamemode.Client/admin/anticheat.ts
@@ -22,7 +22,8 @@
-1716589765,
-2084633992,
-1075685676,
- -1786099057
+ -1786099057,
+ -1074790547
]
mp.events.add("playerJoin", () => {
@@ -151,6 +152,7 @@
checkWeaponhash() {
let h = this.weapon;
if (allowedWeaponHashes.indexOf(h) === -1) {
+ mp.gui.chat.push("unallowed weapon: " + h);
return true
}
return false
diff --git a/ReallifeGamemode.Client/assets/html/inventory/img/inventory/104.svg b/ReallifeGamemode.Client/assets/html/inventory/img/inventory/104.svg
new file mode 100644
index 00000000..52ebf76b
--- /dev/null
+++ b/ReallifeGamemode.Client/assets/html/inventory/img/inventory/104.svg
@@ -0,0 +1,96 @@
+
+
+
diff --git a/ReallifeGamemode.Server/Bank/bank.cs b/ReallifeGamemode.Server/Bank/bank.cs
index 47d9aca4..1781103e 100644
--- a/ReallifeGamemode.Server/Bank/bank.cs
+++ b/ReallifeGamemode.Server/Bank/bank.cs
@@ -5,6 +5,7 @@
*/
using GTANetworkAPI;
using Newtonsoft.Json;
+using ReallifeGamemode.Database.Entities;
using ReallifeGamemode.Database.Models;
using ReallifeGamemode.Server.Extensions;
using ReallifeGamemode.Server.Finance;
@@ -60,11 +61,14 @@ namespace ReallifeGamemode.Server.Bank
{
if (client.IsInVehicle || !client.IsLoggedIn() || client.GetUser().FactionId is null) return;
- if (client.GetUser().FactionLeader == true)
+ User user = client.GetUser();
+
+ if (user.FactionLeader == true)
{
- client.TriggerEvent("showFactionBankMenuLeader", client.GetUser().Faction.BankAccount.Balance.ToString());
+ client.TriggerEvent("showFactionBankMenuLeader", user.Faction.BankAccount.Balance.ToString());
+ return;
}
- client.TriggerEvent("showFactionBankMenu", client.GetUser().Faction.BankAccount.Balance.ToString());
+ client.TriggerEvent("showFactionBankMenu", user.Faction.BankAccount.Balance.ToString());
}
private static void EntityExitFactionBankColShape(ColShape colShape, Player client)
diff --git a/ReallifeGamemode.Server/Commands/AdminCommands.cs b/ReallifeGamemode.Server/Commands/AdminCommands.cs
index 17eb64a8..fb46010a 100644
--- a/ReallifeGamemode.Server/Commands/AdminCommands.cs
+++ b/ReallifeGamemode.Server/Commands/AdminCommands.cs
@@ -232,7 +232,7 @@ namespace ReallifeGamemode.Server.Commands
#region Support
- [Command("tog", "~m~Benutzung: ~s~/tog [Typ = ~g~IP~s~, ~g~deathlogs~s~, ~g~LC~s~]", GreedyArg = true)]
+ [Command("tog", "~m~Benutzung: ~s~/tog [Typ = ~g~IP~s~, ~g~deathlogs~s~, ~g~LC~s~, ~g~Connect~s~]", GreedyArg = true)]
public void CmdTog(Player player, string typ, string option1 = null, string option2 = null)
{
if (!player.GetUser()?.IsAdmin(AdminLevel.SUPPORTER) ?? true)
@@ -281,6 +281,18 @@ namespace ReallifeGamemode.Server.Commands
player.SendNotification("~g~[Info]~w~ Leaderchat wird nun angezeigt.");
}
break;
+ case "connect":
+ if (player.HasData("togconnect"))
+ {
+ player.ResetData("togconnect");
+ player.SendNotification("~g~[Info]~w~ Connect-Logs werden nun ausgeblendet.");
+ }
+ else
+ {
+ player.SetData("togconnect", true);
+ player.SendNotification("~g~[Info]~w~ Connect-Logs werden nun angezeigt.");
+ }
+ break;
}
}
@@ -479,7 +491,7 @@ namespace ReallifeGamemode.Server.Commands
target.Kick();
}, 2500);
- ChatService.BroadcastAdmin("~y~SKICK: ~w~" + targetname + " wurde von " + player.GetUser().AdminLevel.GetName() + " " + adminPlayername + " gekickt: " + reason, AdminLevel.SUPPORTER);
+ ChatService.BroadcastAdmin("~y~SKICK: ~w~" + target.Name + " wurde von " + player.GetUser().AdminLevel.GetName() + " " + adminPlayername + " gekickt: " + reason, AdminLevel.SUPPORTER);
}
[Command("clearchat", "~m~Benutzung: ~s~/clearchat")]
@@ -799,7 +811,7 @@ namespace ReallifeGamemode.Server.Commands
target.Kick();
}, 2500);
- ChatService.Broadcast("~y~INFO: ~w~" + targetname + " wurde von " + player.GetUser().AdminLevel.GetName() + " " + adminPlayername + " gekickt: " + reason);
+ ChatService.Broadcast("~y~INFO: ~w~" + target.Name + " wurde von " + player.GetUser().AdminLevel.GetName() + " " + adminPlayername + " gekickt: " + reason);
}
[Command("warn", "~m~Benutzung: ~s~/warn [Player] [Grund]", GreedyArg = true)]
diff --git a/ReallifeGamemode.Server/Events/Connect.cs b/ReallifeGamemode.Server/Events/Connect.cs
index 083b1542..7852a425 100644
--- a/ReallifeGamemode.Server/Events/Connect.cs
+++ b/ReallifeGamemode.Server/Events/Connect.cs
@@ -80,11 +80,16 @@ namespace ReallifeGamemode.Server.Events
bool disableLightMode = currentTime > LightModeTimeFrom && currentTime < LightModeTimeTo;
player.TriggerEvent("SERVER:Login_ShowBrowser", registered, disableLightMode);
- string msg = "~m~*** " + player.Name + " [" + player.SocialClubName + "] [ID: " + player.Handle.Value + "] (" + player.Address + ")";
- if (player.HasData("togip"))
- {
- ChatService.SendMessage(player, msg);
- }
+ string msg = "~m~*** " + player.Name + " [" + player.SocialClubName + "] [ID: " + player.Handle.Value + "]";
+ string ipMsg = " (" + player.Address + ")";
+ ChatService.BroadcastAdmin(msg, AdminLevel.SUPPORTER, getAddInfoMessage: admin =>
+ {
+ return admin.HasData("togip") ? ipMsg : string.Empty;
+ },
+ shouldSendMessage: admin =>
+ {
+ return admin.HasData("togconnect");
+ });
}
private bool IsPlayerBanned(Player player)
diff --git a/ReallifeGamemode.Server/Extensions/IntegerExtension.cs b/ReallifeGamemode.Server/Extensions/IntegerExtension.cs
index 6a62a509..743f06ad 100644
--- a/ReallifeGamemode.Server/Extensions/IntegerExtension.cs
+++ b/ReallifeGamemode.Server/Extensions/IntegerExtension.cs
@@ -11,5 +11,10 @@
{
return "$" + string.Format(Main.SERVER_CULTURE, "{0:C0}", money).Replace("€", "").Trim();
}
+
+ public static string ToMoneyString(this double money)
+ {
+ return ((int)money).ToMoneyString();
+ }
}
}
diff --git a/ReallifeGamemode.Server/Finance/Economy.cs b/ReallifeGamemode.Server/Finance/Economy.cs
index f8d0672f..78284419 100644
--- a/ReallifeGamemode.Server/Finance/Economy.cs
+++ b/ReallifeGamemode.Server/Finance/Economy.cs
@@ -187,21 +187,23 @@ namespace ReallifeGamemode.Server.Finance
public static void Timer_Elapsed()
{
using var dbContext = new DatabaseContext();
- foreach (var player in NAPI.Pools.GetAllPlayers())
+ foreach (var player in NAPI.Pools.GetAllPlayers().Where(p => p.IsLoggedIn()))
{
User user = player.GetUser(dbContext);
- if (player.IsLoggedIn())
+ if(user == null)
{
- user.PlayedMinutes += 1;
- if (user.PaydayTimer <= 0)
- {
- Economy.SetPaycheck(player);
- user.PaydayTimer = 60;
- }
- else if (user.PaydayTimer > 0)
- {
- user.PaydayTimer -= 1;
- }
+ continue;
+ }
+
+ user.PlayedMinutes += 1;
+ if (user.PaydayTimer <= 0)
+ {
+ Economy.SetPaycheck(player);
+ user.PaydayTimer = 60;
+ }
+ else if (user.PaydayTimer > 0)
+ {
+ user.PaydayTimer -= 1;
}
}
dbContext.SaveChanges();
diff --git a/ReallifeGamemode.Server/Inventory/Items/AviateChips.cs b/ReallifeGamemode.Server/Inventory/Items/AviateChips.cs
new file mode 100644
index 00000000..e663d6cb
--- /dev/null
+++ b/ReallifeGamemode.Server/Inventory/Items/AviateChips.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ReallifeGamemode.Server.Inventory.Items
+{
+ class AChips : FoodItem
+ {
+ public override int Id => 104;
+ public override string Name => "Aviates Chips";
+ public override string Description => "aviate liebt sie.";
+ public override int Gewicht => 10;
+ public override string Einheit => "g";
+ public override int HpAmount => 10;
+ public override uint Object => 2240524752;
+ public override int Price => 20;
+ }
+}
diff --git a/ReallifeGamemode.Server/Job/BusDriverJob.cs b/ReallifeGamemode.Server/Job/BusDriverJob.cs
index 1008dde3..e8eee500 100644
--- a/ReallifeGamemode.Server/Job/BusDriverJob.cs
+++ b/ReallifeGamemode.Server/Job/BusDriverJob.cs
@@ -421,9 +421,12 @@ namespace ReallifeGamemode.Server.Job
_CHANGING_VEHICLE.Add(player);
if (playerVehiclePair.ContainsKey(player))
{
+ Vehicle previousVehicle = null;
if (playerVehiclePair[player] != null)
- playerVehiclePair[player].Delete();
+ previousVehicle = playerVehiclePair[player];
playerVehiclePair.Remove(player);
+
+ previousVehicle?.Delete();
}
playerVehiclePair.Add(player, vehicle);
@@ -556,7 +559,7 @@ namespace ReallifeGamemode.Server.Job
public override void StartJobEndTimer(Player player)
{
- if (!playerVehiclePair.ContainsKey(player) || _CHANGING_VEHICLE.Contains(player))
+ if (!playerVehiclePair.ContainsKey(player) && _CHANGING_VEHICLE.Contains(player))
{
_CHANGING_VEHICLE.Remove(player);
return;
diff --git a/ReallifeGamemode.Server/Job/PilotJob.cs b/ReallifeGamemode.Server/Job/PilotJob.cs
index b40c6e8f..32b8d941 100644
--- a/ReallifeGamemode.Server/Job/PilotJob.cs
+++ b/ReallifeGamemode.Server/Job/PilotJob.cs
@@ -233,13 +233,15 @@ namespace ReallifeGamemode.Server.Job
_CHANGING_VEHICLE.Add(player);
if (playerVehiclePair.ContainsKey(player))
{
+ Vehicle previousVehicle = null;
if (playerVehiclePair[player] != null)
- playerVehiclePair[player].Delete();
+ previousVehicle = playerVehiclePair[player];
playerVehiclePair.Remove(player);
+
+ previousVehicle?.Delete();
}
playerVehiclePair.Add(player, vehicle);
player.SetIntoVehicle(vehicle.Handle, 0);
- _CHANGING_VEHICLE.Remove(player);
CheckPointHandle.StartCheckPointRoute(player, selectedRoute, 0, CHECKPOINT_MARKER_ID, 40, 10, true, "PILOT:InCheckpoint"); //6, 23, 25, 26, 27, 28
}
@@ -286,7 +288,11 @@ namespace ReallifeGamemode.Server.Job
public override void StartJobEndTimer(Player player)
{
if (!playerVehiclePair.ContainsKey(player) && _CHANGING_VEHICLE.Contains(player))
+ {
+ _CHANGING_VEHICLE.Remove(player);
return;
+ }
+
if (JobManager.playerTimersJobVehicleRespawn.ContainsKey(player))
{
diff --git a/ReallifeGamemode.Server/Main.cs b/ReallifeGamemode.Server/Main.cs
index 6e5e1f23..ec1afb62 100644
--- a/ReallifeGamemode.Server/Main.cs
+++ b/ReallifeGamemode.Server/Main.cs
@@ -172,8 +172,18 @@ namespace ReallifeGamemode.Server
using (var dbContext = new DatabaseContext())
{
var user = dbContext.Users.Where(u => u.BankAccountId == account.Id).Select(u => u.Name).FirstOrDefault();
- if (user == null) return;
- PlayerService.GetPlayerByNameOrId(user).TriggerEvent("updateMoney", account.Balance);
+ if (user == null)
+ {
+ return;
+ }
+
+ Player player = PlayerService.GetPlayerByNameOrId(user);
+ if(player == null)
+ {
+ return;
+ }
+
+ player.TriggerEvent("updateMoney", account.Balance);
}
};
diff --git a/ReallifeGamemode.Server/Managers/BusinessManager.cs b/ReallifeGamemode.Server/Managers/BusinessManager.cs
index 875d3c9a..77ad2d06 100644
--- a/ReallifeGamemode.Server/Managers/BusinessManager.cs
+++ b/ReallifeGamemode.Server/Managers/BusinessManager.cs
@@ -19,6 +19,8 @@ namespace ReallifeGamemode.Server.Managers
{
public static List Businesses { get; private set; }
+ private const double FACTION_CAR_MULTIPLIER = 1.5;
+
public static void LoadBusinesses()
{
Businesses = new List();
@@ -199,10 +201,10 @@ namespace ReallifeGamemode.Server.Managers
else if (target == "Fraktion")
{
var faction = dbContext.Factions.Include(f => f.BankAccount).Where(f => f.Id == u.FactionId).First();
- TransactionResult result = BankManager.TransferMoney(faction, business, price * 3, "Auto gekauft", dbContext);
+ TransactionResult result = BankManager.TransferMoney(faction, business, (int)(price * FACTION_CAR_MULTIPLIER), "Auto gekauft", dbContext);
if (result == TransactionResult.SENDER_NOT_ENOUGH_MONEY)
{
- player.SendNotification("~r~Die Fraktion hat nicht genug Geld: " + (price * 3).ToMoneyString());
+ player.SendNotification("~r~Die Fraktion hat nicht genug Geld: " + (price * FACTION_CAR_MULTIPLIER).ToMoneyString());
return;
}
player.SendChatMessage("~y~Deine Fraktion hat das Fahrzeug erfolgreich gekauft");
diff --git a/ReallifeGamemode.Server/Services/ChatService.cs b/ReallifeGamemode.Server/Services/ChatService.cs
index e1b62f63..c4584315 100644
--- a/ReallifeGamemode.Server/Services/ChatService.cs
+++ b/ReallifeGamemode.Server/Services/ChatService.cs
@@ -108,12 +108,14 @@ namespace ReallifeGamemode.Server.Services
}
}
+ string toSend = message;
+
if(getAddInfoMessage != null)
{
- message += getAddInfoMessage(p);
+ toSend += getAddInfoMessage(p);
}
- ChatService.SendMessage(p, message);
+ ChatService.SendMessage(p, toSend);
}
});
}
diff --git a/ReallifeGamemode.Server/Wanted/WantedEscapeTimer.cs b/ReallifeGamemode.Server/Wanted/WantedEscapeTimer.cs
index f92f11ca..16786f60 100644
--- a/ReallifeGamemode.Server/Wanted/WantedEscapeTimer.cs
+++ b/ReallifeGamemode.Server/Wanted/WantedEscapeTimer.cs
@@ -15,6 +15,8 @@ namespace ReallifeGamemode.Server.Wanted
{
public class WantedEscapeTimer
{
+ private const int WantedEscapeTime = 300000;
+
public static Dictionary waTimer { get; set; } = new Dictionary(); //zeit in ms
/*
public static void WantedTimer()
@@ -31,7 +33,7 @@ namespace ReallifeGamemode.Server.Wanted
if (user.FactionId == 1 || user.FactionId == 3)
return;
- waTimer[user.Id] = 300000;
+ waTimer[user.Id] = WantedEscapeTime;
}
public static void Timer_Elapsed()
@@ -77,9 +79,9 @@ namespace ReallifeGamemode.Server.Wanted
user.SetBlipAndNametagColor();
}
dbContext.SaveChanges();
+ waTimer[user.Id] = WantedEscapeTime;
}
-
- if (!isNearCop)
+ else if (!isNearCop)
waTimer[user.Id] -= 2500;
}
}