Files
reallife-gamemode/Client/Gui/playerlist.js
2018-10-05 20:06:30 +02:00

35 lines
909 B
JavaScript

/**
* @overview Life of German Reallife - Gui Playerlist playerlist.js
* @author VegaZ
* @copyright (c) 2008 - 2018 Life of German
*/
var playerlistBrowser
var pList;
mp.events.add("showPlayerlist", () => {
if (!playerlistBrowser) {
playerlistBrowser = mp.browsers.new('package://Gui/playerlist.html');
mp.gui.chat.activate(false);
mp.gui.cursor.show(true, true);
}
});
mp.events.add("fetchPlayerList", (playersJson) => {
pList = JSON.parse(playersJson);
pList.forEach((player) => {
mp.gui.chat.push(player.Id + ", " + player.Name + ", " + player.Ping);
});
});
//function getTable() {
// var table = "";
// pList.forEach((player) => {
// var tableRow = "<tr><td>" + player.Id + "</td><td>" + player.Name + "</td><td>" + player.Ping + "</td>";
// table = table + tableRow;
// })
// return document.write(table);
//}