Merge
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
|
||||
var interval = null;
|
||||
|
||||
var garbageToCollect = new Map<BlipMp, ColshapeMp>();
|
||||
var garbageToCollect = new Map<number, { blip: BlipMp, colshape: ColshapeMp }>();
|
||||
|
||||
mp.events.add('SERVER:MuellmannStatusTrue', () => {
|
||||
State = true;
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
newBlip.setFlashTimer(2000);
|
||||
|
||||
garbageToCollect.set(newBlip, newColShape);
|
||||
garbageToCollect.set(i, { blip: newBlip, colshape: newColShape });
|
||||
}
|
||||
|
||||
blipBase = mp.blips.new(1, new mp.Vector3(-442.3999, -1701.5234, 18.933002 - 1), { name: 'Recylinganlage', color: 5, shortRange: false });
|
||||
@@ -42,7 +42,9 @@
|
||||
colshapeBase = mp.colshapes.newSphere(-442.3999, -1701.5234, 18.933002 - 1, 10);
|
||||
});
|
||||
mp.events.add('SERVER:MuellmannBCSEntfernen', () => {
|
||||
garbageToCollect.forEach((colshape, blip) => {
|
||||
garbageToCollect.forEach((collection, index) => {
|
||||
let { blip, colshape } = collection;
|
||||
|
||||
if (colshape && mp.colshapes.exists(colshape))
|
||||
colshape.destroy();
|
||||
if (blip && mp.blips.exists(blip))
|
||||
@@ -69,14 +71,16 @@
|
||||
mp.events.add("playerEnterColshape", (currentShape, player) => {
|
||||
//mp.events.callRemote('CLIENT:ImShape', JSON.stringify(Shape));
|
||||
|
||||
garbageToCollect.forEach((colshape, blip) => {
|
||||
if (!colshape || colshape != currentShape) { return; }
|
||||
let i = getIndex(currentShape);
|
||||
|
||||
if (garbageToCollect.has(i)) {
|
||||
let { blip, colshape } = garbageToCollect.get(i);
|
||||
|
||||
if (mp.players.local.vehicle) { mp.events.call("renderTextOnScreen", "Steige aus dem Müllwagen aus um den Müllsack zu entnehmen."); return; }
|
||||
if (hasBinBag) { mp.gui.chat.push("Du trägst bereits einen Müllsack!"); return; }
|
||||
|
||||
if (!dumptruckIsFull) {
|
||||
mp.events.callRemote('CLIENT:MuellmannImShape', blip.getCoords());
|
||||
mp.events.callRemote('CLIENT:MuellmannImShape', i);
|
||||
hasBinBag = true;
|
||||
|
||||
if (colshape)
|
||||
@@ -84,13 +88,15 @@
|
||||
if (blip)
|
||||
blip.destroy();
|
||||
|
||||
garbageToCollect.delete(i);
|
||||
|
||||
interval = setInterval(function () { createMarker(); }, 2);
|
||||
}
|
||||
else {
|
||||
mp.gui.chat.push("Der Müllwagen ist bereits voll! Fahre zur Base und lade ab!");
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (currentShape == colshapeDumptruck) {
|
||||
if (hasBinBag) {
|
||||
@@ -113,28 +119,20 @@
|
||||
dumptruckIsFull = false;
|
||||
}
|
||||
});
|
||||
mp.events.add("MuellmannUpdateColshape", (vector3) => {
|
||||
let currBlip;
|
||||
garbageToCollect.forEach((colShape, blip) => {
|
||||
if (blip.getCoords() == vector3) currBlip = blip;
|
||||
});
|
||||
mp.events.add("MuellmannUpdateColshape", (index) => {
|
||||
if (!garbageToCollect.has(index)) return;
|
||||
|
||||
if (!garbageToCollect.has(currBlip)) return;
|
||||
mp.gui.chat.push("Has Blip.");
|
||||
let { blip, colshape } = garbageToCollect.get(index);
|
||||
|
||||
var colShape = garbageToCollect.get(currBlip);
|
||||
|
||||
if (currBlip && mp.blips.exists(currBlip)) {
|
||||
mp.gui.chat.push("Delete Blip.");
|
||||
currBlip.destroy();
|
||||
if (blip && mp.blips.exists(blip)) {
|
||||
blip.destroy();
|
||||
}
|
||||
|
||||
if (colShape && mp.colshapes.exists(colShape)) {
|
||||
mp.gui.chat.push("Delete Colshape.");
|
||||
colShape.destroy();
|
||||
if (colshape && mp.colshapes.exists(colshape)) {
|
||||
colshape.destroy();
|
||||
}
|
||||
|
||||
garbageToCollect.delete(currBlip);
|
||||
garbageToCollect.delete(index);
|
||||
});
|
||||
|
||||
mp.events.add("SERVER:MuellmannZuBase", () => {
|
||||
@@ -143,6 +141,15 @@
|
||||
dumptruckIsFull = true;
|
||||
});
|
||||
|
||||
function getIndex(shape: ColshapeMp): number {
|
||||
let i = -1;
|
||||
garbageToCollect.forEach((collection, index) => {
|
||||
let { blip, colshape } = collection;
|
||||
if (shape == colshape) i = index;
|
||||
});
|
||||
return i;
|
||||
}
|
||||
|
||||
function createMarker() {
|
||||
let vehicle;
|
||||
if (vehRemoteID)
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace ReallifeGamemode.Server.Events
|
||||
{
|
||||
//if (player.Vehicle.GetData<bool>("timerJobVehicleRespawn") == true)
|
||||
//{
|
||||
if (player.Vehicle.GetServerVehicle() is JobVehicle vehJ)
|
||||
if (player.Vehicle.GetServerVehicle() is JobVehicle vehJ && job.Id == JobManager.GetJob<RefuseCollectorJob>().Id)
|
||||
{
|
||||
player.Vehicle.ResetData("timerJobVehicleRespawn");
|
||||
ServerVehicle sVeh = VehicleManager.GetServerVehicleFromVehicle(player.Vehicle);
|
||||
|
||||
@@ -311,8 +311,6 @@ namespace ReallifeGamemode.Server.Extensions
|
||||
}
|
||||
}
|
||||
|
||||
NAPI.Util.ConsoleOutput($"{player.Name} - Setting blip and nametag color: nametag = {nameTagColor}, blip = {blipColor}");
|
||||
|
||||
user.Player.SetSharedData("nameTagColor", nameTagColor);
|
||||
user.Player.SetSharedData("blipColor", blipColor);
|
||||
}
|
||||
|
||||
@@ -209,13 +209,13 @@ namespace ReallifeGamemode.Server.Job
|
||||
}
|
||||
|
||||
[RemoteEvent("CLIENT:MuellmannImShape")]
|
||||
public void MuellmannImShape(Player player, Vector3 blipCoords)
|
||||
public void MuellmannImShape(Player player, int index)
|
||||
{
|
||||
foreach (var data in muellmanData)
|
||||
{
|
||||
if (data.getDataFromClient(player) == null) continue;
|
||||
Player target = data.getPartnerClient(player);
|
||||
if (target != null) target.TriggerEvent("MuellmannUpdateColshape", blipCoords);
|
||||
if (target != null) target.TriggerEvent("MuellmannUpdateColshape", index);
|
||||
player.TriggerEvent("renderTextOnScreen", "Wirf den Müllsack in den Müllwagen.");
|
||||
player.AddAttachment("binbag", false);
|
||||
return;
|
||||
|
||||
@@ -13,8 +13,6 @@ using ReallifeGamemode.Server.Util;
|
||||
using ReallifeGamemode.Services;
|
||||
using ReallifeGamemode.Server.Types;
|
||||
|
||||
|
||||
|
||||
namespace ReallifeGamemode.Server.Managers
|
||||
{
|
||||
public class JobManager : Script
|
||||
@@ -145,7 +143,7 @@ namespace ReallifeGamemode.Server.Managers
|
||||
return;
|
||||
}
|
||||
|
||||
if(player.Vehicle != null)
|
||||
if (player.Vehicle != null)
|
||||
{
|
||||
player.SetData<Vehicle>("LastVehicle", player.Vehicle);
|
||||
}
|
||||
@@ -153,6 +151,7 @@ namespace ReallifeGamemode.Server.Managers
|
||||
playerJobStartPosition[player] = player.Position;
|
||||
job.StartJob(player);
|
||||
}
|
||||
|
||||
[ServerEvent(Event.PlayerExitVehicle)]
|
||||
public void JobManagerPlayerExitVehicle(Player player, Vehicle veh)
|
||||
{
|
||||
@@ -242,9 +241,13 @@ namespace ReallifeGamemode.Server.Managers
|
||||
{
|
||||
if (LastVehicle != null)
|
||||
{
|
||||
LastVehicle.ResetData("timerJobVehicleRespawn");
|
||||
ServerVehicle sVeh = VehicleManager.GetServerVehicleFromVehicle(LastVehicle);
|
||||
ServerVehicleExtensions.Spawn(sVeh, LastVehicle);
|
||||
if (job.Id != 2) //Müllman Handelt Fahrzeug respawn eigenständig
|
||||
{
|
||||
LastVehicle.ResetData("timerJobVehicleRespawn");
|
||||
ServerVehicle sVeh = VehicleManager.GetServerVehicleFromVehicle(LastVehicle);
|
||||
ServerVehicleExtensions.Spawn(sVeh, LastVehicle);
|
||||
}
|
||||
|
||||
job.StopJob(player);
|
||||
ChatService.SendMessage(player, $"~y~[JOB]~s~ Du hast deinen Job ~o~{job.Name}~s~ beendet.");
|
||||
CheckPointHandle.DeleteCheckpoints(player);
|
||||
|
||||
Reference in New Issue
Block a user