add onlinewanteds in factionmenü
This commit is contained in:
@@ -40,6 +40,7 @@ export default function factionInteraction(globalData: IGlobalData) {
|
|||||||
//LSPD
|
//LSPD
|
||||||
let ticketTaskMenuLSPD;
|
let ticketTaskMenuLSPD;
|
||||||
let pointsTaskMenuLSPD;
|
let pointsTaskMenuLSPD;
|
||||||
|
let wantedsMenuLSPD
|
||||||
if (userFactionId == 1 || userFactionId == 3) {
|
if (userFactionId == 1 || userFactionId == 3) {
|
||||||
if (isDuty) {
|
if (isDuty) {
|
||||||
mp.gui.chat.activate(false);
|
mp.gui.chat.activate(false);
|
||||||
@@ -53,6 +54,9 @@ export default function factionInteraction(globalData: IGlobalData) {
|
|||||||
pointsTaskMenuLSPD = new UIMenuItem("Strafpunkte verteilen", "Einem Spieler Strafpunkte verteilen.");
|
pointsTaskMenuLSPD = new UIMenuItem("Strafpunkte verteilen", "Einem Spieler Strafpunkte verteilen.");
|
||||||
factionInteractionMenu.AddItem(pointsTaskMenuLSPD);
|
factionInteractionMenu.AddItem(pointsTaskMenuLSPD);
|
||||||
|
|
||||||
|
wantedsMenuLSPD = new UIMenuItem("Verbrecher Liste");
|
||||||
|
factionInteractionMenu.AddItem(wantedsMenuLSPD);
|
||||||
|
|
||||||
/*TaskMenuLSPD = new UIMenuItem("");
|
/*TaskMenuLSPD = new UIMenuItem("");
|
||||||
TaskMenuLSPD.SetRightLabel("");
|
TaskMenuLSPD.SetRightLabel("");
|
||||||
factionInteractionMenu.AddItem(TaskMenuLSPD);*/ //weiteres
|
factionInteractionMenu.AddItem(TaskMenuLSPD);*/ //weiteres
|
||||||
@@ -100,6 +104,12 @@ export default function factionInteraction(globalData: IGlobalData) {
|
|||||||
mp.events.call("CLIENT:InteractionMenu_LSPD_Points", name);
|
mp.events.call("CLIENT:InteractionMenu_LSPD_Points", name);
|
||||||
globalData.InInput = false;
|
globalData.InInput = false;
|
||||||
});
|
});
|
||||||
|
break
|
||||||
|
case wantedsMenuLSPD:
|
||||||
|
factionInteractionMenu.Visible = false;
|
||||||
|
mp.gui.chat.activate(true);
|
||||||
|
globalData.InMenu = false;
|
||||||
|
mp.events.callRemote("CLIENT:wantedlist");
|
||||||
break;
|
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.events.add("showFactionInteractionMedic", (userFactionId, isDuty, userFactionName, isFactionLeader, reviveTaskCountMedic, healTaskCountMedic, fireTaskCountMedic) => {
|
||||||
mp.gui.chat.activate(false);
|
mp.gui.chat.activate(false);
|
||||||
globalData.InMenu = true;
|
globalData.InMenu = true;
|
||||||
|
|
||||||
//Medic
|
|
||||||
var rPM = ((reviveTaskCountMedic === "0") ? "~r~" : "~g~");
|
var rPM = ((reviveTaskCountMedic === "0") ? "~r~" : "~g~");
|
||||||
var hPM = ((healTaskCountMedic === "0") ? "~r~" : "~g~");
|
var hPM = ((healTaskCountMedic === "0") ? "~r~" : "~g~");
|
||||||
var fPM = ((fireTaskCountMedic === "0") ? "~r~" : "~g~");
|
var fPM = ((fireTaskCountMedic === "0") ? "~r~" : "~g~");
|
||||||
|
|||||||
19
ReallifeGamemode.Client/assets/html/Wantedlist/script.js
Normal file
19
ReallifeGamemode.Client/assets/html/Wantedlist/script.js
Normal 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);
|
||||||
|
}
|
||||||
36
ReallifeGamemode.Client/assets/html/Wantedlist/style.css
Normal file
36
ReallifeGamemode.Client/assets/html/Wantedlist/style.css
Normal 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
38
ReallifeGamemode.Client/assets/html/Wantedlist/wanteds.html
Normal file
38
ReallifeGamemode.Client/assets/html/Wantedlist/wanteds.html
Normal 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>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
let close = document.getElementById('close');
|
||||||
|
|
||||||
|
close.onclick = function closeWindow() {
|
||||||
|
mp.trigger('removeWantedlist');
|
||||||
|
console.log('Fenster geschlossen!');
|
||||||
|
}
|
||||||
@@ -672,6 +672,27 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[RemoteEvent("CLIENT:wantedlist")]
|
||||||
|
public void wantedlist(Player player)
|
||||||
|
{
|
||||||
|
if (!player.IsLoggedIn()) return;
|
||||||
|
List<Player> players = NAPI.Pools.GetAllPlayers();
|
||||||
|
if (player.GetUser().Wanteds > 0)
|
||||||
|
{
|
||||||
|
var listPlayers = players.Select(p => new
|
||||||
|
{
|
||||||
|
Id = p.Handle.Value,
|
||||||
|
p.Name,
|
||||||
|
wanted = p.GetUser().Wanteds,
|
||||||
|
}) ;
|
||||||
|
player.TriggerEvent("showWantedlist", JsonConvert.SerializeObject(listPlayers));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.SendNotification("~r~[Fehler] ~w~Es gibt derzeitig keine Verbrecher!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[RemoteEvent("CLIENT:InteractionMenu_FindHouse")]
|
[RemoteEvent("CLIENT:InteractionMenu_FindHouse")]
|
||||||
public void InteractionMenu_House(Player player)
|
public void InteractionMenu_House(Player player)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user