diff --git a/ReallifeGamemode.Client/core/rage-mp/entities.ts b/ReallifeGamemode.Client/core/rage-mp/entities.ts index 3a701f6d..49a411cf 100644 --- a/ReallifeGamemode.Client/core/rage-mp/entities.ts +++ b/ReallifeGamemode.Client/core/rage-mp/entities.ts @@ -114,6 +114,7 @@ class RageEntityAttachmentPool implements IEntityAttachmentPool { } set(entity: IEntity, attachments: any[], attachmentObjects: any[]): IEntityAttachments { + if (!this.attachmentPool) { let e = new RageAttachments(entity, attachments, attachmentObjects); this.attachmentPool = []; @@ -125,10 +126,10 @@ class RageEntityAttachmentPool implements IEntityAttachmentPool { for (let obj of this.attachmentPool.keys()) { if (entity.remoteId == this.attachmentPool[obj].remoteId) { this.remove(entity); } } + let e = new RageAttachments(entity, attachments, attachmentObjects); this.attachmentPool.push(e); - - return e; + return e; } at(remoteId: any): IEntityAttachments { diff --git a/ReallifeGamemode.Server/Commands/UserCommands.cs b/ReallifeGamemode.Server/Commands/UserCommands.cs index a9ff1cb8..3fcb687c 100644 --- a/ReallifeGamemode.Server/Commands/UserCommands.cs +++ b/ReallifeGamemode.Server/Commands/UserCommands.cs @@ -1,10 +1,13 @@ using System; +using System.Collections.Generic; using GTANetworkAPI; using ReallifeGamemode.Database.Entities; using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Server.Finance; +using ReallifeGamemode.Server.Managers; using ReallifeGamemode.Server.Services; using ReallifeGamemode.Server.Types; +using ReallifeGamemode.Server.Util; namespace ReallifeGamemode.Server.Commands { diff --git a/ReallifeGamemode.Server/Managers/CityHallManager.cs b/ReallifeGamemode.Server/Managers/CityHallManager.cs index 504343d2..428c90de 100644 --- a/ReallifeGamemode.Server/Managers/CityHallManager.cs +++ b/ReallifeGamemode.Server/Managers/CityHallManager.cs @@ -57,6 +57,13 @@ namespace ReallifeGamemode.Server.Managers u.Group = group; u.GroupRank = GroupRank.OWNER; + if (player.GetUser(dbContext).BankAccount.Balance < 50000) + { + ChatService.ErrorMessage(player, "Du hast nicht genug Geld"); + return; + } + + player.GetUser(dbContext).BankAccount.Balance -= 50000; dbContext.SaveChanges(); ChatService.BroadcastGroup($"Die Gruppe \"{name}\" wurde erfolgreich erstellt.", group);