try some fixes & add massage for sanicall

This commit is contained in:
Michael
2020-10-13 13:00:59 +02:00
parent b0fa23d0f8
commit 9f82d06e5d
2 changed files with 19 additions and 1 deletions

View File

@@ -3,6 +3,7 @@ using GTANetworkAPI;
using Newtonsoft.Json; using Newtonsoft.Json;
using ReallifeGamemode.Server.Services; using ReallifeGamemode.Server.Services;
using System.Linq; using System.Linq;
using ReallifeGamemode.Services;
/** /**
* @overview Life of German Reallife - Server Factions Medic Medic.cs * @overview Life of German Reallife - Server Factions Medic Medic.cs
@@ -86,16 +87,21 @@ namespace ReallifeGamemode.Server.Factions.Medic
[RemoteEvent("updateMedicTask")] [RemoteEvent("updateMedicTask")]
public void UpdateMedicTasks(Player player, int type, int index, string medicName) public void UpdateMedicTasks(Player player, int type, int index, string medicName)
{ {
Player target = PlayerService.GetPlayerByNameOrId(medicName);
switch (type) switch (type)
{ {
case 0: case 0:
ReviveTasks[index].MedicName = medicName; ReviveTasks[index].MedicName = medicName;
ChatService.BroadcastFaction("~y~[MEDIC] ~w~" + player.Name + " hat den Reviveauftrag von " + medicName + " angenommen.", new List<int>() { 2 }); ChatService.BroadcastFaction("~y~[MEDIC] ~w~" + player.Name + " hat den Reviveauftrag von " + medicName + " angenommen.", new List<int>() { 2 });
target.SendNotification("~w~Sanitäter~g~ " + player.Name + "~w~ hat dein Auftrag angenommen.");
break; break;
case 1: case 1:
HealTasks[index].MedicName = medicName; HealTasks[index].MedicName = medicName;
ChatService.BroadcastFaction("~y~[MEDIC] ~w~" + player.Name + " hat den Healauftrag von " + medicName + " angenommen.", new List<int>() { 2 }); ChatService.BroadcastFaction("~y~[MEDIC] ~w~" + player.Name + " hat den Healauftrag von " + medicName + " angenommen.", new List<int>() { 2 });
target.SendNotification("~w~Sanitäter~g~ " + player.Name + "~w~ hat dein Auftrag angenommen.");
break; break;
case 2: case 2:

View File

@@ -9,6 +9,7 @@ using ReallifeGamemode.Server.Extensions;
using ReallifeGamemode.Server.Services; using ReallifeGamemode.Server.Services;
using ReallifeGamemode.Server.Types; using ReallifeGamemode.Server.Types;
using ReallifeGamemode.Server.Util; using ReallifeGamemode.Server.Util;
using ReallifeGamemode.Services;
namespace ReallifeGamemode.Server.Job namespace ReallifeGamemode.Server.Job
{ {
@@ -89,10 +90,21 @@ namespace ReallifeGamemode.Server.Job
User target = dbContext.Users.Where(u => u.Id == targetId).FirstOrDefault(); User target = dbContext.Users.Where(u => u.Id == targetId).FirstOrDefault();
player.SendNotification("~r~[Info] ~w~ Dein Kunde hat kein Geld mehr auf der Hand."); player.SendNotification("~r~[Info] ~w~ Dein Kunde hat kein Geld mehr auf der Hand.");
if(target.Handmoney <= 0)
{
Player targetmoney = PlayerService.GetPlayerByNameOrId(Convert.ToString(targetId));
targetmoney.SendNotification("~r~[Fehler] ~w~ Du hast kein Geld mehr auf der Hand.");
player.SendNotification("~r~[Fehler] ~w~ Dein Fahrgast kann dich nicht mehr bezahlen.");
player.TriggerEvent("CLIENT:cancelFare");
targetmoney.TriggerEvent("CLIENT:cancelFareCustomer");
targetmoney.WarpOutOfVehicle();
}
else
{
target.Handmoney -= amount; target.Handmoney -= amount;
player.GetUser(dbContext).Wage += amount; player.GetUser(dbContext).Wage += amount;
dbContext.SaveChanges(); dbContext.SaveChanges();
}
//target.Player.TriggerEvent("SERVER:SET_HANDMONEY", target.Handmoney); //target.Player.TriggerEvent("SERVER:SET_HANDMONEY", target.Handmoney);
} }
} }