Miese Corona Zeiten push für Lenhardt

This commit is contained in:
Siga
2020-05-10 19:19:53 +02:00
parent 15e4cec8ee
commit efbff34c21
159 changed files with 8042 additions and 8695 deletions

View File

@@ -19,19 +19,16 @@ cancelItem.BackColor = new Color(213, 0, 0);
cancelItem.HighlightedBackColor = new Color(229, 57, 53);
export default function elevatorList(globalData: IGlobalData) {
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);

View File

@@ -1,9 +1,8 @@
export default function RefuseCollector() {
var State = false;
var Traegt = false;
var HintenVoll = false;
var MuellSack = null;
var BlipTonneHinten = null;
var CheckpointTonneHinten = null;
var ShapeTonneHinten = null;
@@ -17,8 +16,6 @@
var BlipTonne = [];
var ShapeTonne = [];
mp.events.add('SERVER:MuellmannStatusTrue', () => {
State = true;
});
@@ -28,14 +25,13 @@
});
mp.events.add('SERVER:MuellmannBCSErstellen', (jsonPosArr, veh) => {
let posArr = JSON.parse(jsonPosArr);
vehicle = veh;
for (var i = 0; i < posArr.length; i++) {
let pos = new mp.Vector3(posArr[i].x, posArr[i].y, posArr[i].z - 1)
BlipTonne.push(mp.blips.new(1, pos, { name: 'Müllmann', color: 45, shortRange: false }));
BlipTonne[i].setFlashes(true);
ShapeTonne.push(mp.colshapes.newSphere(posArr[i].x, posArr[i].y, posArr[i].z +0.5, 1.75));
BlipTonne[i].setFlashTimer(2000);
ShapeTonne.push(mp.colshapes.newSphere(posArr[i].x, posArr[i].y, posArr[i].z + 0.5, 1.75));
}
BlipTonneBase = mp.blips.new(1, new mp.Vector3(-535.1912, -1713.742, 19.23861 - 1), { name: 'Müllmann', color: 5, shortRange: false });
@@ -43,7 +39,6 @@
ShapeTonneBase = mp.colshapes.newSphere(-535.1912, -1713.742, 19.23861 - 1, 10);
});
mp.events.add('SERVER:MuellmannBCSEntfernen', () => {
for (var i = 0; i < BlipTonne.length; i++) {
if (BlipTonne[i] == null) continue;
BlipTonne[i].destroy();
@@ -79,10 +74,8 @@
BlipTonne[i] = null;
ShapeTonne[i].destroy();
ShapeTonne[i] = null;
MuellSack = mp.objects.new(3619689535, mp.players.local.position, { rotation: new mp.Vector3(0.0, 0.0, 0.0), alpha: 255, dimension: 0 });
MuellSack.attachTo(mp.players.local.handle, mp.players.local.getBoneIndex(6286), 0.08, 0.0, -0.03, 270.0, 0.0, 25.0, true, true, false, false, 0, true);
interval = setInterval(function () { createMarker(); }, 250);
interval = setInterval(function () { createMarker(); }, 2);
}
else {
mp.gui.chat.push("Der Müllwagen ist bereits voll! Fahre zur Base und lade ab!");
@@ -96,7 +89,6 @@
}
if (Shape == ShapeTonneHinten) {
if (Traegt) {
Traegt = false;
mp.events.callRemote('CLIENT:MuellmannAddSack');
@@ -108,10 +100,7 @@
CheckpointTonneHinten = null;
if (ShapeTonneHinten) ShapeTonneHinten.destroy();
ShapeTonneHinten = null;
MuellSack.destroy();
}
}
else if (Shape == ShapeTonneBase) {
BlipTonneBase.setRoute(false);
@@ -134,11 +123,31 @@
HintenVoll = true;
});
function createMarker() {
if (vehicle != null) {
var boneIndex = vehicle.getBoneIndexByName("platelight");
let pos = vehicle.getWorldPositionOfBone(boneIndex);
var boneIndex2 = vehicle.getBoneIndexByName("platelight");
var boneIndex1 = vehicle.getBoneIndexByName("chassis_dummy");
let posPlate = vehicle.getWorldPositionOfBone(boneIndex2);
let posCentre = vehicle.getWorldPositionOfBone(boneIndex1);
let plateVec = new mp.Vector3(posPlate.x, posPlate.y, posPlate.z);
let lightVec = new mp.Vector3(posCentre.x, posCentre.y, posCentre.z);
let posPL = lightVec.subtract(plateVec);
let temp = new mp.Vector3(posPL.x * -1, posPL.y * -1, posPL.z * -1)
let length = Math.sqrt((temp.x * temp.x) + (temp.y * temp.y) + (temp.z * temp.z));
let x = temp.x / length;
let y = temp.y / length;
let z = temp.z / length;
temp = new mp.Vector3(x, y, z - 1);
let pos = plateVec.add(temp);
if (BlipTonneHinten) BlipTonneHinten.destroy();
BlipTonneHinten = null;
if (CheckpointTonneHinten) CheckpointTonneHinten.destroy();
@@ -147,10 +156,7 @@
ShapeTonneHinten = null;
BlipTonneHinten = mp.blips.new(318, pos, { name: 'Müllmann', color: 24, shortRange: false });
CheckpointTonneHinten = mp.markers.new(1, pos, 1, { direction: new mp.Vector3(-235.5747, -1685.475, 32.7207), color: [0, 255, 0, 255], visible: true, dimension: 0 });
ShapeTonneHinten = mp.colshapes.newSphere(pos.x, pos.y, pos.z - 1, 2);
ShapeTonneHinten = mp.colshapes.newSphere(pos.x, pos.y, pos.z, 2);
}
};
}

View File

@@ -22,8 +22,6 @@ body {
background-color: transparent;
}
.main2 {
z-index: 2;
background: #0c0c0cc4;
@@ -557,53 +555,48 @@ t#tf_nameorid {
}
#tf_zahl {
background-color: #313131; /* blau */
background-color: #313131;
border: none;
height: 30px;
width: 124px;
height: 1vw;
width: 4.3vw;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 12px;
font-size: 0.5vw;
position: relative;
left: 42%;
top: 40%;
left: 7.8vw;
top: 1.2vw;
color: #ffffff;
}
#tf_cancle {
background-color: #ff0000;
border: none;
height: 32px;
width: 124px;
height: 1vw;
width: 3vw;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
font-color: white;
font-size: 0.5vw;
position: relative;
left: 33.7%;
top: 44%;
left: 12.5vw;
top: -0.2vw;
color: #ffffff;
opacity: 0.5;
transition: 0.3s;
}
#tf_submitZahl {
background-color: #008CBA; /* blau */
background-color: #008CBA;
border: none;
height: 32px;
width: 124px;
height: 1.5vw;
width: 8vw;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
font-color: white;
font-size: 0.5vw;
position: relative;
left: 42%;
top: 40%;
left: -1.8vw;
top: 6vw;
color: #ffffff;
opacity: 0.5;
transition: 0.3s;
}
@@ -614,15 +607,15 @@ t#tf_nameorid {
#tf_zahl4 {
background-color: #313131;
border: none;
height: 1.5vw;
width: 5vw;
height: 1vw;
width: 4.3vw;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 0.6vw;
font-size: 0.5vw;
position: relative;
left: 19vw;
top: 13vw;
left: 7.7vw;
top: 1vw;
color: #ffffff;
}
@@ -635,12 +628,10 @@ t#tf_nameorid {
text-decoration: none;
display: inline-block;
font-size: 0.5vw;
font-color: white;
position: relative;
left: 17.8vw;
top: 9.4vw;
left: 12.5vw;
top: -0.3vw;
color: #ffffff;
opacity: 0.5;
transition: 0.3s;
}
@@ -657,12 +648,10 @@ t#tf_nameorid {
text-decoration: none;
display: inline-block;
font-size: 0.5vw;
font-color: white;
position: relative;
left: 21vw;
top: 13vw;
left: -5.4vw;
top: 6vw;
color: #ffffff;
opacity: 0.5;
transition: 0.3s;
}
@@ -692,7 +681,6 @@ t#tf_nameorid {
opacity: 1;
}
#tf_acceptTrade {
background-color: #009b03;
border: none;
@@ -731,11 +719,13 @@ t#tf_nameorid {
color: #ffffff;
opacity: 0.5;
transition: 0.3s;
}i
}
#tf_cancle3:hover {
opacity: 1
}
i
#tf_cancle3:hover {
opacity: 1
}
#tf_cancle:hover {
opacity: 1
@@ -784,7 +774,7 @@ t#tf_nameorid {
.BoxBlue {
background-color: #1b1b1b;
height: 11.1vw;
height: 8.9vw;
width: 20.2vw;
position: relative;
margin-top: 11vw;
@@ -801,7 +791,7 @@ t#tf_nameorid {
display: inline-block;
font-size: 0.5vw;
position: relative;
left: 5.45vw;
left: 12.45vw;
top: 0vw;
color: #ffffff;
}
@@ -837,8 +827,8 @@ t#tf_nameorid {
display: inline-block;
font-size: 0.6vw;
position: relative;
left: 10.8vw;
top: 5.45vw;
left: -1.7vw;
top: 6.45vw;
color: #ffffff;
opacity: 0.5;
transition: 0.3s;
@@ -858,8 +848,8 @@ t#tf_nameorid {
display: inline-block;
font-size: 0.5vw;
position: relative;
left: 7.5vw;
top: 4.4vw;
left: 7.8vw;
top: 1.4vw;
color: #ffffff;
}
@@ -871,15 +861,15 @@ select.select_box2 {
.blueIcon1 {
position: relative;
height: 3vw;
margin-bottom: -3.1vw;
margin-left: 13.4vw;
margin-bottom: -3.6vw;
margin-left: 8.5vw;
}
.blueIcon2 {
position: relative;
height: 3vw;
margin-bottom: 0.9vw;
margin-left: 3.4vw;
margin-bottom: -4.6vw;
margin-left: 0.7vw;
}
.blue3 {
@@ -901,7 +891,6 @@ select.select_box2 {
opacity: 1
}
#tf_nameorid {
background-color: #313131;
border: none;
@@ -917,7 +906,6 @@ select.select_box2 {
color: #ffffff;
}
.alert_green {
z-index: 2;
background: rgba(85, 255, 0, 0.90);

View File

@@ -11,40 +11,48 @@
<body>
<div class="alerts" id='alertbox'>
</div>
<div class="sidebar">
<ul>
<li name="side1" class="sidebaritem1" onclick="switchSite('backpackClass')"><img class="sideicon1" src="img/backpack/backpack.svg"><p class="bartext">Rucksack</p></li>
<li name="side2" class="sidebaritem2" onclick="getVehicle()"><img class="sideicon2" src="img/backpack/car.svg"><p class="bartext">Fahrzeug</p></li>
<li name="side3" class="sidebaritem3" onclick="switchSite('tradeClass')"><img class="sideicon4" src="img/backpack/trading.svg"><p class="bartext">Handel</p></li>
<li name="side1" class="sidebaritem1" onclick="switchSite('backpackClass')">
<img class="sideicon1" src="img/backpack/backpack.svg"><p class="bartext">Rucksack</p>
</li>
<li name="side2" class="sidebaritem2" onclick="getVehicle()">
<img class="sideicon2" src="img/backpack/car.svg"><p class="bartext">Fahrzeug</p>
</li>
<!-- <li name="side3" class="sidebaritem3" onclick="switchSite('tradeClass')"><img class="sideicon4" src="img/backpack/trading.svg"><p class="bartext">Handel</p></li>
<li name="side4" class="sidebaritem4 hidden" onclick="switchSite('handelClass')"><img class="sideicon4" src="img/backpack/trading.svg"><p class="bartext">Handeln</p></li>
<li name="side5" class="sidebaritem5 hidden" onclick="getTrade()"><img class="sideicon4" src="img/backpack/save-money.svg"><p class="bartext">Anfrage</p></li>
<li name="side6" class="sidebaritem6 hidden" onclick="switchSite('backClass')"><img class="sideicon4" src="img/backpack/back.svg"><p class="bartext">Zurück</p></li>
<li name="side5" class="sidebaritem5 hidden" onclick="getTrade()"><img class="sideicon4" src="img/backpack/save-money.svg"><p class="bartext">Anfrage</p></li> -->
<li name="side6" class="sidebaritem6 hidden" onclick="switchSite('backClass')">
<img class="sideicon4" src="img/backpack/back.svg"><p class="bartext">Zurück</p>
</li>
</ul>
</div>
<div name="backpackClass" class="backpack">
<div class="main">
<div class="Betrag" style="display:none;">
<input type="text" id="tf_zahl" name="number" placeholder="Betrag eingeben" min="1" step="1" oninput="this.value=this.value.replace(/[^0-9]/g,'');">
<button id='tf_submitZahl' onclick="">Bestätigen</button>
<button id='tf_cancle' onclick="">Schließen</button>
</div>
<div class="Betrag2" style="display:none;">
<div class="Betrag" style="display: none;">
<div class="BoxBlue">
<input type="text" id="tf_zahl2" name="number" placeholder="Betrag eingeben" min="1" step="1" oninput="this.value=this.value.replace(/[^0-9]/g,'');">
<button id="tf_submitZahlToHandel" onclick="">Zum handeln transferieren</button>
<button id="tf_cancle2" onclick="">Schließen</button>
<button id="tf_submitZahlToVehicle" onclick="">Zum Fahrzeug transferieren</button>
<img class="blueIcon1" src="img/backpack/car.svg">
<img class="blueIcon2" src="img/backpack/trading.svg">
<input type="text" id="tf_zahl" name="number" placeholder="Betrag eingeben" min="1" step="1" oninput="this.value=this.value.replace(/[^0-9]/g,'');">
<button id="tf_cancle" onclick="">Schließen</button>
<button id="tf_submitZahl" onclick="">Bestätigen</button>
<img class="blueIcon1" src="img/backpack/trash2.svg"></img>
</div>
</div>
<div class="title"><div class="titlecount"><span id="count1">0</span> / 40 Kilogramm</div><div class="titletext">Rucksack</div></div>
<div class="Betrag2" style="display: none;">
<div class="BoxBlue">
<input type="text" id="tf_zahl2" name="number" placeholder="Betrag eingeben" min="1" step="1" oninput="this.value=this.value.replace(/[^0-9]/g,'');">
<button id="tf_cancle2" onclick="">Schließen</button>
<button id="tf_submitZahlToVehicle" onclick="">Zum Fahrzeug transferieren</button>
<img class="blueIcon1" src="img/backpack/car.svg"></img>
</div>
</div>
<div class="title">
<div class="titlecount"><span id="count1">0</span> / 40 Kilogramm</div>
<div class="titletext">Rucksack</div>
</div>
<div class="items">
<ul id="List0"></ul>
</div>
@@ -53,91 +61,60 @@
<div name="vehClass" class="veh hidden">
<div class="main">
<div class="title"><div class="titlecount"><span id="count2">0</span> / 250 Kilogramm</div><div class="titletext">Fahrzeug</div></div>
<div class="Betrag4" style="display:none;">
<input type="text" id="tf_zahl4" name="number" placeholder="Betrag eingeben" min="1" step="1" oninput="this.value=this.value.replace(/[^0-9]/g,'');">
<button id='tf_submitZahl4' onclick="">Zum Rucksack transferieren</button>
<button id='tf_cancle4' onclick="">Schließen</button>
<div class="title">
<div class="titlecount"><span id="count2">0</span> / 250 Kilogramm</div>
<div class="titletext">Fahrzeug</div>
</div>
<div class="Betrag4" style="display: none;">
<div class="BoxBlue">
<img class="blueIcon1" src="img/backpack/backpack.svg">
<button id="tf_cancle4" onclick="">Schließen</button><input type="text" id="tf_zahl4" name="number" placeholder="Betrag eingeben" min="1" step="1" oninput="this.value=this.value.replace(/[^0-9]/g,'');">
<button id="tf_submitZahl4" onclick="">Zum Rucksack transferieren</button>
</div>
</div>
<div class="items">
<ul id="List4"></ul>
</div>
</div>
</div>
<!-- <div name="handelClass" class="handel hidden">
<div class="main">
<div class="Betrag3" style="display:none;">
<input type="text" id="tf_zahl3" name="number" placeholder="Betrag eingeben" min="1" step="1" oninput="this.value=this.value.replace(/[^0-9]/g,'');">
<button id='tf_submitZahl3' onclick="">Bestätigen</button>
<button id='tf_cancle3' onclick="">Schließen</button>
</div>
<input type="text" id="tf_nameorid" name="fname" placeholder="Name oder ID eingeben">
<button id='tf_submitTrade' onclick="">Senden</button>
<div class="title"><div class="titlecount"><span id="count3">0</span> Kilogramm</div><div class="titletext">Handeln</div></div>
<div class="items">
<ul id="List4"></ul>
<ul id="List2"></ul>
</div>
</div>
</div>
<div name="handelClass" class="handel hidden">
<div class="main">
<div class="Betrag3" style="display:none;">
<input type="text" id="tf_zahl3" name="number" placeholder="Betrag eingeben" min="1" step="1" oninput="this.value=this.value.replace(/[^0-9]/g,'');">
<button id='tf_submitZahl3' onclick="">Bestätigen</button>
<button id='tf_cancle3' onclick="">Schließen</button>
<div name="anfrageClass" class="something hidden">
<div class="main">
<button id='tf_acceptTrade' onclick="">Annehmen</button>
<div class="title"><div class="titlecount"><span id="count4">0</span> Kilogramm</div><div class="titletext">Anfrage</div></div>
<div class="items">
<ul id="List3"></ul>
</div>
</div>
</div> -->
<input type="text" id="tf_nameorid" name="fname" placeholder="Name oder ID eingeben">
<button id='tf_submitTrade' onclick="">Senden</button>
<div id="invisible" style="display: none"></div>
<div class="title"><div class="titlecount"><span id="count3">0</span> Kilogramm</div><div class="titletext">Handeln</div></div>
<div class="items">
<ul id="List2"></ul>
</div>
</div>
</div>
<div name="anfrageClass" class="something hidden">
<div class="main">
<button id='tf_acceptTrade' onclick="">Annehmen</button>
<div class="title"><div class="titlecount"><span id="count4">0</span> Kilogramm</div><div class="titletext">Anfrage</div></div>
<div class="items">
<ul id="List3"></ul>
</div>
</div>
</div>
<div id="invisible" style="display:none"></div>
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script src="../../js/jquery-3.3.1.min.js"></script>
<script>
var lastClass = "backpackClass";
var val = 0;
var val = 0;
function changeTradeStatus(value) {
val = JSON.parse(value);
}
function getTrade() {
if (val == 1) {
switchSite('anfrageClass');
}
}
function getVehicle() {
if (vehInv.length > 0) {
switchSite('vehClass');
} else {
mp.trigger("Error", "Kofferraum leer oder kein Fahrzeug in der Nähe.")
}
}
$("#tf_acceptTrade").unbind('click').click(function () {
if (anfrageInv.length > 0) {
mp.trigger("CEF:acceptTrade");
}
});
$("#tf_submitTrade").unbind('click').click(function () {
if (handelInv.length > 0) {
var handelItemID = [];
var handelItemAmount = [];
for (i = 0; i < handelInv.length; i++) {
handelItemID.push(handelInv[i].ID);
handelItemAmount.push(handelInv[i].Amount);
}
mp.trigger("CEF:tradeItem", 0, JSON.stringify(String($('#tf_nameorid').val())), JSON.stringify(handelItemID), JSON.stringify(handelItemAmount))
}
});
$("#tf_cancle4").unbind('click').click(function () {
$(".Betrag4").hide();
});
@@ -151,20 +128,6 @@
$(".Betrag2").hide();
});
function setAnfrage(jsonIdArr, jsonAmountArr, jsonNameArr, jsonWeight) {
var parsedIdArr = JSON.parse(jsonIdArr);
var parsedAmountArr = JSON.parse(jsonAmountArr);
var parsedNameArr = JSON.parse(jsonNameArr);
var parsedWeight = JSON.parse(jsonWeight);
for (var i = 0; i < parsedNameArr.length; i++) {
var num = parsedAmountArr[i];
var newItem = { Name: parsedNameArr[i], ID: parsedIdArr[i], Amount: num, Category: 3 };
anfrageInv[i] = newItem;
}
$('#count4').html(parsedWeight / 1000);
drawAnfrage();
}
function switchSite(site) {
if (site != lastClass) {
if (site == "tradeClass") {
@@ -203,111 +166,8 @@
$(document).ready(function () {
mp.trigger('CEF:InventoryLoaded');
mp.trigger('CEF:getNearVehicles');
});
function setItems(jsonName, jsonID, jsonAmount, nearPlayers) {
var parsedName = JSON.parse(jsonName);
var parsedID = JSON.parse(jsonID);
var parsedAmount = JSON.parse(jsonAmount);
for (var i = 0; i < parsedName.length; i++) {
var num = parsedAmount[i];
var newItem = { Name: parsedName[i], ID: parsedID[i], Amount: num, Category: 0 };
rucksackInv[i] = newItem;
}
jsonInv = JSON.stringify(rucksackInv);
ReceiveClientInformation(jsonInv);
var parsedPlayers = JSON.parse(nearPlayers);
Players = parsedPlayers;
for (var x = 0; x < parsedPlayers.length; x++) {
$('.dropdown-content').append("<a value=" + x + ">" + parsedPlayers[x] + "</a>");
}
}
var Players = [];
function setWeight(jsonWeight) {
var parsedWeight = JSON.parse(jsonWeight);
$('#count1').html(parsedWeight / 1000);
}
function setVehiclesInv(jsonVehInv) {
var parsedVehInv = JSON.parse(jsonVehInv);
vehInvItem.push(parsedVehInv);
var vehicle = vehInvItem[0];
for (i = 0; i < vehicle.ivehName.length; i++) {
var newItem = { Name: vehicle.ivehName[i], ID: vehicle.ivehId[i], Amount: vehicle.ivehAmount[i], Category: 1 };
vehInv.push(newItem);
}
Origin.push(0);
Origin.push(vehicle.ID);
var jsonVehInv = JSON.stringify(vehInv);
$('#count2').html(vehInvItem[0].currentWeight / 1000);
RecieveVehicleInfo(jsonVehInv);
}
function RecieveVehicleInfo(json) {
var parsed = JSON.parse(json);
for (var i = 0; i < parsed.length; i++) {
var item = parsed[i];
console.log(item);
var quantity = parsed[i].Amount;
var list = document.getElementById("List4");
var pictureElement = document.createElement("img");
pictureElement.setAttribute("class", "sideicon15");
pictureElement.setAttribute("src", "img/inventory/" + item.ID + ".svg");
var redButton = document.createElement("div");
var redButtonImg = document.createElement("img");
redButton.setAttribute("class", "red");
redButton.setAttribute("onclick", "onAction(1," + item.ID + "," + item.Amount + ","+ i +");");
redButtonImg.setAttribute("src", "img/backpack/trash.svg");
redButtonImg.setAttribute("class", "redImg");
redButton.appendChild(redButtonImg);
var blueButton = document.createElement("div");
var blueButtonImg = document.createElement("img");
blueButton.setAttribute("class", "blue2");
blueButton.setAttribute("onclick", "onAction(4," + item.ID + "," + item.Amount + ","+ i +");");
blueButtonImg.setAttribute("src", "img/backpack/paper-plane.svg");
blueButtonImg.setAttribute("class", "blueImg");
blueButton.appendChild(blueButtonImg);
var listLength = list.length;
var row = 1;
if (listLength > 3) {
row = 2;
}
if (listLength > 7) {
row = 3;
}
if (listLength > 11) {
row = 4;
}
if (listLength > 15) {
row = 5;
}
if (listLength > 19) {
row = 6;
}
var Litem = document.createElement("li");
Litem.setAttribute("class", "item" + row);
Litem.appendChild(document.createTextNode(quantity + "x " + item.Name));
Litem.appendChild(pictureElement);
Litem.appendChild(redButton);
Litem.appendChild(blueButton);
list.appendChild(Litem);
}
}
var rucksackInv = [];
var handelInv = [];
var vehInv = [];
@@ -316,81 +176,43 @@
var vehInvItem = [];
function ReceiveClientInformation(json) {
var parsed = JSON.parse(json);
rucksackInv = parsed;
for (var i = 0; i < parsed.length; i++) {
var item = parsed[i];
item.Category = 0;
console.log(item);
var quantity = parsed[i].Amount;
var list = document.getElementById("List" + item.Category);
var pictureElement = document.createElement("img");
pictureElement.setAttribute("class", "sideicon15");
pictureElement.setAttribute("src", "img/inventory/" + item.ID + ".svg");
var redButton = document.createElement("div");
var redButtonImg = document.createElement("img");
redButton.setAttribute("class", "red");
redButton.setAttribute("onclick", "onAction(1," + item.ID + "," + item.Amount + "," + i + ");");
redButtonImg.setAttribute("src", "img/backpack/trash.svg");
redButtonImg.setAttribute("class", "redImg");
redButton.appendChild(redButtonImg);
var greenButton = document.createElement("div");
var greenButtonImg = document.createElement("img");
greenButton.setAttribute("class", "green");
greenButton.setAttribute("onclick", "onAction(0," + item.ID + "," + item.Amount + "," + i + ");");
greenButtonImg.setAttribute("src", "img/backpack/use.svg");
greenButtonImg.setAttribute("class", "greenImg");
greenButton.appendChild(greenButtonImg);
var blueButton = document.createElement("div");
var blueButtonImg = document.createElement("img");
blueButton.setAttribute("class", "blue");
blueButton.setAttribute("onclick", "onAction(2," + item.ID + "," + item.Amount + ", " + i + ");");
blueButtonImg.setAttribute("src", "img/backpack/paper-plane.svg");
blueButtonImg.setAttribute("class", "blueImg");
blueButton.appendChild(blueButtonImg);
var listLength = list.length;
var row = 1;
if (listLength > 3) {
row = 2;
}
if (listLength > 7) {
row = 3;
}
if (listLength > 11) {
row = 4;
}
if (listLength > 15) {
row = 5;
}
if (listLength > 19) {
row = 6;
}
var Litem = document.createElement("li");
Litem.setAttribute("class", "item" + row);
Litem.appendChild(document.createTextNode(quantity + "x " + item.Name));
Litem.appendChild(pictureElement);
Litem.appendChild(redButton);
Litem.appendChild(greenButton);
Litem.appendChild(blueButton);
list.appendChild(Litem);
function setBackpackItems(jsonItemArr) {
console.log(jsonItemArr);
var parsedItemArr = JSON.parse(jsonItemArr)
rucksackInv = [];
for (var i = 0; i < parsedItemArr.length; i++) {
var item = parsedItemArr[i];
var newItem = { Name: item.Name, ID: item.ItemId, Amount: item.Amount, Category: 0 };
rucksackInv.push(newItem);
$('#count1').html(item.Weight / 1000);
}
drawRucksack();
}
function getVehicle() {
mp.trigger("CEF:callVehicleInventory");
}
function setVehicleItems(jsonItemArr) {
var parsedItemArr = JSON.parse(jsonItemArr)
vehInv = [];
for (var i = 0; i < parsedItemArr.length; i++) {
var item = parsedItemArr[i];
var newItem = { Name: item.Name, ID: item.ItemId, Amount: item.Amount, Category: 0 };
vehInv.push(newItem);
$('#count2').html(item.Weight / 1000);
}
switchSite('vehClass');
drawVehicle();
}
var clnc = 1;
function alertGreen(JsonAmount, JsonName) {
var amount = JSON.parse(JsonAmount);
var amount = JSON.parse(JsonAmount);
var name = JSON.parse(JsonName);
var list = document.getElementById("alertbox");
var Litem = document.createElement("div");
Litem.setAttribute("class", "alert_green");
@@ -401,13 +223,13 @@
$(Litem).fadeOut(500, function () {
$(Litem).remove();
});
}, 5000);
}, 5000);
}
function alertRed(JsonAmount, JsonName) {
var amount = JSON.parse(JsonAmount);
var amount = JSON.parse(JsonAmount);
var name = JSON.parse(JsonName);
var list = document.getElementById("alertbox");
var Litem = document.createElement("div");
Litem.setAttribute("class", "alert_red");
@@ -423,7 +245,7 @@
function alertError(jsonString) {
var string = JSON.parse(jsonString);
var list = document.getElementById("alertbox");
var Litem = document.createElement("div");
Litem.setAttribute("class", "alert_red");
@@ -445,21 +267,21 @@
var list = document.getElementById("alertbox");
var Litem = document.createElement("div");
Litem.setAttribute("class", "alert_blue");
Litem.appendChild(document.createTextNode("Du hast " + amount + "x " + name + " ins "+transferInv+" transferiert."));
Litem.appendChild(document.createTextNode("Du hast " + amount + "x " + name + " ins " + transferInv + " transferiert."));
$(Litem).hide().appendTo(list).fadeIn(500);
$(Litem).fadeIn(500);
setTimeout(function () {
$(Litem).fadeOut(500, function () {
$(Litem).remove();
});
}, 5000);
}, 5000);
}
function removeItems(JsonId, JsonAmount) {
var amount = JSON.parse(JsonAmount);
var id = JSON.parse(JsonId);
console.log("start : " + amount +" " + id);
console.log("start : " + amount + " " + id);
for (var i = 0; i < rucksackInv.length; i++) {
console.log(i);
if (rucksackInv[i].ID == id) {
@@ -471,14 +293,13 @@
rucksackInv.splice(i, 1);
}
drawRucksack();
return;
}
}
}
}
function onAction(action, id, ammount, i) {
$(".Betrag").hide();
@@ -494,11 +315,9 @@
if ($('#tf_zahl').val() < ammount && ammount > 0) {
mp.trigger("CEF:useItem", JSON.stringify("drop"), JSON.stringify($('#tf_zahl').val()), JSON.stringify(rucksackInv[i].ID))
} else if ($('#tf_zahl').val() >= ammount) {
mp.trigger("CEF:useItem", JSON.stringify("drop"), JSON.stringify(ammount), JSON.stringify(rucksackInv[i].ID))
mp.trigger("CEF:useItem", JSON.stringify("drop"), JSON.stringify(ammount), JSON.stringify(rucksackInv[i].ID))
}
$(".Betrag").hide();
drawRucksack();
drawVehicle();
event.preventDefault()
event.stopPropagation()
});
@@ -507,209 +326,33 @@
{
$(".Betrag2").show();
var Copy = Object.assign({}, rucksackInv[i]);
$("#tf_submitZahlToHandel").unbind('click').click(function () {
var y = parseInt($('#tf_zahl2').val(), 10);
if ($('#tf_zahl2').val() < ammount && ammount > 0) {
for (x = 0; x < handelInv.length; x++) {
if (handelInv[x].ID == Copy.ID) {
handelInv[x].Amount += y;
rucksackInv[i].Amount -= y;
$(".Betrag2").hide();
drawHandel();
drawRucksack();
event.preventDefault()
event.stopPropagation()
return;
}
}
handelInv.push(Copy);
handelInv[handelInv.length - 1].Amount = y;
handelInv[handelInv.length - 1].Category = 2;
rucksackInv[i].Amount -= y;
} else if ($('#tf_zahl2').val() >= ammount) {
for (x = 0; x < handelInv.length; x++) {
if (handelInv[x].ID == Copy.ID) {
handelInv[x].Amount += y;
rucksackInv.splice(i, 1);
$(".Betrag2").hide();
drawHandel();
drawRucksack();
event.preventDefault()
event.stopPropagation()
return;
}
}
handelInv.push(Copy);
handelInv[handelInv.length - 1].Category = 2;
rucksackInv.splice(i, 1);
}
$(".Betrag2").hide();
drawHandel();
drawRucksack();
event.preventDefault()
event.stopPropagation()
});
$("#tf_submitZahlToVehicle").unbind('click').click(function () {
if (Origin.length < 2) {
$(".Betrag2").hide();
drawVehicle();
drawRucksack();
event.preventDefault()
event.stopPropagation()
return;
}
Origin[0] = 0;
var y = parseInt($('#tf_zahl2').val(), 10);
if ($('#tf_zahl2').val() < ammount && ammount > 0) {
for (x = 0; x < vehInv.length; x++) {
if (vehInv[x].ID == Copy.ID) {
vehInv[x].Amount += y;
rucksackInv[i].Amount -= y;
$(".Betrag2").hide();
mp.trigger("CEF:saveVehicleTransfer",0, JSON.stringify(Origin), JSON.stringify(rucksackInv[i].ID), JSON.stringify(rucksackInv[i].Amount), JSON.stringify(y));
drawVehicle();
drawRucksack();
event.preventDefault()
event.stopPropagation()
return;
}
}
vehInv.push(Copy);
vehInv[vehInv.length - 1].Amount = y;
vehInv[vehInv.length - 1].Category = 2;
rucksackInv[i].Amount -= y;
mp.trigger("CEF:saveVehicleTransfer",0, JSON.stringify(Origin), JSON.stringify(rucksackInv[i].ID), JSON.stringify(rucksackInv[i].Amount), JSON.stringify(y));
mp.trigger("CEF:backpackToVehicle", JSON.stringify(rucksackInv[i].ID), JSON.stringify(y));
} else if ($('#tf_zahl2').val() >= ammount) {
for (x = 0; x < vehInv.length; x++) {
if (vehInv[x].ID == Copy.ID) {
vehInv[x].Amount += y;
rucksackInv.splice(i, 1);
$(".Betrag2").hide();
mp.trigger("CEF:saveVehicleTransfer",0, JSON.stringify(Origin), JSON.stringify(Copy.ID), JSON.stringify(0), JSON.stringify(ammount));
drawVehicle();
drawRucksack();
event.preventDefault()
event.stopPropagation()
return;
}
}
vehInv.push(Copy);
vehInv[vehInv.length - 1].Category = 2;
rucksackInv.splice(i, 1);
mp.trigger("CEF:saveVehicleTransfer",0, JSON.stringify(Origin), JSON.stringify(Copy.ID), JSON.stringify(0), JSON.stringify(ammount));
mp.trigger("CEF:backpackToVehicle", JSON.stringify(rucksackInv[i].ID), JSON.stringify(ammount));
}
$(".Betrag2").hide();
drawVehicle();
drawRucksack();
event.preventDefault()
event.stopPropagation()
});
}
if (action == 3) {
$(".Betrag3").show();
var Copy = Object.assign({}, handelInv[i]);
$("#tf_submitZahl3").unbind('click').click(function () {
var y = parseInt($('#tf_zahl3').val(), 10);
if ($('#tf_zahl3').val() < ammount && ammount > 0) {
for (x = 0; x < rucksackInv.length; x++) {
if (rucksackInv[x].ID == Copy.ID) {
rucksackInv[x].Amount += y;
handelInv[i].Amount -= y;
$(".Betrag3").hide();
drawHandel();
drawRucksack();
event.preventDefault()
event.stopPropagation()
return;
}
}
rucksackInv.push(Copy);
rucksackInv[rucksackInv.length - 1].Amount = y;
rucksackInv[rucksackInv.length - 1].Category = 0;
handelInv[i].Amount -= y;
} else if ($('#tf_zahl3').val() >= ammount) {
for (x = 0; x < rucksackInv.length; x++) {
if (rucksackInv[x].ID == Copy.ID) {
rucksackInv[x].Amount += ammount;
handelInv.splice(i, 1);
$(".Betrag3").hide();
drawHandel();
drawRucksack();
event.preventDefault()
event.stopPropagation()
return;
}
}
rucksackInv.push(Copy);
rucksackInv[rucksackInv.length - 1].Category = 0;
handelInv.splice(i, 1);
}
$(".Betrag3").hide();
drawHandel();
drawRucksack();
event.preventDefault()
event.stopPropagation()
});
}
if (action == 4) {
$(".Betrag4").show();
var Copy = Object.assign({}, vehInv[i]);
$("#tf_submitZahl4").unbind('click').click(function () {
Origin[0] = 1;
var y = parseInt($('#tf_zahl4').val(), 10);
if ($('#tf_zahl4').val() < ammount && ammount > 0) {
for (x = 0; x < rucksackInv.length; x++) {
if (rucksackInv[x].ID == Copy.ID) {
rucksackInv[x].Amount += y;
vehInv[i].Amount -= y;
$(".Betrag2").hide();
mp.trigger("CEF:saveVehicleTransfer",1, JSON.stringify(Origin), JSON.stringify(Copy.ID), JSON.stringify(vehInv[i].Amount), JSON.stringify(y));
drawRucksack();
drawVehicle();
event.preventDefault()
event.stopPropagation()
return;
}
}
console.log(rucksackInv);
rucksackInv.push(Copy);
rucksackInv[rucksackInv.length - 1].Amount = y;
rucksackInv[rucksackInv.length - 1].Category = 2;
vehInv[i].Amount -= y;
console.log(rucksackInv);
mp.trigger("CEF:saveVehicleTransfer",1, JSON.stringify(Origin), JSON.stringify(Copy.ID), JSON.stringify(vehInv[i].Amount), JSON.stringify(y));
mp.trigger("CEF:vehicleToBackpack", JSON.stringify(vehInv[i].ID), JSON.stringify(y));
} else if ($('#tf_zahl4').val() >= ammount) {
for (x = 0; x < rucksackInv.length; x++) {
if (rucksackInv[x].ID == Copy.ID) {
rucksackInv[x].Amount += ammount;
vehInv.splice(i, 1);
$(".Betrag2").hide();
mp.trigger("CEF:saveVehicleTransfer",1, JSON.stringify(Origin), JSON.stringify(Copy.ID), JSON.stringify(0), JSON.stringify(ammount));
drawRucksack();
drawVehicle();
event.preventDefault()
event.stopPropagation()
return;
}
}
rucksackInv.push(Copy);
rucksackInv[rucksackInv.length - 1].Amount = ammount;
rucksackInv[rucksackInv.length - 1].Category = 2;
vehInv.splice(i, 1);
mp.trigger("CEF:saveVehicleTransfer",1, JSON.stringify(Origin), JSON.stringify(Copy.ID), JSON.stringify(0), JSON.stringify(ammount));
mp.trigger("CEF:vehicleToBackpack", JSON.stringify(vehInv[i].ID), JSON.stringify(ammount));
}
$(".Betrag4").hide();
drawRucksack();
drawVehicle();
$(".Betrag4").hide();
event.preventDefault()
event.stopPropagation()
});
@@ -736,7 +379,6 @@
pictureElement.setAttribute("class", "sideicon15");
pictureElement.setAttribute("src", "img/inventory/" + item.ID + ".svg");
var blueButton = document.createElement("div");
var blueButtonImg = document.createElement("img");
blueButton.setAttribute("class", "blue3");
@@ -878,16 +520,15 @@
var redButton = document.createElement("div");
var redButtonImg = document.createElement("img");
redButton.setAttribute("class", "red");
redButton.setAttribute("onclick", "onAction(1," + item.ID + "," + item.Amount + ","+ i +");");
redButton.setAttribute("onclick", "onAction(1," + item.ID + "," + item.Amount + "," + i + ");");
redButtonImg.setAttribute("src", "img/backpack/trash.svg");
redButtonImg.setAttribute("class", "redImg");
redButton.appendChild(redButtonImg);
var blueButton = document.createElement("div");
var blueButtonImg = document.createElement("img");
blueButton.setAttribute("class", "blue2");
blueButton.setAttribute("onclick", "onAction(4," + item.ID + "," + item.Amount + ","+ i +");");
blueButton.setAttribute("onclick", "onAction(4," + item.ID + "," + item.Amount + "," + i + ");");
blueButtonImg.setAttribute("src", "img/backpack/paper-plane.svg");
blueButtonImg.setAttribute("class", "blueImg");
blueButton.appendChild(blueButtonImg);
@@ -943,7 +584,6 @@
pictureElement.setAttribute("class", "sideicon15");
pictureElement.setAttribute("src", "img/inventory/" + item.ID + ".svg");
var listLength = list.length;
var row = 1;
@@ -974,8 +614,6 @@
}
}
</script>
</body>
</html>
</html>

View File

@@ -1,4 +1,4 @@
import { IEntity, IPlayer, IPlayerPool, IVehicle, IVehiclePool, VehicleSeat, EntityType } from "../../game";
import { IEntity, IPlayer, IEntityAttachments, IEntityAttachmentPool, IPlayerPool, IVehicle, IVehiclePool, VehicleSeat, EntityType } from "../../game";
import { parseJson } from "../../util";
class RageEntity implements IEntity {
@@ -8,6 +8,10 @@ class RageEntity implements IEntity {
return this.entity.id;
}
get remoteId(): any {
return this.entity.remoteId;
}
constructor(entity: EntityMp) {
this.entity = entity;
}
@@ -32,6 +36,8 @@ class RageEntity implements IEntity {
class RagePlayer extends RageEntity implements IPlayer {
private player: PlayerMp;
public __attachments: any[];
public __attachmentObjects: any[];
get name(): string {
return this.player.name;
@@ -52,6 +58,78 @@ class RagePlayer extends RageEntity implements IPlayer {
}
}
class RageAttachments implements IEntityAttachments {
remoteId: any;
public __attachments: any[];
public __attachmentObjects: any[];
constructor(entity: IEntity, attachments: any[], attachmentObjects: any[]) {
this.remoteId = entity.remoteId;
this.__attachments = attachments;
this.__attachmentObjects = attachmentObjects;
}
}
class RageEntityAttachmentPool implements IEntityAttachmentPool {
public attachmentPool: IEntityAttachments[];
remove(entity: IEntity) {
for (let obj of this.attachmentPool.keys()) {
if (entity.remoteId == this.attachmentPool[obj].remoteId) delete this.attachmentPool[obj];
}
}
find(entity: EntityMp): IEntityAttachments {
for (let i of this.attachmentPool.keys()) {
let pool = this.attachmentPool[i];
for (let obj of pool.__attachmentObjects) {
if (entity == obj) { return pool;}
}
}
return null;
}
set(entity: IEntity, attachments: any[], attachmentObjects: any[]): IEntityAttachments {
if (!this.attachmentPool) {
let e = new RageAttachments(entity, attachments, attachmentObjects);
this.attachmentPool = [];
this.attachmentPool.push(e);
return e;
}
for (let obj of this.attachmentPool.keys()) {
if (entity.remoteId == this.attachmentPool[obj].remoteId) { this.remove(entity); }
}
let e = new RageAttachments(entity, attachments, attachmentObjects);
this.attachmentPool.push(e);
return e;
}
at(remoteId: any): IEntityAttachments {
if (!this.attachmentPool) {
return null;
}
for (let obj of this.attachmentPool.keys()) {
if (remoteId == this.attachmentPool[obj].remoteId) { return this.attachmentPool[obj]; }
}
return null;
}
get(entity: IEntity): IEntityAttachments {
if (!this.attachmentPool) {
return null;
}
for (let obj of this.attachmentPool.keys()) {
if (entity.remoteId == this.attachmentPool[obj].remoteId) { return this.attachmentPool[obj]; }
}
return null;
}
}
class RagePlayerPool implements IPlayerPool {
get local(): IPlayer {
return new RagePlayer(mp.players.local);
@@ -103,14 +181,14 @@ class RageVehiclePool implements IVehiclePool {
fn(new RageVehicle(e));
})
}
}
export {
RageEntity,
RagePlayer,
RagePlayerPool,
RageAttachments,
RageEntityAttachmentPool,
RageVehicle,
RageVehiclePool,
}
}

View File

@@ -1,12 +1,12 @@
import { IGame, IUi, IEvents, IPlayerPool, IVehiclePool } from "../../game";
import { IGame, IUi, IEvents, IPlayerPool, IVehiclePool, IEntityAttachmentPool } from "../../game";
import RageEvents from "./events";
import RageUi from "./ui";
import { RagePlayerPool, RageVehiclePool } from "./entities";
import { RagePlayerPool, RageVehiclePool, RageEntityAttachmentPool } from "./entities";
export default class RageGame implements IGame {
players: IPlayerPool = new RagePlayerPool();
vehicles: IVehiclePool = new RageVehiclePool();
attachments: IEntityAttachmentPool = new RageEntityAttachmentPool();
events: IEvents = new RageEvents;
ui: IUi = new RageUi;

View File

@@ -5,6 +5,7 @@
players: IPlayerPool;
vehicles: IVehiclePool;
attachments: IEntityAttachmentPool;
disableDefaultEngineBehaviour(): void;
}
@@ -41,6 +42,7 @@ interface IBrowser {
interface IEntity {
id: number;
remoteId: any;
type: EntityType;
getSharedData<T>(key: string): T;
}
@@ -51,6 +53,12 @@ interface IPlayer extends IEntity {
vehicle: IVehicle;
}
interface IEntityAttachments {
remoteId: any;
__attachments: any[];
__attachmentObjects: any[];
}
interface IVehicle extends IEntity {
isSeatFree(seat: VehicleSeat): boolean;
setEngineStatus(status: boolean, instantly: boolean, otherwise: boolean);
@@ -67,8 +75,16 @@ interface IPlayerPool extends IEntityPool<IPlayer> {
local: IPlayer;
}
interface IVehiclePool extends IEntityPool<IVehicle> {
interface IEntityAttachmentPool {
attachmentPool: IEntityAttachments[];
find(entity: EntityMp): IEntityAttachments;
remove(entity: IEntity): void;
set(entity: IEntity, attachments: any[], attachmentObjects: any[]): IEntityAttachments;
at(handle: any): IEntityAttachments;
get(entity: IEntity): IEntityAttachments;
}
interface IVehiclePool extends IEntityPool<IVehicle> {
}
enum EntityType {
@@ -122,6 +138,8 @@ export {
IBrowser,
IPlayer,
IEntityAttachments,
IEntityAttachmentPool,
IVehicle,
IEntity,
IEntityPool,

View File

@@ -209,6 +209,15 @@ taximeterInput(globalData);
import refuseCollector from './Jobs/RefuseCollector';
refuseCollector();
import PedCreator from './Ped/PedCreator';
PedCreator();
import attachmentManager from './util/attachmentMngr';
attachmentManager(game);
import relativeVector from './util/relativevector';
relativeVector();
require('./Gui/policedepartment');
interface VehicleData {
@@ -218,4 +227,6 @@ interface VehicleData {
export {
VehicleData
}
}

View File

@@ -1,44 +1,32 @@

export default function inventory(globalData: IGlobalData): void {
export default function inventory(globalData: IGlobalData): void {
var invBrowser: BrowserMp = null;
var itemIdArr;
var itemAmountArr;
var invWeight;
var itemNameArr;
var itemArr;
var offerItemArr;
var tradeItemArr;
var vehItemArr;
var ivehArr;
var loaded = false;
var Players;
mp.events.add('setVehiclesInventory', (vehInvArr) => {
ivehArr = vehInvArr;
invBrowser.execute(`setVehiclesInv('${JSON.stringify(ivehArr)}');`);
});
mp.events.add('showVehInventory', () => {
invBrowser.execute(`execVehInv();`);
});
var open = false;
mp.events.add('inventoryShow', (iWeight, iNameArr, iAmountArr, iIdArr, playersArr) => {
mp.events.add('inventoryShow', () => {
if (invBrowser !== null) {
invBrowser.destroy()
invBrowser = null;
globalData.InInput = false;
loaded = false;
mp.gui.cursor.show(false, false);
return;
}
if (!globalData.InInput) {
globalData.InInput = true;
mp.gui.cursor.show(true, true);
itemArr = [];
vehItemArr = [];
invBrowser = mp.browsers.new('package://assets/html/inventory/inventory.html');
Players = playersArr;
itemIdArr = iIdArr;
itemAmountArr = iAmountArr;
itemNameArr = iNameArr;
invWeight = iWeight;
}
}
});
var offer = 0;
@@ -55,22 +43,42 @@ export default function inventory(globalData: IGlobalData): void {
}
});
mp.events.add("addTradeItems", (itemId, itemAmount, itemName, weight) => {
tradeItemID = JSON.stringify(itemId);
tradeItemAmount = JSON.stringify(itemAmount);
tradeItemName = JSON.stringify(itemName);
tradeItemWeight = JSON.stringify(weight);
if (invBrowser != null)
invBrowser.execute(`setAnfrage('${tradeItemID}','${tradeItemAmount}','${tradeItemName}','${tradeItemWeight}');`);
mp.events.addDataHandler("backpackItems", (entity: EntityMp, jsonItemArr) => {
if (entity.handle != mp.players.local.handle) return;
itemArr = JSON.parse(jsonItemArr);
if (loaded)
invBrowser.execute(`setBackpackItems('${JSON.stringify(itemArr)}',true)`);
});
mp.events.add("CEF:saveVehicleTransfer", (val, jsonOrigin, jsonInvID, jsonInvAmount, jsonVehAmount) => {
if (val == 0) {
mp.events.callRemote('saveInventory', jsonInvID, jsonInvAmount, jsonOrigin, jsonVehAmount);
} else if(val == 1){
mp.events.callRemote('saveVehicleInventory', jsonInvID, jsonInvAmount, jsonOrigin, jsonVehAmount);
mp.events.addDataHandler("vehicleItems", (entity: EntityMp, jsonItemArr) => {
if (entity != mp.players.local) return;
vehItemArr = JSON.parse(jsonItemArr);
if (loaded)
invBrowser.execute(`setVehicleItems('${JSON.stringify(vehItemArr)}')`);
});
mp.events.add("CEF:InventoryLoaded", () => {
invBrowser.execute(`setBackpackItems('${JSON.stringify(itemArr)}')`);
if (vehItemArr.length != 0) {
invBrowser.execute(`setVehicleItems('${JSON.stringify(vehItemArr)}')`);
}
//invBrowser.execute(`setTradeItems('${JSON.stringify(tradeItemArr)}')`);
//invBrowser.execute(`setOfferItems('${JSON.stringify(offerItemArr)}')`);
loaded = true;
});
mp.events.add("CEF:callVehicleInventory", () => {
mp.events.callRemote("CLIENT:getVehicleInventory")
});
mp.events.add("CEF:backpackToVehicle", (jsonItemId, jsonAmount) => {
mp.events.callRemote('transferToVehicle', jsonItemId, jsonAmount);
});
mp.events.add("CEF:vehicleToBackpack", (jsonItemId, jsonAmount) => {
mp.events.callRemote('transferToBackpack', jsonItemId, jsonAmount);
});
mp.events.add("CEF:useItem", (type, amount, id) => {
@@ -111,22 +119,6 @@ export default function inventory(globalData: IGlobalData): void {
}
});
mp.events.add("CEF:InventoryLoaded", () => {
if (offer == 1) {
invBrowser.execute(`changeTradeStatus('${JSON.stringify(offer)}')`);
invBrowser.execute(`setAnfrage('${tradeItemID}','${tradeItemAmount}','${tradeItemName}','${tradeItemWeight}');`);
}
invBrowser.execute(`setItems('${JSON.stringify(itemNameArr)}','${JSON.stringify(itemIdArr)}','${JSON.stringify(itemAmountArr)}','${JSON.stringify(Players)}');`);
invBrowser.execute(`setWeight('${JSON.stringify(invWeight)}');`);
});
mp.events.add("CEF:getNearVehicles", () => {
mp.events.callRemote('getNearVehicles');
});
mp.events.add("CEF:acceptTrade", () => {
if (invBrowser !== null) {
@@ -135,7 +127,6 @@ export default function inventory(globalData: IGlobalData): void {
invBrowser = null;
mp.gui.cursor.show(false, false);
}
});
mp.events.add("CEF:declineTrade", () => {
@@ -169,5 +160,4 @@ export default function inventory(globalData: IGlobalData): void {
}
}
});
}

View File

@@ -1,7 +1,4 @@

export default function gangwarHandle(globalData: IGlobalData) {
export default function gangwarHandle(globalData: IGlobalData) {
function inside(point, vs) {
let x = point[0],
y = point[1];
@@ -35,7 +32,6 @@ export default function gangwarHandle(globalData: IGlobalData) {
};
var Gangturf = class {
name: string;
id: number;
range: number;
@@ -70,12 +66,11 @@ export default function gangwarHandle(globalData: IGlobalData) {
}
_setup(name, id, x, y, range, color, rot, owner, edit, vector, value) {
var self = this;
self.name = name;
self.id = id;
self.range = range;
self.setColor(owner);
self.setColor(owner);
self.x = x;
self.y = y;
self.rotation = rot;
@@ -97,7 +92,7 @@ export default function gangwarHandle(globalData: IGlobalData) {
} else {
self.leaderBlipVector = null;
}
self.leaderColShape = null;
}
@@ -127,7 +122,6 @@ export default function gangwarHandle(globalData: IGlobalData) {
loadArea() {
var self = this;
self.blip = mp.game.ui.addBlipForRadius(self.x, self.y, 1, self.range);
mp.game.invoke(Natives.SET_BLIP_SPRITE, self.blip, 5);
@@ -137,25 +131,21 @@ export default function gangwarHandle(globalData: IGlobalData) {
self._colshape = mp.colshapes.newCircle(self.x, self.y, self.range * 1.5);
}
render() {
var self = this;
if (self._colshape) {
if (self.edit == true) {
let vector3 = mp.players.local.getRotation(2);
self.rotation = Math.round(vector3.z);
//self.blip.setPosition(mp.players.local.position.x, mp.players.local.position.y, 1);
mp.game.invoke(Natives.SET_BLIP_COORDS, self.blip, mp.players.local.position.x, mp.players.local.position.y, 1);
self.x = mp.players.local.position.x;
self.y = mp.players.local.position.y;
}
//self.blip.setRotation(self.rotation);
mp.game.invoke(Natives.SET_BLIP_ROTATION, self.blip, self.rotation);
mp.game.invoke(Natives.SET_BLIP_ROTATION, self.blip, self.rotation);
}
if (self._status == "attack" || self.edit == true) {
if (self._colshape) {
if (mp.game.gameplay.getDistanceBetweenCoords(mp.players.local.position.x, mp.players.local.position.y, 0, self.x, self.y, 0, true) < self.range * 1.5) {
@@ -191,7 +181,6 @@ export default function gangwarHandle(globalData: IGlobalData) {
mp.game.graphics.drawLine(bottom_left.x, bottom_left.y, i, top_left.x, top_left.y, i, 255, 0, 0, 255);
}
} else {
/*
let a = 0;
for (var i = z; i < z + 1; i += 0.001) {
@@ -202,10 +191,8 @@ export default function gangwarHandle(globalData: IGlobalData) {
a += 0.001
}
*/
}
}
}
if (self.isInsideArea()) {
mp.game.graphics.drawText(self.name, [self.x, self.y, mp.players.local.position.z + 20], {
@@ -215,7 +202,6 @@ export default function gangwarHandle(globalData: IGlobalData) {
outline: true,
centre: true
});
}
}
}
@@ -233,11 +219,9 @@ export default function gangwarHandle(globalData: IGlobalData) {
}
}
}
}
startGangWar() {
startGangWar() {
var self = this;
if (self._status == "normal") {
let dist = mp.game.gameplay.getDistanceBetweenCoords(mp.players.local.position.x, mp.players.local.position.y, 0, self.leaderBlipVector.x, self.leaderBlipVector.y, self.leaderBlipVector.z, false);
@@ -263,7 +247,7 @@ export default function gangwarHandle(globalData: IGlobalData) {
if (status == "normal") {
self._status = "normal";
//self.blip.setFlashes(false);
mp.game.invoke(Natives.SET_BLIP_FLASHES, self.blip, false);
mp.game.invoke(Natives.SET_BLIP_FLASHES, self.blip, false);
return;
}
if (status == "conquered") {
@@ -287,7 +271,6 @@ export default function gangwarHandle(globalData: IGlobalData) {
self.attackBlip = mp.game.ui.addBlipForCoord(self.x, self.y, 0);
mp.game.invoke(Natives.SET_BLIP_SPRITE, self.attackBlip, 378);
mp.game.invoke(Natives.SET_BLIP_AS_SHORT_RANGE, self.attackBlip, false);
} else if (!bool) {
mp.game.invoke(Natives.SET_BLIP_SPRITE, self.attackBlip, 5);
}
@@ -310,20 +293,18 @@ export default function gangwarHandle(globalData: IGlobalData) {
self.setLeaderColShape();
mp.game.invoke(Natives.SET_BLIP_SPRITE, self.leaderBlip, 437);
mp.game.invoke(Natives.SET_BLIP_AS_SHORT_RANGE, self.leaderBlip, false);
}
}
}
setLeaderColShape() {
var self = this;
let newVector = new mp.Vector3(self.leaderBlipVector.x, self.leaderBlipVector.y, self.leaderBlipVector.z - 2)
self.leaderColShape = mp.markers.new(1, newVector, 2, {
color: [255, 255, 0, 150],
visible: true,
dimension: 0
});
let newVector = new mp.Vector3(self.leaderBlipVector.x, self.leaderBlipVector.y, self.leaderBlipVector.z - 2)
self.leaderColShape = mp.markers.new(1, newVector, 2, {
color: [255, 255, 0, 150],
visible: true,
dimension: 0
});
}
isTurfArea(shape) {
@@ -335,7 +316,7 @@ export default function gangwarHandle(globalData: IGlobalData) {
}
check() {
var self = this
var self = this
if (self._entered == true) {
if (!self.isInsideArea() || (self.isNearGround() == false)) {
self._entered = false;
@@ -343,7 +324,7 @@ export default function gangwarHandle(globalData: IGlobalData) {
}
}
}
enter() {
var self = this;
self._timerCheck = setInterval(function () {
@@ -354,8 +335,7 @@ export default function gangwarHandle(globalData: IGlobalData) {
mp.game.audio.playSoundFrontend(1, "Enter_Capture_Zone", "DLC_Apartments_Drop_Zone_Sounds", true);
mp.game.graphics.stopScreenEffect("MinigameTransitionIn");
mp.game.graphics.startScreenEffect("MinigameTransitionOut", 500, false);
}
}
mp.events.callRemote("Gangarea:Enter", JSON.stringify(self.id));
}
} else if (self._entered == true) {
@@ -364,7 +344,7 @@ export default function gangwarHandle(globalData: IGlobalData) {
if (self._status === "attack") {
mp.game.audio.playSoundFrontend(1, "Exit_Capture_Zone", "DLC_Apartments_Drop_Zone_Sounds", true);
mp.game.graphics.startScreenEffect("MinigameTransitionIn", 500, false);
}
}
mp.events.callRemote("Gangarea:Leave", JSON.stringify(self.id));
}
}
@@ -374,7 +354,7 @@ export default function gangwarHandle(globalData: IGlobalData) {
leave() {
var self = this;
clearInterval(self._timerCheck);
self.check();
}
isNearGround() {
@@ -475,7 +455,7 @@ export default function gangwarHandle(globalData: IGlobalData) {
while (mp.game.invoke(Natives.DOES_BLIP_EXIST, last_blip)) {
mp.game.invoke(Natives.SET_BLIP_SPRITE, last_blip, -1);
mp.game.ui.removeBlip(last_blip);
mp.game.ui.removeBlip(last_blip);
last_blip = mp.game.invoke(Natives.GET_NEXT_BLIP_INFO_ID, 5);
x++;
}
@@ -499,7 +479,7 @@ export default function gangwarHandle(globalData: IGlobalData) {
mp.gui.chat.push("DEBUG: Attack blips not removed: " + y);
mp.gui.chat.push("DEBUG: LeaderBlips blips not removed: " + z);
}
mp.events.add('GangAreas:Create', (turfsJSON) => {
var turfs = JSON.parse(turfsJSON);
if (gangturfs.length > 0) {
@@ -512,9 +492,9 @@ export default function gangwarHandle(globalData: IGlobalData) {
turf.leaderColShape = null;
}
if (turf._marker)
if (turf.blip != null) {
mp.game.ui.removeBlip(turf.blip);
}
if (turf.blip != null) {
mp.game.ui.removeBlip(turf.blip);
}
if (turf.leaderBlip != null) {
mp.game.ui.removeBlip(turf.leaderBlip);
}
@@ -525,7 +505,6 @@ export default function gangwarHandle(globalData: IGlobalData) {
}
clearBlips();
if (turfs.length > 0) {
gangturfs = [];
turfs.forEach(function (turf) {
if (turf.Id != undefined) {
@@ -543,9 +522,8 @@ export default function gangwarHandle(globalData: IGlobalData) {
mp.events.add('ADMIN:SetTurf', (name) => {
gangturfs[gangturfs.length - 1].edit = false;
if (gangturfs[gangturfs.length - 1].id == -1) {
mp.events.callRemote("SERVER:SetTurf", JSON.stringify(gangturfs[gangturfs.length - 1].x), JSON.stringify(gangturfs[gangturfs.length - 1].y), JSON.stringify(gangturfs[gangturfs.length - 1].rotation), JSON.stringify(gangturfs[gangturfs.length - 1].range), name);
}
}
});
mp.events.add('ADMIN:DeleteTurf', () => {
@@ -581,13 +559,13 @@ export default function gangwarHandle(globalData: IGlobalData) {
mp.events.add('CLIENT:Turf_LoadLeaderBlip', () => {
gangturfs.forEach(function (turf) {
turf.setLeaderBlip(false);
turf.setLeaderBlip(false);
});
});
mp.events.add('ADMIN:Turf_CreateLeaderBlip', () => {
gangturfs.forEach(function (turf) {
if (turf._entered == true) {
if (turf._entered == true) {
turf.setLeaderBlip(true);
}
});
@@ -596,7 +574,7 @@ export default function gangwarHandle(globalData: IGlobalData) {
mp.events.add('CLIENT:StartGangwar', () => {
gangturfs.forEach(function (turf) {
if (turf._entered == true) {
turf.startGangWar();
turf.startGangWar();
}
});
});