33 lines
1.0 KiB
JavaScript
33 lines
1.0 KiB
JavaScript
window.onbeforeunload = () => { window.scrollTo(0, 0); }
|
|
|
|
$(document).ready(function () {
|
|
mp.trigger('CEF:PlayerList_Loaded');
|
|
});
|
|
|
|
setPlayerCount = (factionId, value) => {
|
|
if (factionId == -1) {
|
|
document.getElementById('player-count').innerHTML = value;
|
|
} else if (factionId >= 0 && factionId <= 9) {
|
|
document.getElementById(factionId).innerHTML = value;
|
|
}
|
|
}
|
|
|
|
function getFactionNameByFactionId(factionId) {
|
|
switch (factionId) {
|
|
case 1: return "LSPD";
|
|
case 2: return "LSED";
|
|
case 3: return "FIB";
|
|
case 4: return "Trucker";
|
|
case 5: return "Vagos";
|
|
case 7: return "Grove Street";
|
|
case 8: return "Ballas";
|
|
case 9: return "Weazle News";
|
|
default: return "Zivilisten";
|
|
}
|
|
}
|
|
|
|
function addPlayerEntry(userId, userName, factionId, userPing) {
|
|
var factionName = getFactionNameByFactionId(factionId);
|
|
document.getElementById('players').innerHTML += `<tr><td>${userId}</td> <td>${userName}</td> <td class="group group--${factionId}">${factionName}</td> <td>${userPing}</td></tr>`;
|
|
}
|