diff --git a/ReallifeGamemode.Server/Managers/InteractionManager.cs b/ReallifeGamemode.Server/Managers/InteractionManager.cs index 926dd56f..ce438abe 100644 --- a/ReallifeGamemode.Server/Managers/InteractionManager.cs +++ b/ReallifeGamemode.Server/Managers/InteractionManager.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using GTANetworkAPI; using Newtonsoft.Json; @@ -753,7 +753,16 @@ namespace ReallifeGamemode.Server.Managers public void InteractionMenu_Pay(Player player, string jsonNameOrId, string stringAmount) { string nameOrId = (string)JsonConvert.DeserializeObject(jsonNameOrId); - int amount = Int32.Parse(stringAmount); + int amount; + try + { + amount = Int32.Parse(stringAmount); + } + catch + { + player.SendNotification("~r~" + stringAmount + " ist kein gültiger Betrag."); + return; + } Player target = PlayerService.GetPlayerByNameOrId(nameOrId); List nearbyPlayers = NAPI.Player.GetPlayersInRadiusOfPlayer(3, player); @@ -769,7 +778,7 @@ namespace ReallifeGamemode.Server.Managers } else if (!nearbyPlayers.Contains(target)) { - player.SendNotification("~r~Dieser Spieler befindet sich nicht in deiner nähe!"); + player.SendNotification("~r~Dieser Spieler befindet sich nicht in deiner Nähe!"); } else if (player.GetUser().Handmoney < amount) {