add onlinewanteds in factionmenü

This commit is contained in:
michael.reiswich
2021-01-29 19:54:48 +01:00
parent 42b294d805
commit 88e7df88c2
6 changed files with 171 additions and 1 deletions

View File

@@ -40,6 +40,7 @@ export default function factionInteraction(globalData: IGlobalData) {
//LSPD
let ticketTaskMenuLSPD;
let pointsTaskMenuLSPD;
let wantedsMenuLSPD
if (userFactionId == 1 || userFactionId == 3) {
if (isDuty) {
mp.gui.chat.activate(false);
@@ -53,6 +54,9 @@ export default function factionInteraction(globalData: IGlobalData) {
pointsTaskMenuLSPD = new UIMenuItem("Strafpunkte verteilen", "Einem Spieler Strafpunkte verteilen.");
factionInteractionMenu.AddItem(pointsTaskMenuLSPD);
wantedsMenuLSPD = new UIMenuItem("Verbrecher Liste");
factionInteractionMenu.AddItem(wantedsMenuLSPD);
/*TaskMenuLSPD = new UIMenuItem("");
TaskMenuLSPD.SetRightLabel("");
factionInteractionMenu.AddItem(TaskMenuLSPD);*/ //weiteres
@@ -100,6 +104,12 @@ export default function factionInteraction(globalData: IGlobalData) {
mp.events.call("CLIENT:InteractionMenu_LSPD_Points", name);
globalData.InInput = false;
});
break
case wantedsMenuLSPD:
factionInteractionMenu.Visible = false;
mp.gui.chat.activate(true);
globalData.InMenu = false;
mp.events.callRemote("CLIENT:wantedlist");
break;
}
});
@@ -159,11 +169,51 @@ export default function factionInteraction(globalData: IGlobalData) {
});
});
var wantedlistBrowser: BrowserMp = null;
var wList;
mp.events.add("showWantedlist", (playersJson) => {
if (wantedlistBrowser !== null) {
wantedlistBrowser.destroy();
wantedlistBrowser = null;
globalData.InInput = false;
mp.gui.cursor.show(false, false);
mp.gui.chat.activate(true);
}
else if (!globalData.InInput) {
globalData.InInput = true;
wantedlistBrowser = mp.browsers.new('package://assets/html/Wantedlist/wanteds.html');
mp.gui.chat.activate(false);
mp.gui.cursor.show(true, true);
wList = JSON.parse(playersJson);
wList.forEach((player) => {
wantedlistBrowser.execute(`ad_row('${JSON.stringify(player.Id)}','${JSON.stringify(player.Name)}','${JSON.stringify(player.wanted)}');`);
});
}
});
mp.events.add("removeWantedlist", () => {
if (wantedlistBrowser == null) {
return;
}
else if (globalData.InInput) {
wantedlistBrowser.destroy();
wantedlistBrowser = null;
globalData.InInput = false;
mp.gui.cursor.show(false, false);
mp.gui.chat.activate(true);
}
});
//Medic
mp.events.add("showFactionInteractionMedic", (userFactionId, isDuty, userFactionName, isFactionLeader, reviveTaskCountMedic, healTaskCountMedic, fireTaskCountMedic) => {
mp.gui.chat.activate(false);
globalData.InMenu = true;
//Medic
var rPM = ((reviveTaskCountMedic === "0") ? "~r~" : "~g~");
var hPM = ((healTaskCountMedic === "0") ? "~r~" : "~g~");
var fPM = ((fireTaskCountMedic === "0") ? "~r~" : "~g~");

View File

@@ -0,0 +1,19 @@
function ad_row(id, name, wanteds) {
var table_id = "t1";
var table = document.getElementById(table_id);
var rows = table.getElementsByTagName('tr').length;
var tr = table.insertRow(rows);
var td1 = document.createElement('td');
var td2 = document.createElement('td');
var td3 = document.createElement('td');
var test = wanteds;
td1.innerHTML = ''+id;
td2.innerHTML = name.slice(1, -1);
td3.innerHTML = '' +wanteds;
tr.appendChild(td1);
tr.appendChild(td2);
tr.appendChild(td3);
}

View File

@@ -0,0 +1,36 @@
/* style.css für Tabliste */
div {
user-select: none;
}
th, td {
color: white;
font-size: 18px;
width:10%;
text-align: left;
}
.scroll {
height: 600px;
width: 600px;
font-size: 12px;
overflow: auto;
}
.force-overflow {
min-height: 600px;
}
#style1::-webkit-scrollbar {
width: 10px;
background-color: #F5F5F5;
}
#style1::-webkit-scrollbar-thumb {
background-color: #FF0040;
}

View File

@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Eingabe | Life of German</title>
<link rel="stylesheet" href="package://assets/css/Introduction/style.css" />
<link rel="stylesheet" href="../../font/font-awesome/css/fontawesome.min.css">
<link rel="stylesheet" href="../../font/font-awesome/css/regular.min.css">
<link rel="stylesheet" href="../../font/roboto-mono/include_500.css">
<link rel="stylesheet" href="./style.css">
</head>
<body>
<main>
<div class="input-main">
</div>
<div class='scroll' id='style1'>
<table id='t1'>
<tr>
<th>ID</th>
<th>Spielername</th>
<th>Wantedanzahl</th>
</tr>
</table>
</div>
<a target="_blank" id="close"></a>
</main>
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js"></script>
<script src="package://assets/js/wantedlist/application.js"></script>
<script src="./script.js"></script>
</body>
</html>

View File

@@ -0,0 +1,6 @@
let close = document.getElementById('close');
close.onclick = function closeWindow() {
mp.trigger('removeWantedlist');
console.log('Fenster geschlossen!');
}