add option to call taxi service in interaction menu (key down)
This commit is contained in:
@@ -10,12 +10,16 @@ const Point = NativeUI.Point;
|
|||||||
const ItemsCollection = NativeUI.ItemsCollection;
|
const ItemsCollection = NativeUI.ItemsCollection;
|
||||||
const Color = NativeUI.Color;
|
const Color = NativeUI.Color;
|
||||||
|
|
||||||
|
import { getStreetName, getZoneName } from '../streetnames';
|
||||||
|
|
||||||
export default function (globalData: GlobalData) {
|
export default function (globalData: GlobalData) {
|
||||||
|
|
||||||
var menuClose = false;
|
var menuClose = false;
|
||||||
|
|
||||||
var accountItem = new UIMenuItem("Account", "Account Informationen");
|
var accountItem = new UIMenuItem("Account", "Account Informationen");
|
||||||
|
|
||||||
|
var serviceItem = new UIMenuItem("Service rufen", "Rufe einen Dienstleister an");
|
||||||
|
|
||||||
var factionItem = new UIMenuItem("Fraktion", "Verwalte deine Fraktion");
|
var factionItem = new UIMenuItem("Fraktion", "Verwalte deine Fraktion");
|
||||||
var groupItem = new UIMenuItem("Gruppe", "Verwalte deine Gruppe");
|
var groupItem = new UIMenuItem("Gruppe", "Verwalte deine Gruppe");
|
||||||
|
|
||||||
@@ -25,6 +29,10 @@ export default function (globalData: GlobalData) {
|
|||||||
|
|
||||||
var menu = getInteractionMenu();
|
var menu = getInteractionMenu();
|
||||||
|
|
||||||
|
var serviceMenu = getServicesMenu(menu);
|
||||||
|
menu.AddItem(serviceItem);
|
||||||
|
menu.BindMenuToItem(serviceMenu, serviceItem);
|
||||||
|
|
||||||
menu.AddItem(accountItem);
|
menu.AddItem(accountItem);
|
||||||
menu.BindMenuToItem(getAccountMenu(accountData), accountItem);
|
menu.BindMenuToItem(getAccountMenu(accountData), accountItem);
|
||||||
|
|
||||||
@@ -82,6 +90,10 @@ export default function (globalData: GlobalData) {
|
|||||||
menuItem.SetRightLabel(data.factionRank);
|
menuItem.SetRightLabel(data.factionRank);
|
||||||
accountMenu.AddItem(menuItem);
|
accountMenu.AddItem(menuItem);
|
||||||
|
|
||||||
|
menuItem = new UIMenuItem("Job");
|
||||||
|
menuItem.SetRightLabel(data.job);
|
||||||
|
accountMenu.AddItem(menuItem);
|
||||||
|
|
||||||
menuItem = new UIMenuItem("Gruppe");
|
menuItem = new UIMenuItem("Gruppe");
|
||||||
menuItem.SetRightLabel(data.group);
|
menuItem.SetRightLabel(data.group);
|
||||||
accountMenu.AddItem(menuItem);
|
accountMenu.AddItem(menuItem);
|
||||||
@@ -155,4 +167,20 @@ export default function (globalData: GlobalData) {
|
|||||||
|
|
||||||
return groupMenu;
|
return groupMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getServicesMenu(parentMenu: NativeUI.Menu): NativeUI.Menu {
|
||||||
|
var servicesMenu = new Menu("Services", "Rufe einen Service", new Point(50, 50), null, null);
|
||||||
|
servicesMenu.AddItem(new UIMenuItem("Taxi rufen", "Rufe ein Taxu zu deiner Position"));
|
||||||
|
|
||||||
|
servicesMenu.Visible = false;
|
||||||
|
|
||||||
|
servicesMenu.ItemSelect.on((item, index) => {
|
||||||
|
if (index === 0) { // Taxi
|
||||||
|
mp.events.callRemote("CLIENT:InteractionMenu_CallService_Taxi", getStreetName(), getZoneName());
|
||||||
|
}
|
||||||
|
parentMenu.Close();
|
||||||
|
});
|
||||||
|
|
||||||
|
return servicesMenu;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
1
ReallifeGamemode.Client/global.d.ts
vendored
1
ReallifeGamemode.Client/global.d.ts
vendored
@@ -14,6 +14,7 @@ declare interface AccountData {
|
|||||||
factionRank: string;
|
factionRank: string;
|
||||||
group: string;
|
group: string;
|
||||||
groupRank: string;
|
groupRank: string;
|
||||||
|
job: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare interface FactionRanks {
|
declare interface FactionRanks {
|
||||||
|
|||||||
21
ReallifeGamemode.Client/streetnames/index.ts
Normal file
21
ReallifeGamemode.Client/streetnames/index.ts
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
let zoneNamesShort = ["AIRP", "ALAMO", "ALTA", "ARMYB", "BANHAMC", "BANNING", "BEACH", "BHAMCA", "BRADP", "BRADT", "BURTON", "CALAFB", "CANNY", "CCREAK", "CHAMH", "CHIL", "CHU", "CMSW", "CYPRE", "DAVIS", "DELBE", "DELPE", "DELSOL", "DESRT", "DOWNT", "DTVINE", "EAST_V", "EBURO", "ELGORL", "ELYSIAN", "GALFISH", "GOLF", "GRAPES", "GREATC", "HARMO", "HAWICK", "HORS", "HUMLAB", "JAIL", "KOREAT", "LACT", "LAGO", "LDAM", "LEGSQU", "LMESA", "LOSPUER", "MIRR", "MORN", "MOVIE", "MTCHIL", "MTGORDO", "MTJOSE", "MURRI", "NCHU", "NOOSE", "OCEANA", "PALCOV", "PALETO", "PALFOR", "PALHIGH", "PALMPOW", "PBLUFF", "PBOX", "PROCOB", "RANCHO", "RGLEN", "RICHM", "ROCKF", "RTRAK", "SANAND", "SANCHIA", "SANDY", "SKID", "SLAB", "STAD", "STRAW", "TATAMO", "TERMINA", "TEXTI", "TONGVAH", "TONGVAV", "VCANA", "VESP", "VINE", "WINDF", "WVINE", "ZANCUDO", "ZP_ORT", "ZQ_UAR"];
|
||||||
|
|
||||||
|
let zoneNames = ["Los Santos International Airport", "Alamo Sea", "Alta", "Fort Zancudo", "Banham Canyon Dr", "Banning", "Vespucci Beach", "Banham Canyon", "Braddock Pass", "Braddock Tunnel", "Burton", "Calafia Bridge", "Raton Canyon", "Cassidy Creek", "Chamberlain Hills", "Vinewood Hills", "Chumash", "Chiliad Mountain State Wilderness", "Cypress Flats", "Davis", "Del Perro Beach", "Del Perro", "La Puerta", "Grand Senora Desert", "Downtown", "Downtown Vinewood", "East Vinewood", "El Burro Heights", "El Gordo Lighthouse", "Elysian Island", "Galilee", "GWC and Golfing Society", "Grapeseed", "Great Chaparral", "Harmony", "Hawick", "Vinewood Racetrack", "Humane Labs and Research", "Bolingbroke Penitentiary", "Little Seoul", "Land Act Reservoir", "Lago Zancudo", "Land Act Dam", "Legion Square", "La Mesa", "La Puerta", "Mirror Park", "Morningwood", "Richards Majestic", "Mount Chiliad", "Mount Gordo", "Mount Josiah", "Murrieta Heights", "North Chumash", "N.O.O.S.E", "Pacific Ocean", "Paleto Cove", "Paleto Bay", "Paleto Forest", "Palomino Highlands", "Palmer-Taylor Power Station", "Pacific Bluffs", "Pillbox Hill", "Procopio Beach", "Rancho", "Richman Glen", "Richman", "Rockford Hills", "Redwood Lights Track", "San Andreas", "San Chianski Mountain Range", "Sandy Shores", "Mission Row", "Stab City", "Maze Bank Arena", "Strawberry", "Tataviam Mountains", "Terminal", "Textile City", "Tongva Hills", "Tongva Valley", "Vespucci Canals", "Vespucci", "Vinewood", "Ron Alternates Wind Farm", "West Vinewood", "Zancudo River", "Port of South Los Santos", "Davis Quartz"];
|
||||||
|
|
||||||
|
export function getStreetName(): string {
|
||||||
|
var pos: Vector3Mp = mp.players.local.position;
|
||||||
|
var streetId: number = mp.game.pathfind.getStreetNameAtCoord(pos.x, pos.y, pos.z, 0, 0).streetName;
|
||||||
|
return mp.game.ui.getStreetNameFromHashKey(streetId);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getZoneName(): string {
|
||||||
|
let position = mp.players.local.position;
|
||||||
|
let zoneName = mp.game.zone.getNameOfZone(position.x, position.y, position.z);
|
||||||
|
|
||||||
|
if (zoneNamesShort.includes(zoneName)) {
|
||||||
|
let zoneID = zoneNamesShort.indexOf(zoneName);
|
||||||
|
return zoneNames[zoneID];
|
||||||
|
}
|
||||||
|
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
@@ -93,7 +93,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
}
|
}
|
||||||
using (var getFaction = new DatabaseContext())
|
using (var getFaction = new DatabaseContext())
|
||||||
{
|
{
|
||||||
Entities.Faction receiverUser = getFaction.Factions.FirstOrDefault(u => u.Name == receiver);
|
Faction receiverUser = getFaction.Factions.FirstOrDefault(u => u.Name == receiver);
|
||||||
|
|
||||||
if (receiverUser == null)
|
if (receiverUser == null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -111,7 +111,8 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
faction = u.Faction?.Name ?? "Zivilist",
|
faction = u.Faction?.Name ?? "Zivilist",
|
||||||
factionRank = u.GetFactionRank().RankName,
|
factionRank = u.GetFactionRank().RankName,
|
||||||
group = u.Group?.Name ?? "Keine",
|
group = u.Group?.Name ?? "Keine",
|
||||||
groupRank = u.GroupRank.GetName()
|
groupRank = u.GroupRank.GetName(),
|
||||||
|
job = JobManager.GetJob(u.JobId ?? 0)?.Name ?? "Keiner"
|
||||||
};
|
};
|
||||||
|
|
||||||
string faction = u.FactionLeader ? u.Faction.Name : null;
|
string faction = u.FactionLeader ? u.Faction.Name : null;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using ReallifeGamemode.Server.Entities;
|
using ReallifeGamemode.Server.Entities;
|
||||||
using ReallifeGamemode.Server.Extensions;
|
using ReallifeGamemode.Server.Extensions;
|
||||||
|
using ReallifeGamemode.Server.Job;
|
||||||
using ReallifeGamemode.Server.Models;
|
using ReallifeGamemode.Server.Models;
|
||||||
using ReallifeGamemode.Server.Services;
|
using ReallifeGamemode.Server.Services;
|
||||||
using ReallifeGamemode.Server.Util;
|
using ReallifeGamemode.Server.Util;
|
||||||
@@ -246,6 +247,13 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[RemoteEvent("CLIENT:InteractionMenu_CallService_Taxi")]
|
||||||
|
public void CallServiceTaxi(Client player, string street, string zone)
|
||||||
|
{
|
||||||
|
string msg = $"!{{02FCFF}}{player.Name} hat in der {street} in {zone} ein Taxi gerufen.";
|
||||||
|
ChatService.BroadcastJob(msg, JobManager.GetJob<TaxiDriverJob>());
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Spielerinteraktionen PFEILTASTE-LINKS
|
#region Spielerinteraktionen PFEILTASTE-LINKS
|
||||||
[RemoteEvent("openTradeInventory")]
|
[RemoteEvent("openTradeInventory")]
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using GTANetworkAPI;
|
using GTANetworkAPI;
|
||||||
using ReallifeGamemode.Server.Entities;
|
using ReallifeGamemode.Server.Entities;
|
||||||
using ReallifeGamemode.Server.Extensions;
|
using ReallifeGamemode.Server.Extensions;
|
||||||
|
using ReallifeGamemode.Server.Job;
|
||||||
using ReallifeGamemode.Server.Util;
|
using ReallifeGamemode.Server.Util;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
@@ -88,5 +89,10 @@ namespace ReallifeGamemode.Server.Services
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void BroadcastJob(string message, JobBase job)
|
||||||
|
{
|
||||||
|
job.GetUsersInJob().ForEach(c => c.SendChatMessage(message));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user