NEUE ONLINELISTE DANKE EMRE.NL
This commit is contained in:
@@ -8,30 +8,47 @@ export default function playerList(globalData: IGlobalData): void {
|
||||
|
||||
var playerlistBrowser: BrowserMp = null;
|
||||
var pList;
|
||||
var factionPlayersMap: Map<number, number> = new Map<number, number>();
|
||||
const factionIds = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
|
||||
|
||||
mp.events.add("showPlayerlist", (playersJson) => {
|
||||
|
||||
|
||||
if (playerlistBrowser !== null) {
|
||||
playerlistBrowser.destroy();
|
||||
playerlistBrowser = null;
|
||||
globalData.InMenu = false;
|
||||
mp.gui.cursor.show(false, false);
|
||||
mp.gui.chat.activate(true);
|
||||
mp.gui.chat.activate(true);
|
||||
}
|
||||
else if (!globalData.InMenu) {
|
||||
globalData.InMenu = true;
|
||||
playerlistBrowser = mp.browsers.new('package://assets/html/Playerlist/Tabliste.html');
|
||||
playerlistBrowser = mp.browsers.new('package://assets/html/onlinelist/index.html');
|
||||
mp.gui.chat.activate(false);
|
||||
mp.gui.cursor.show(true, true);
|
||||
pList = JSON.parse(playersJson);
|
||||
pList.forEach((player) => {
|
||||
playerlistBrowser.execute(`ad_row('${JSON.stringify(player.Id)}','${JSON.stringify(player.Name)}',${JSON.stringify(player.FactionName)},'${JSON.stringify(player.Ping)}');`);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
mp.events.add("CEF:fetchPlayerList", () => {
|
||||
|
||||
mp.events.add("CEF:PlayerList_Loaded", () => {
|
||||
factionIds.forEach(f => {
|
||||
factionPlayersMap.set(f, 0);
|
||||
});
|
||||
|
||||
pList.forEach((player) => {
|
||||
var facId = player.FactionId;
|
||||
|
||||
playerlistBrowser.execute(`addPlayerEntry('${player.Id}','${player.Name}', '${facId}', '${player.FactionName}','${player.Ping}');`);
|
||||
|
||||
factionPlayersMap.set(facId, factionPlayersMap.get(facId) + 1);
|
||||
});
|
||||
|
||||
factionPlayersMap.forEach((value, key) => {
|
||||
playerlistBrowser.execute(`setPlayerCount(${key}, ${value});`)
|
||||
});
|
||||
|
||||
playerlistBrowser.execute(`setPlayerCount(-1, ${pList.length});`);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user