try fix Job

This commit is contained in:
2021-04-05 15:55:41 +02:00
parent 90514a381d
commit b49cbffb32
2 changed files with 17 additions and 13 deletions

View File

@@ -43,9 +43,9 @@
});
mp.events.add('SERVER:MuellmannBCSEntfernen', () => {
garbageToCollect.forEach((colshape, blip) => {
if (colshape)
if (colshape && mp.colshapes.exists(colshape))
colshape.destroy();
if (blip)
if (blip && mp.blips.exists(blip))
blip.destroy();
});
@@ -76,7 +76,7 @@
if (hasBinBag) { mp.gui.chat.push("Du trägst bereits einen Müllsack!"); return; }
if (!dumptruckIsFull) {
mp.events.callRemote('CLIENT:MuellmannImShape', JSON.stringify(blip));
mp.events.callRemote('CLIENT:MuellmannImShape', blip.getCoords());
hasBinBag = true;
if (colshape)
@@ -113,18 +113,22 @@
dumptruckIsFull = false;
}
});
mp.events.add("MuellmannUpdateColshape", (jsonIdentifier) => {
var blip = JSON.parse(jsonIdentifier);
if (!garbageToCollect.has(blip)) return;
mp.events.add("MuellmannUpdateColshape", (vector3) => {
let currBlip;
garbageToCollect.forEach((colShape, blip) => {
if (blip.getCoords == vector3) currBlip = blip;
});
var colShape = garbageToCollect.get(blip);
if (!garbageToCollect.has(currBlip)) return;
if (blip)
blip.destroy();
if (colShape)
var colShape = garbageToCollect.get(currBlip);
if (currBlip && mp.blips.exists(currBlip))
currBlip.destroy();
if (colShape && mp.colshapes.exists(colShape))
colShape.destroy();
garbageToCollect.delete(blip);
garbageToCollect.delete(currBlip);
});
mp.events.add("SERVER:MuellmannZuBase", () => {

View File

@@ -209,13 +209,13 @@ namespace ReallifeGamemode.Server.Job
}
[RemoteEvent("CLIENT:MuellmannImShape")]
public void MuellmannImShape(Player player, string jsonIdentifier)
public void MuellmannImShape(Player player, Vector3 blipCoords)
{
foreach (var data in muellmanData)
{
if (data.getDataFromClient(player) == null) continue;
Player target = data.getPartnerClient(player);
if (target != null) target.TriggerEvent("MuellmannUpdateColshape", jsonIdentifier);
if (target != null) target.TriggerEvent("MuellmannUpdateColshape", blipCoords);
player.TriggerEvent("renderTextOnScreen", "Wirf den Müllsack in den Müllwagen.");
player.AddAttachment("binbag", false);
return;