[+] Elevator System. + FIB, LSED, Ballas & GS duty / weapon rack

This commit is contained in:
Lukas Moungos
2019-07-26 00:13:27 +02:00
parent 0f4710e7da
commit 511b05a5e6
7 changed files with 163 additions and 5 deletions

View File

@@ -0,0 +1,71 @@
import * as NativeUI from '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;
let screenRes = mp.game.graphics.getScreenResolution(0, 0);
let saveItem = new UIMenuItem("Bestätigen", "");
saveItem.BackColor = new Color(13, 71, 161);
saveItem.HighlightedBackColor = new Color(25, 118, 210);
let cancelItem = new UIMenuItem("Abbrechen", "");
cancelItem.BackColor = new Color(213, 0, 0);
cancelItem.HighlightedBackColor = new Color(229, 57, 53);
export default function elevatorList(globalData: GlobalData) {
var elevatorMenu: NativeUI.Menu;
var stages;
var stage = "";
//Weapon Menu
mp.events.add('showElevatorMenu', (stagesArr) => {
if (!globalData.InMenu) {
globalData.InMenu = true;
stages = JSON.parse(stagesArr);
elevatorMenu = new Menu("Aufzug", "", new Point(50, 50), null, null);
elevatorMenu.AddItem(new UIMenuListItem("Stock", "", new ItemsCollection(stages)));
elevatorMenu.AddItem(saveItem);
elevatorMenu.AddItem(cancelItem);
elevatorMenu.Visible = true;
elevatorMenu.ListChange.on((item, index) => {
switch (item.Text) {
case "Stock":
stage = String(item.SelectedItem.DisplayText);
break;
}
});
elevatorMenu.ItemSelect.on((item) => {
if (item.Text === "Bestätigen") {
mp.events.callRemote("sendClientToStage", stage);
elevatorMenu.Close();
globalData.InMenu = false;
} else if (item.Text === "Abbrechen") {
elevatorMenu.Close();
globalData.InMenu = false;
}
});
elevatorMenu.MenuClose.on(() => {
globalData.InMenu = false;
});
}
});
}

View File

@@ -52,7 +52,7 @@ export default function dutyCloth(globalData: GlobalData) {
dutyMenu = new Menu("Dienstkleidung", "Stelle deine Dienstkleidung zusammen", new Point(50, 50), null, null);
dutyMenu.AddItem(new UIMenuListItem("Hut", "", new ItemsCollection(hats)));
dutyMenu.AddItem(new UIMenuListItem("Accessoire", "", new ItemsCollection(hats)));
dutyMenu.AddItem(new UIMenuListItem("Top", "", new ItemsCollection(tops)));
dutyMenu.AddItem(new UIMenuListItem("Hose", "", new ItemsCollection(legs)));
dutyMenu.AddItem(new UIMenuListItem("Schuhe", "", new ItemsCollection(shoes)));

View File

@@ -91,6 +91,9 @@ interiors(globalData);
import factionInteraction from './Interaction/factioninteraction';
factionInteraction(globalData);
import elevatorList from './Interaction/elevator';
elevatorList(globalData);
import worldInteraction from './Interaction/worldinteraction';
worldInteraction();

View File

@@ -134,6 +134,7 @@ namespace ReallifeGamemode.Server.Events
DutyPoint nearestDuty = PositionManager.DutyPoints.Find(d => d.Position.DistanceTo(player.Position) <= 1.5 && d.FactionId == user.FactionId);
WeaponPoint nearestWeapon = PositionManager.WeaponPoints.Find(w => w.Position.DistanceTo(player.Position) <= 1.5 && w.FactionId == user.FactionId);
JailReleasePoint nearestJailReleasePoint = PositionManager.JailReleasePoints.Find(j => j.Position.DistanceTo(player.Position) <= 1.5 && (user.FactionId == 1 || user.FactionId == 3) && user.GetData<bool>("duty"));
ElevatorPoint nearestElevatorPoint = PositionManager.ElevatorPoints.Find(e => e.Position.DistanceTo(player.Position) <= 1.5 && (user.FactionId == 1 || user.FactionId == 3));
if (nearestDuty != null)// Duty Point
{
var nameTagColor = new Color(0, 0, 0);
@@ -173,6 +174,7 @@ namespace ReallifeGamemode.Server.Events
case 3:
nameTagColor = new Color(173, 0, 118);
player.SetSharedData("blipColor", 83);
player.SetAccessories(2, 2, 0);
break;
}
player.NametagColor = nameTagColor;
@@ -266,6 +268,18 @@ namespace ReallifeGamemode.Server.Events
}
player.TriggerEvent("showJailMenu", JsonConvert.SerializeObject(criminals.ToArray()));
}
if (nearestElevatorPoint != null)
{
List<string> stages = new List<string>();
foreach(var e in PositionManager.ElevatorPoints)
{
if(e.Position.DistanceTo2D(player.Position) <= 25 && e.Position.DistanceTo(player.Position) > 1.5)
{
stages.Add(e.Stage);
}
}
player.TriggerEvent("showElevatorMenu", JsonConvert.SerializeObject(stages.ToArray()));
}
}
}

View File

@@ -20,6 +20,8 @@ namespace ReallifeGamemode.Server.Events
else
{
player.ClearAccessory(0);
player.ClearAccessory(1);
player.ClearAccessory(2);
}
}
@@ -151,4 +153,4 @@ namespace ReallifeGamemode.Server.Events
}
}
}
}
}

View File

@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Text;
using GTANetworkAPI;
using ReallifeGamemode.Server.Managers;
namespace ReallifeGamemode.Server.Events
{
public class UpdateCharacterElevator : Script
{
[RemoteEvent("sendClientToStage")]
public void SaveWeaponSelection(Client client, string stage)
{
ElevatorPoint elevator = PositionManager.ElevatorPoints.Find(e => e.Stage == stage);
if(elevator != null)
{
client.Position = elevator.Position;
}
}
}
}

View File

@@ -17,6 +17,9 @@ namespace ReallifeGamemode.Server.Managers
public static List<JailReleasePoint> JailReleasePoints = new List<JailReleasePoint>();
public static List<ColShape> JailReleaseColShapes = new List<ColShape>();
public static List<ElevatorPoint> ElevatorPoints = new List<ElevatorPoint>();
public static List<ColShape> ElevatorColShapes = new List<ColShape>();
[ServerEvent(Event.ResourceStart)]
public void OnResourceStart()
{
@@ -57,7 +60,8 @@ namespace ReallifeGamemode.Server.Managers
};
WeaponPoint weaponPointFIB = new WeaponPoint()
{
Position = new Vector3(119.6835, -729.3273, 242.1519),
//Position = new Vector3(119.6835, -729.3273, 242.1519), old
Position = new Vector3(143.5561,-762.7424,242.152),
FactionId = 3
};
WeaponPoint weaponPointBallas = new WeaponPoint()
@@ -83,21 +87,57 @@ namespace ReallifeGamemode.Server.Managers
NAPI.TextLabel.CreateTextLabel("Waffenspind - Dr\u00fccke ~y~E", w.Position, 7, 1, 0, new Color(255, 255, 255), false, 0);
}
#endregion
#region JailReleasePoint
#region JailReleasePoints
JailReleasePoint jailPointLSPD = new JailReleasePoint()
{
Position = new Vector3(459.5327, -988.8435, 24.91487)
};
JailReleasePoint jailPointFIB = new JailReleasePoint()
{
Position = new Vector3(119.6362,-727.6199,242.152)
};
JailReleasePoints.Add(jailPointLSPD);
JailReleasePoints.Add(jailPointFIB);
foreach(JailReleasePoint j in JailReleasePoints)
foreach (JailReleasePoint j in JailReleasePoints)
{
NAPI.Marker.CreateMarker(1, new Vector3(j.Position.X, j.Position.Y, j.Position.Z - 2), new Vector3(j.Position.X, j.Position.Y, j.Position.Z + 1),
new Vector3(0, 0, 0), 1.5f, new Color(255, 255, 255, 50), false, 0);
NAPI.TextLabel.CreateTextLabel("Gefängnis PC - Dr\u00fccke ~y~E", j.Position, 7, 1, 0, new Color(255, 255, 255), false, 0);
}
#endregion
#region ElevetaorPoints
ElevatorPoint FibElevatorPointEG = new ElevatorPoint()
{
Position = new Vector3(136.1958, -761.657, 242.152), //FBI oben
FactionId = 3,
Stage = "Büro"
};
ElevatorPoint FibElevatorPointIntern = new ElevatorPoint()
{
Position = new Vector3(136.1958, -761.7176, 45.75203), //FBI unten
FactionId = 3,
Stage = "EG"
};
ElevatorPoint FibElevatorPointGarage = new ElevatorPoint()
{
Position = new Vector3(124.2521, -741.3329, 33.13322), //FBI ganz ganz unten
FactionId = 3,
Stage = "Garage"
};
ElevatorPoints.Add(FibElevatorPointEG);
ElevatorPoints.Add(FibElevatorPointIntern);
ElevatorPoints.Add(FibElevatorPointGarage);
foreach (ElevatorPoint j in ElevatorPoints)
{
NAPI.Marker.CreateMarker(1, new Vector3(j.Position.X, j.Position.Y, j.Position.Z - 2), new Vector3(j.Position.X, j.Position.Y, j.Position.Z + 1),
new Vector3(0, 0, 0), 1.5f, new Color(255, 255, 255, 50), false, 0);
NAPI.TextLabel.CreateTextLabel("Aufzug - Dr\u00fccke ~y~E", j.Position, 7, 1, 0, new Color(255, 255, 255), false, 0);
}
#endregion
}
}
@@ -117,6 +157,12 @@ namespace ReallifeGamemode.Server.Managers
{
public Vector3 Position { get; set; }
}
public class ElevatorPoint
{
public Vector3 Position { get; set; }
public int FactionId { get; set; }
public string Stage { get; set; }
}
}