diff --git a/ReallifeGamemode.Client/Gui/wanteds.ts b/ReallifeGamemode.Client/Gui/wanteds.ts
new file mode 100644
index 00000000..71c7cf4d
--- /dev/null
+++ b/ReallifeGamemode.Client/Gui/wanteds.ts
@@ -0,0 +1,7 @@
+export default function wanteds(globalData: GlobalData) {
+ var browser = mp.browsers.new("package://assets/html/wanteds/index.html");
+
+ mp.events.add("SERVER:SetWanteds", (count: number) => {
+ browser.execute(`setWanteds(${count});`);
+ });
+}
\ No newline at end of file
diff --git a/ReallifeGamemode.Client/Tuning/main.ts b/ReallifeGamemode.Client/Tuning/main.ts
index bf10fe17..c2bb5c20 100644
--- a/ReallifeGamemode.Client/Tuning/main.ts
+++ b/ReallifeGamemode.Client/Tuning/main.ts
@@ -154,7 +154,7 @@ export default function tuning(globalData: GlobalData) {
var localPlayer = mp.players.local;
var localVehicle = localPlayer.vehicle;
- localVehicle.setHalt(1.0, true, false);
+ localVehicle.setHalt(1.0, 1, false);
globalData.InMenu = true;
globalData.InTuning = true;
diff --git a/ReallifeGamemode.Client/assets/html/wanteds/index.html b/ReallifeGamemode.Client/assets/html/wanteds/index.html
new file mode 100644
index 00000000..2ed9f6f4
--- /dev/null
+++ b/ReallifeGamemode.Client/assets/html/wanteds/index.html
@@ -0,0 +1,57 @@
+
+
+
+
+
+ Wanteds
+
+
+
+
+

+
10
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ReallifeGamemode.Client/assets/img/wanteds/star.svg b/ReallifeGamemode.Client/assets/img/wanteds/star.svg
new file mode 100644
index 00000000..2179dbeb
--- /dev/null
+++ b/ReallifeGamemode.Client/assets/img/wanteds/star.svg
@@ -0,0 +1,4 @@
+
+
\ No newline at end of file
diff --git a/ReallifeGamemode.Client/index.ts b/ReallifeGamemode.Client/index.ts
index 937805b8..efe9fc8e 100644
--- a/ReallifeGamemode.Client/index.ts
+++ b/ReallifeGamemode.Client/index.ts
@@ -25,6 +25,9 @@ var inMenu = false;
mp.game.vehicle.defaultEngineBehaviour = false;
+import wanteds from './Gui/wanteds';
+wanteds(globalData);
+
import playerBlips from './Gui/blips';
playerBlips();
diff --git a/ReallifeGamemode.Client/package-lock.json b/ReallifeGamemode.Client/package-lock.json
index a38b6225..effbbe6f 100644
--- a/ReallifeGamemode.Client/package-lock.json
+++ b/ReallifeGamemode.Client/package-lock.json
@@ -194,8 +194,8 @@
"dev": true
},
"@types/ragemp-c": {
- "version": "git+https://github.com/sprayzcs/types-ragemp-c.git#5bad2bb24e8cd1f286d8ee26b30272891423d9f9",
- "from": "git+https://github.com/sprayzcs/types-ragemp-c.git#master",
+ "version": "github:CocaColaBear/types-ragemp-c#6a118e6399b77a347ac67e07f6b15f842109b0ff",
+ "from": "github:CocaColaBear/types-ragemp-c#master",
"dev": true
},
"@webassemblyjs/ast": {
diff --git a/ReallifeGamemode.Client/package.json b/ReallifeGamemode.Client/package.json
index 924d145d..1386af56 100644
--- a/ReallifeGamemode.Client/package.json
+++ b/ReallifeGamemode.Client/package.json
@@ -4,7 +4,7 @@
"devDependencies": {
"@babel/core": "^7.3.4",
"@types/node": "^11.9.5",
- "@types/ragemp-c": "git+https://github.com/sprayzcs/types-ragemp-c.git#master",
+ "@types/ragemp-c": "github:CocaColaBear/types-ragemp-c#master",
"NativeUI": "https://github.com/sprayzcs/RageMP-NativeUI/tarball/master",
"babel-loader": "^8.0.5",
"copy-webpack-plugin": "^5.0.1",
diff --git a/ReallifeGamemode.Server/Commands/FactionCommands.cs b/ReallifeGamemode.Server/Commands/FactionCommands.cs
index 2d5e98b1..d347e821 100644
--- a/ReallifeGamemode.Server/Commands/FactionCommands.cs
+++ b/ReallifeGamemode.Server/Commands/FactionCommands.cs
@@ -195,6 +195,12 @@ namespace ReallifeGamemode.Server.Commands
return;
}
+ if(amount <= 0)
+ {
+ ChatService.ErrorMessage(player, "Es muss eine positive Wantedanzahl vergeben werden");
+ return;
+ }
+
Client target = ClientService.GetClientByNameOrId(nameOrId);
if (target == null || !target.IsLoggedIn())
{
@@ -205,6 +211,38 @@ namespace ReallifeGamemode.Server.Commands
User targetUser = target.GetUser();
targetUser.GiveWanteds(player, amount, reason);
}
+
+ [Command("clear", "~m~Benutzung: ~s~/clear [Name / ID] [Grund]")]
+ public void CmdFactionClear(Client player, string nameOrId, string reason)
+ {
+
+ User user = player.GetUser();
+ if (user == null || (user.FactionId != 1 && user.FactionId != 2))
+ {
+ ChatService.NotAuthorized(player);
+ return;
+ }
+
+ Client target = ClientService.GetClientByNameOrId(nameOrId);
+ if (target == null || !target.IsLoggedIn())
+ {
+ ChatService.PlayerNotFound(player);
+ return;
+ }
+
+ using (var dbContext = new DatabaseContext())
+ {
+ User targetUser = target.GetUser(dbContext);
+ if(targetUser.Wanteds == 0)
+ {
+ ChatService.ErrorMessage(player, "Der Spieler hat keine Wanteds");
+ return;
+ }
+
+ targetUser.Wanteds = 0;
+ dbContext.SaveChanges();
+ }
+ }
#endregion
#region Global Fraktions Commands
#endregion
diff --git a/ReallifeGamemode.Server/Entities/User.cs b/ReallifeGamemode.Server/Entities/User.cs
index d2774f55..461a7739 100644
--- a/ReallifeGamemode.Server/Entities/User.cs
+++ b/ReallifeGamemode.Server/Entities/User.cs
@@ -19,6 +19,9 @@ namespace ReallifeGamemode.Server.Entities
{
public class User : IBankAccountOwner
{
+ [NotMapped]
+ private int _wanteds;
+
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
@@ -66,7 +69,15 @@ namespace ReallifeGamemode.Server.Entities
public int? JobId { get; set; }
- public int Wanteds { get; set; }
+ public int Wanteds
+ {
+ get => _wanteds;
+ set
+ {
+ this._wanteds = value;
+ Client.TriggerEvent("SERVER:SetWanteds", value);
+ }
+ }
public FactionRank GetFactionRank()
{
@@ -182,10 +193,16 @@ namespace ReallifeGamemode.Server.Entities
internal void GiveWanteds(Client cop, int amount, string reason)
{
- if(this.Wanteds + amount > 40)
+ if (this.Wanteds + amount > 40)
+ {
+ ChatService.ErrorMessage(cop, "Die Wanteds dürfen ein Limit von 40 nicht überschreiten");
+ return;
+ }
using (var dbContext = new DatabaseContext())
{
-
+ User user = dbContext.Users.Where(u => u.Id == this.Id).FirstOrDefault();
+ user.Wanteds += amount;
+ dbContext.SaveChanges();
}
}
}
diff --git a/ReallifeGamemode.Server/Events/Login.cs b/ReallifeGamemode.Server/Events/Login.cs
index d3720e0c..8e1c4472 100644
--- a/ReallifeGamemode.Server/Events/Login.cs
+++ b/ReallifeGamemode.Server/Events/Login.cs
@@ -59,6 +59,8 @@ namespace ReallifeGamemode.Server.Events
var userBankAccount = user.GetBankAccount();
userBankAccount.Balance = userBankAccount.Balance;
+ user.Wanteds = user.Wanteds;
+
if(user.Group != null)
{
string msg = $"{player.Name} ist wieder online.";