From 13142edbb709c0c72c64edbe2369390480362379 Mon Sep 17 00:00:00 2001 From: VegaZ Date: Wed, 6 Mar 2019 20:03:02 +0100 Subject: [PATCH] Made some last changes to faction interaction --- .../Interaction/factioninteraction.js | 34 +++++++++++-------- ReallifeGamemode.Client/Player/keys.js | 20 +++++------ ReallifeGamemode.Server/Commands/Faction.cs | 10 ++++++ ReallifeGamemode.Server/Events/Key.cs | 2 +- 4 files changed, 40 insertions(+), 26 deletions(-) diff --git a/ReallifeGamemode.Client/Interaction/factioninteraction.js b/ReallifeGamemode.Client/Interaction/factioninteraction.js index 48666ed0..23ef0ccf 100644 --- a/ReallifeGamemode.Client/Interaction/factioninteraction.js +++ b/ReallifeGamemode.Client/Interaction/factioninteraction.js @@ -31,7 +31,7 @@ mp.events.add("updateFactionBlips", (type, taskList) => { }); -mp.events.add("showFactionInteraction", (userFactionId, userFactionName, isFactionLeader, reviveTaskCount, healTaskCount, fireTaskCount) => { +mp.events.add("showFactionInteraction", (userFactionId, isDuty, userFactionName, isFactionLeader, reviveTaskCount, healTaskCount, fireTaskCount) => { mp.gui.chat.activate(false); globalData.Interaction = true; @@ -49,21 +49,24 @@ mp.events.add("showFactionInteraction", (userFactionId, userFactionName, isFacti let reviveTaskMenu; let healTaskMenu; let fireTaskMenu; + if (isDuty) + { + switch (userFactionId) + { + case 2: + reviveTaskMenu = new UIMenuItem("Reviveauftr\u00e4ge"); + reviveTaskMenu.SetRightLabel(rP + reviveTaskCount) + factionInteractionMenu.AddItem(reviveTaskMenu); - switch (userFactionId) { - case 2: - reviveTaskMenu = new UIMenuItem("Reviveauftr\u00e4ge"); - reviveTaskMenu.SetRightLabel(rP + reviveTaskCount) - factionInteractionMenu.AddItem(reviveTaskMenu); + healTaskMenu = new UIMenuItem("Healauftr\u00e4ge"); + healTaskMenu.SetRightLabel(hP + healTaskCount) + factionInteractionMenu.AddItem(healTaskMenu); - healTaskMenu = new UIMenuItem("Healauftr\u00e4ge"); - healTaskMenu.SetRightLabel(hP + healTaskCount) - factionInteractionMenu.AddItem(healTaskMenu); - - fireTaskMenu = new UIMenuItem("Feuerauftr\u00e4ge"); - fireTaskMenu.SetRightLabel(fP + fireTaskCount) - factionInteractionMenu.AddItem(fireTaskMenu); - break; + fireTaskMenu = new UIMenuItem("Feuerauftr\u00e4ge"); + fireTaskMenu.SetRightLabel(fP + fireTaskCount) + factionInteractionMenu.AddItem(fireTaskMenu); + break; + } } let cancelItem = new UIMenuItem("Schlie\u00dfen", "Schlie\u00dft die Fraktionsinteraktion"); @@ -240,7 +243,8 @@ mp.events.add('render', () => { scale: [0.35, 0.35], outline: true, centre: true - }); + }); + if (taskRange < rangeLeft) ambulanceImagePos = 0.3; mp.game.graphics.drawSprite("medicimages", "finish", 0.655, 0.898, 0.04, 0.07, 0, 255, 255, 255, 255); if (player.isInAnyVehicle(false)) { mp.game.graphics.drawSprite("medicimages", "ambulance", ambulanceImagePos + 0.01, 0.915, 0.04, 0.07, 0, 255, 255, 255, 255); diff --git a/ReallifeGamemode.Client/Player/keys.js b/ReallifeGamemode.Client/Player/keys.js index fea2b42f..c11e34f6 100644 --- a/ReallifeGamemode.Client/Player/keys.js +++ b/ReallifeGamemode.Client/Player/keys.js @@ -34,11 +34,11 @@ mp.keys.bind(0x26, false, function () { }); //RIGHT ARROW (Interaktion mit anderen Spielern) -//mp.keys.bind(0x27, false, function () { -// if (!globalData.InChat && !showInv && !globalData.Interaction) { -// mp.events.callRemote("keyPress:RIGHT_ARROW"); -// } -//}); +mp.keys.bind(0x27, false, function () { + if (!globalData.InChat && !showInv && !globalData.Interaction) { + mp.events.callRemote("keyPress:RIGHT_ARROW"); + } +}); //DOWN ARROW (Interaktion mit anderen Spielern) mp.keys.bind(0x28, false, function () { @@ -65,11 +65,11 @@ mp.keys.bind(0x62, false, function () { }); //NUM5 //Fraktionsinteraktion (Tasks sortieren) -mp.keys.bind(0x65, false, function () { - if (!globalData.InChat && globalData.Interaction) { - mp.events.call("sortFactionTasks", true); - } -}); +//mp.keys.bind(0x65, false, function () { +// if (!globalData.InChat && globalData.Interaction) { +// mp.events.call("sortFactionTasks", true); +// } +//}); //E mp.keys.bind(0x45, false, function () { diff --git a/ReallifeGamemode.Server/Commands/Faction.cs b/ReallifeGamemode.Server/Commands/Faction.cs index b598f777..9b1434f2 100644 --- a/ReallifeGamemode.Server/Commands/Faction.cs +++ b/ReallifeGamemode.Server/Commands/Faction.cs @@ -267,6 +267,16 @@ namespace reallife_gamemode.Server.Commands [Command("duty", "~m~Benutzung: ~s~/duty")] public void CmdFactionDuty(Client player) { + if(player.GetData("duty") == false) + { + player.SetData("duty", true); + player.SendNotification("~g~Du bist jetzt im Dienst!", false); + } + else + { + player.SetData("duty", false); + player.SendNotification("~r~Schönen Feierabend!", false); + } } #endregion } diff --git a/ReallifeGamemode.Server/Events/Key.cs b/ReallifeGamemode.Server/Events/Key.cs index e464c61c..ea7d5fb3 100644 --- a/ReallifeGamemode.Server/Events/Key.cs +++ b/ReallifeGamemode.Server/Events/Key.cs @@ -66,7 +66,7 @@ namespace reallife_gamemode.Server.Events { //LSFD case 2: - player.TriggerEvent("showFactionInteraction", user.FactionId, user.GetFaction().Name, user.FactionLeader, Medic.ReviveTasks.Count.ToString(), Medic.HealTasks.Count.ToString(), Medic.FireTasks.Count.ToString()); + player.TriggerEvent("showFactionInteraction", user.FactionId, player.GetData("duty"), user.GetFaction().Name, user.FactionLeader, Medic.ReviveTasks.Count.ToString(), Medic.HealTasks.Count.ToString(), Medic.FireTasks.Count.ToString()); break; } }