Fix online list show faction
This commit is contained in:
@@ -9,7 +9,7 @@ export default function playerList(globalData: IGlobalData): void {
|
||||
var playerlistBrowser: BrowserMp = null;
|
||||
var pList;
|
||||
|
||||
mp.events.add("showPlayerlist", (playersJson, factionname) => {
|
||||
mp.events.add("showPlayerlist", (playersJson) => {
|
||||
|
||||
if (playerlistBrowser !== null) {
|
||||
playerlistBrowser.destroy();
|
||||
@@ -25,7 +25,7 @@ export default function playerList(globalData: IGlobalData): void {
|
||||
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(factionname)},'${JSON.stringify(player.Ping)}');`);
|
||||
playerlistBrowser.execute(`ad_row('${JSON.stringify(player.Id)}','${JSON.stringify(player.Name)}',${JSON.stringify(player.FactionName)},'${JSON.stringify(player.Ping)}');`);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -609,7 +609,7 @@ namespace ReallifeGamemode.Server.Events
|
||||
if (!player.IsLoggedIn()) return;
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
string factionname = player.GetUser(dbContext).Faction.Name;
|
||||
string FactionName;
|
||||
|
||||
List<Player> players = NAPI.Pools.GetAllPlayers();
|
||||
var listPlayers = players.Select(p => new
|
||||
@@ -617,8 +617,9 @@ namespace ReallifeGamemode.Server.Events
|
||||
Id = p.Handle.Value,
|
||||
p.Name,
|
||||
p.Ping,
|
||||
FactionName = p.GetUser().Faction.Name,
|
||||
}) ;
|
||||
player.TriggerEvent("showPlayerlist", JsonConvert.SerializeObject(listPlayers), JsonConvert.SerializeObject(factionname));
|
||||
player.TriggerEvent("showPlayerlist", JsonConvert.SerializeObject(listPlayers));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user