Fix crash on Item move (Hopefully)

This commit is contained in:
VegaZ
2019-05-11 23:50:11 +02:00
parent 233e5c02ef
commit 12697dc6e8

View File

@@ -1,6 +1,9 @@
import InputHelper from '../../inputhelper';
export default function inventory(globalData: GlobalData) {
var q;
var qw = 0;
var show = false; //ob das Inventar dem Spieler gezeigt wird.
var showAdmin = false; //ob das Inventar eines Spielers dem Admin gezeigt wird
@@ -196,6 +199,18 @@ export default function inventory(globalData: GlobalData) {
if (show === true) {
pos = mp.gui.cursor.position;
for (q = 0; q < items.length; q++) {
mp.game.graphics.drawText("[" + items[q][0] + "]" + "[" + items[q][2] + "]" + "[" + items[q][3] + "]" + "[" + items[q][4] + "]" + "[" + items[q][5] + "]", [0.1, 0.4 + qw], {
//mp.game.graphics.drawText("(MOIN)", [0.1, 0.4 + qw], {
font: 4,
color: [255, 255, 255, 254],
scale: [0.4, 0.4],
outline: true,
centre: false
});
qw += 0.025;
}
mp.game.graphics.set2dLayer(1); //#
mp.game.graphics.drawRect(rxC, ryC, 0.45, 0.7, 255, 255, 255, 200); //INVENTARHINTERGRUND
@@ -480,6 +495,7 @@ export default function inventory(globalData: GlobalData) {
//});
////----------------------------------------------------------DEBUG END
}
qw = 0;
if (showAdmin === true) {
pos = mp.gui.cursor.position;
@@ -1010,6 +1026,7 @@ export default function inventory(globalData: GlobalData) {
items.push([items[dragItem][0], items[dragItem][1], items[dragItem][2], "1", actFreeSlot.toString(), "-1"]);
if (items[hoverItem][3] === 0) {
items[hoverItem][4] = "-1";
items.splice(hoverItem, 1);
}
} else {
items.push([tradeItems[dragItem][0], tradeItems[dragItem][1], tradeItems[dragItem][2], "1", actFreeSlot.toString(), "-1"]);