Start Medic System / FactionInteraction
This commit is contained in:
@@ -26,6 +26,7 @@ mp.events.add("startDeathTimer", (isAdmin) => {
|
|||||||
else {
|
else {
|
||||||
mp.gui.chat.activate(false);
|
mp.gui.chat.activate(false);
|
||||||
}
|
}
|
||||||
|
mp.game.audio.playSoundFrontend(-1, "Bed", "WastedSounds", true);
|
||||||
deathDate = new Date();
|
deathDate = new Date();
|
||||||
respawnTime = Math.floor(deathDate.getTime() / 1000 + 120);
|
respawnTime = Math.floor(deathDate.getTime() / 1000 + 120);
|
||||||
fade = 255 - 120;
|
fade = 255 - 120;
|
||||||
|
|||||||
62
Client/Interaction/factioninteraction.js
Normal file
62
Client/Interaction/factioninteraction.js
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
let screenRes = mp.game.graphics.getScreenResolution(0, 0);
|
||||||
|
|
||||||
|
const NativeUI = require("nativeui");
|
||||||
|
const Menu = NativeUI.Menu;
|
||||||
|
const UIMenuItem = NativeUI.UIMenuItem;
|
||||||
|
const UIMenuListItem = NativeUI.UIMenuListItem;
|
||||||
|
const UIMenuCheckboxItem = NativeUI.UIMenuCheckboxItem;
|
||||||
|
const BadgeStyle = NativeUI.BadgeStyle;
|
||||||
|
const Point = NativeUI.Point;
|
||||||
|
const ItemsCollection = NativeUI.ItemsCollection;
|
||||||
|
const Color = NativeUI.Color;
|
||||||
|
|
||||||
|
mp.events.add("showFactionInteraction", (userFactionId, userFactionName, isFactionLeader, reviveTaskCount, healTaskCount, fireTaskCount) => {
|
||||||
|
|
||||||
|
mp.gui.chat.activate(false);
|
||||||
|
globalData.Interaction = true;
|
||||||
|
|
||||||
|
|
||||||
|
let factionInteractionMenu = new Menu("Fraktionsinteraktion", userFactionName, new Point(0, screenRes.y / 2));
|
||||||
|
|
||||||
|
if (isFactionLeader) {
|
||||||
|
let leaderMenu = new UIMenuItem("Leadermen\u00fc", "Verwaltung der Fraktion");
|
||||||
|
leaderMenu.SetRightBadge(BadgeStyle.Star);
|
||||||
|
factionInteractionMenu.AddItem(leaderMenu);
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (userFactionId) {
|
||||||
|
case 2:
|
||||||
|
let reviveTaskMenu = new UIMenuItem("Reviveauftr\u00e4ge");
|
||||||
|
reviveTaskMenu.SetRightLabel(reviveTaskCount.toString())
|
||||||
|
factionInteractionMenu.AddItem(reviveTaskMenu);
|
||||||
|
|
||||||
|
let healTaskMenu = new UIMenuItem("Healauftr\u00e4ge");
|
||||||
|
reviveTaskMenu.SetRightLabel(healTaskCount.toString())
|
||||||
|
factionInteractionMenu.AddItem(healTaskMenu);
|
||||||
|
|
||||||
|
let fireTaskMenu = new UIMenuItem("Reviveauftr\u00e4ge");
|
||||||
|
reviveTaskMenu.SetRightLabel(fireTaskCount.toString())
|
||||||
|
factionInteractionMenu.AddItem(fireTaskMenu);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
let cancelItem = new UIMenuItem("Schlie\u00dfen", "Schlie\u00dft die Spielerinteraktion");
|
||||||
|
cancelItem.BackColor = new Color(213, 0, 0);
|
||||||
|
cancelItem.HighlightedBackColor = new Color(229, 57, 53);
|
||||||
|
factionInteractionMenu.AddItem(cancelItem);
|
||||||
|
|
||||||
|
factionInteractionMenu.Visible = true;
|
||||||
|
|
||||||
|
factionInteractionMenu.ItemSelect.on((item) => {
|
||||||
|
if (item.Text === "Schlie\u00dfen") {
|
||||||
|
factionInteractionMenu.Visible = false;
|
||||||
|
mp.gui.chat.activate(true);
|
||||||
|
globalData.Interaction = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
factionInteractionMenu.MenuClose.on(() => {
|
||||||
|
mp.gui.chat.activate(true);
|
||||||
|
globalData.Interaction = false;
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -42,7 +42,7 @@ const Color = NativeUI.Color;
|
|||||||
mp.events.add("showPlayerInteraction", (nearPlayerArr) => {
|
mp.events.add("showPlayerInteraction", (nearPlayerArr) => {
|
||||||
mp.gui.chat.activate(false);
|
mp.gui.chat.activate(false);
|
||||||
nearbyPlayers = JSON.parse(nearPlayerArr);
|
nearbyPlayers = JSON.parse(nearPlayerArr);
|
||||||
globalData.PlayerInteraction = true;
|
globalData.Interaction = true;
|
||||||
let playerInteractionMenu = new Menu("Spielerinteraktion", "", new Point(0, screenRes.y / 2));
|
let playerInteractionMenu = new Menu("Spielerinteraktion", "", new Point(0, screenRes.y / 2));
|
||||||
let playerSelect = new UIMenuListItem("Mit", "~y~W\u00e4hle den Spieler aus.", new ItemsCollection(nearbyPlayers));
|
let playerSelect = new UIMenuListItem("Mit", "~y~W\u00e4hle den Spieler aus.", new ItemsCollection(nearbyPlayers));
|
||||||
playerInteractionMenu.AddItem(playerSelect);
|
playerInteractionMenu.AddItem(playerSelect);
|
||||||
@@ -60,17 +60,17 @@ mp.events.add("showPlayerInteraction", (nearPlayerArr) => {
|
|||||||
mp.events.callRemote("openTradeInventory", playerSelect.SelectedValue);
|
mp.events.callRemote("openTradeInventory", playerSelect.SelectedValue);
|
||||||
playerInteractionMenu.Visible = false;
|
playerInteractionMenu.Visible = false;
|
||||||
mp.gui.chat.activate(true);
|
mp.gui.chat.activate(true);
|
||||||
globalData.PlayerInteraction = false;
|
globalData.Interaction = false;
|
||||||
} else if (item.Text === "Schlie\u00dfen") {
|
} else if (item.Text === "Schlie\u00dfen") {
|
||||||
playerInteractionMenu.Visible = false;
|
playerInteractionMenu.Visible = false;
|
||||||
mp.gui.chat.activate(true);
|
mp.gui.chat.activate(true);
|
||||||
globalData.PlayerInteraction = false;
|
globalData.Interaction = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
playerInteractionMenu.MenuClose.on(() => {
|
playerInteractionMenu.MenuClose.on(() => {
|
||||||
mp.gui.chat.activate(true);
|
mp.gui.chat.activate(true);
|
||||||
globalData.PlayerInteraction = false;
|
globalData.Interaction = false;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
//https://docs.microsoft.com/de-de/windows/desktop/inputdev/virtual-key-codes
|
//https://docs.microsoft.com/de-de/windows/desktop/inputdev/virtual-key-codes
|
||||||
|
|
||||||
var chat = false;
|
|
||||||
var showInventory = false;
|
var showInventory = false;
|
||||||
var showGui = true;
|
var showGui = true;
|
||||||
var showInv = false;
|
var showInv = false;
|
||||||
@@ -22,12 +21,31 @@ mp.keys.bind(0x0D, false, function () {
|
|||||||
|
|
||||||
//LEFT ARROW (Interaktion mit anderen Spielern)
|
//LEFT ARROW (Interaktion mit anderen Spielern)
|
||||||
mp.keys.bind(0x25, false, function () {
|
mp.keys.bind(0x25, false, function () {
|
||||||
if (!globalData.InChat && !showInv && !globalData.PlayerInteraction) {
|
if (!globalData.InChat && !showInv && !globalData.Interaction) {
|
||||||
mp.events.callRemote("keyPress:LEFT_ARROW");
|
mp.events.callRemote("keyPress:LEFT_ARROW");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//UP ARROW (Interaktion mit anderen Spielern)
|
||||||
|
mp.keys.bind(0x26, false, function () {
|
||||||
|
if (!globalData.InChat && !showInv && !globalData.Interaction) {
|
||||||
|
mp.events.callRemote("keyPress:UP_ARROW");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
//RIGHT ARROW (Interaktion mit anderen Spielern)
|
||||||
|
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 () {
|
||||||
|
if (!globalData.InChat && !showInv && !globalData.Interaction) {
|
||||||
|
mp.events.callRemote("keyPress:DOWN_ARROW");
|
||||||
|
}
|
||||||
|
});
|
||||||
//F7 //Unshowalles
|
//F7 //Unshowalles
|
||||||
mp.keys.bind(0x76, false, function () {
|
mp.keys.bind(0x76, false, function () {
|
||||||
if (showGui === true) {
|
if (showGui === true) {
|
||||||
|
|||||||
@@ -2,12 +2,12 @@
|
|||||||
* @overview Life of German Reallife - Login index.js
|
* @overview Life of German Reallife - Login index.js
|
||||||
* @author VegaZ, hydrant
|
* @author VegaZ, hydrant
|
||||||
* @copyright (c) 2008 - 2018 Life of German
|
* @copyright (c) 2008 - 2018 Life of German
|
||||||
*/
|
**/
|
||||||
|
|
||||||
let globalData = {
|
let globalData = {
|
||||||
InTuning: false,
|
InTuning: false,
|
||||||
HideGui: false,
|
HideGui: false,
|
||||||
PlayerInteraction: false,
|
Interaction: false,
|
||||||
InChat: false
|
InChat: false
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -19,6 +19,7 @@ require('./Business/main.js');
|
|||||||
require('./Business/cardealer.js');
|
require('./Business/cardealer.js');
|
||||||
|
|
||||||
require('./CharCreator/index.js');
|
require('./CharCreator/index.js');
|
||||||
|
|
||||||
require('./coloredhlights');
|
require('./coloredhlights');
|
||||||
|
|
||||||
require('./DoorManager/doormanager.js');
|
require('./DoorManager/doormanager.js');
|
||||||
@@ -33,7 +34,8 @@ require('./Gui/Inventory/inventory.js');
|
|||||||
require('./Gui/vehiclemenu/main.js');
|
require('./Gui/vehiclemenu/main.js');
|
||||||
require('./Gui/interiors.js');
|
require('./Gui/interiors.js');
|
||||||
|
|
||||||
require('./Interaction/interaction.js');
|
require('./Interaction/factioninteraction.js');
|
||||||
|
require('./Interaction/playerinteraction.js');
|
||||||
|
|
||||||
require('./Login/main.js');
|
require('./Login/main.js');
|
||||||
|
|
||||||
@@ -43,6 +45,7 @@ require('./Player/quit.js');
|
|||||||
require('./Player/freecam.js');
|
require('./Player/freecam.js');
|
||||||
|
|
||||||
require('./Save/main.js');
|
require('./Save/main.js');
|
||||||
|
|
||||||
require('./Speedometer/index.js');
|
require('./Speedometer/index.js');
|
||||||
|
|
||||||
require('./Tuning/main.js');
|
require('./Tuning/main.js');
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using GTANetworkAPI;
|
|||||||
using GTANetworkMethods;
|
using GTANetworkMethods;
|
||||||
using reallife_gamemode.Model;
|
using reallife_gamemode.Model;
|
||||||
using reallife_gamemode.Server.Extensions;
|
using reallife_gamemode.Server.Extensions;
|
||||||
|
using reallife_gamemode.Server.Factions.Medic;
|
||||||
using reallife_gamemode.Server.Services;
|
using reallife_gamemode.Server.Services;
|
||||||
using reallife_gamemode.Server.Util;
|
using reallife_gamemode.Server.Util;
|
||||||
|
|
||||||
@@ -76,6 +77,20 @@ namespace reallife_gamemode.Server.Events
|
|||||||
ChatService.BroadcastAdmin(message, AdminLevel.ADMIN);
|
ChatService.BroadcastAdmin(message, AdminLevel.ADMIN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//MEDIC AUFTRAG
|
||||||
|
MedicTask reviveTask = new MedicTask()
|
||||||
|
{
|
||||||
|
Victim = player,
|
||||||
|
Position = player.Position,
|
||||||
|
CauseOfDeath = reason.ToString(),
|
||||||
|
Caller = player,
|
||||||
|
Description = "Gestorben",
|
||||||
|
Time = DateTime.Now,
|
||||||
|
Type = 0
|
||||||
|
};
|
||||||
|
Medic.AddTaskToList(reviveTask);
|
||||||
|
|
||||||
|
//TODO PICTURE NOTIFICATION + SOUND für Medics
|
||||||
|
|
||||||
using (var userDeath = new DatabaseContext())
|
using (var userDeath = new DatabaseContext())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using reallife_gamemode.Model;
|
|||||||
using reallife_gamemode.Server.Classes;
|
using reallife_gamemode.Server.Classes;
|
||||||
using reallife_gamemode.Server.Entities;
|
using reallife_gamemode.Server.Entities;
|
||||||
using reallife_gamemode.Server.Extensions;
|
using reallife_gamemode.Server.Extensions;
|
||||||
|
using reallife_gamemode.Server.Factions.Medic;
|
||||||
using reallife_gamemode.Server.Inventory;
|
using reallife_gamemode.Server.Inventory;
|
||||||
using reallife_gamemode.Server.Inventory.Interfaces;
|
using reallife_gamemode.Server.Inventory.Interfaces;
|
||||||
using reallife_gamemode.Server.Managers;
|
using reallife_gamemode.Server.Managers;
|
||||||
@@ -60,9 +61,18 @@ namespace reallife_gamemode.Server.Events
|
|||||||
}
|
}
|
||||||
player.TriggerEvent("showPlayerInteraction", JsonConvert.SerializeObject(nearbyPlayerList));
|
player.TriggerEvent("showPlayerInteraction", JsonConvert.SerializeObject(nearbyPlayerList));
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
|
[RemoteEvent("keyPress:RIGHT_ARROW")]
|
||||||
|
public void KeyPressRightArrow(Client player)
|
||||||
|
{
|
||||||
|
if (!player.IsLoggedIn()) return;
|
||||||
|
User user = player.GetUser();
|
||||||
|
switch (user.FactionId)
|
||||||
{
|
{
|
||||||
player.SendNotification("~r~Es ist niemand in deiner N\u00e4he!", false);
|
//LSFD
|
||||||
|
case 2:
|
||||||
|
player.TriggerEvent("showFactionInteraction", user.FactionId, user.GetFaction().Name, user.FactionLeader, Medic.ReviveTasks.Count, Medic.HealTasks.Count, Medic.FireTasks.Count);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
53
Server/Factions/Medic/Medic.cs
Normal file
53
Server/Factions/Medic/Medic.cs
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using GTANetworkAPI;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @overview Life of German Reallife - Server Factions Medic Medic.cs
|
||||||
|
* @author VegaZ
|
||||||
|
* @copyright (c) 2008 - 2018 Life of German
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
namespace reallife_gamemode.Server.Factions.Medic
|
||||||
|
{
|
||||||
|
public class Medic : Script
|
||||||
|
{
|
||||||
|
public static List<MedicTask> ReviveTasks = new List<MedicTask>();
|
||||||
|
public static List<MedicTask> HealTasks = new List<MedicTask>();
|
||||||
|
public static List<MedicTask> FireTasks = new List<MedicTask>();
|
||||||
|
|
||||||
|
public static void AddTaskToList(MedicTask task)
|
||||||
|
{
|
||||||
|
switch (task.Type)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
ReviveTasks.Add(task);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
HealTasks.Add(task);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
FireTasks.Add(task);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void RemoveTaskFromList(MedicTask task)
|
||||||
|
{
|
||||||
|
switch (task.Type)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
ReviveTasks.Remove(task);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
HealTasks.Remove(task);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
FireTasks.Remove(task);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
25
Server/Factions/Medic/MedicTask.cs
Normal file
25
Server/Factions/Medic/MedicTask.cs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using GTANetworkAPI;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @overview Life of German Reallife - Server Factions Medic MedicTask.cs
|
||||||
|
* @author VegaZ
|
||||||
|
* @copyright (c) 2008 - 2018 Life of German
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
namespace reallife_gamemode.Server.Factions.Medic
|
||||||
|
{
|
||||||
|
public class MedicTask
|
||||||
|
{
|
||||||
|
public Client Victim { get; set; }
|
||||||
|
public Vector3 Position { get; set; }
|
||||||
|
public byte Type { get; set; }
|
||||||
|
public string CauseOfDeath { get; set; }
|
||||||
|
public string Description { get; set; }
|
||||||
|
public Client Caller { get; set; }
|
||||||
|
public DateTime Time { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,6 +16,11 @@ namespace reallife_gamemode.Server.Managers
|
|||||||
{
|
{
|
||||||
public class InteractionManager : Script
|
public class InteractionManager : Script
|
||||||
{
|
{
|
||||||
|
#region Umgebungsinteraktionen PFEILTASTE-HOCH
|
||||||
|
#endregion
|
||||||
|
#region Eigeninteraktionen PFEILTASTE-RUNTER
|
||||||
|
#endregion
|
||||||
|
#region Spielerinteraktionen PFEILTASTE-LINKS
|
||||||
[RemoteEvent("openTradeInventory")]
|
[RemoteEvent("openTradeInventory")]
|
||||||
public void OpenTradeInventory(Client player, string targetPlayer)
|
public void OpenTradeInventory(Client player, string targetPlayer)
|
||||||
{
|
{
|
||||||
@@ -50,5 +55,8 @@ namespace reallife_gamemode.Server.Managers
|
|||||||
tradeRequester.TriggerEvent("unlockTradeItems");
|
tradeRequester.TriggerEvent("unlockTradeItems");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
|
#region Fraktionsinteraktionen / Jobinteraktionen PFEILTASTE-RECHTS
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user