diff --git a/Client/Gui/playerlist.html b/Client/Gui/playerlist.html new file mode 100644 index 00000000..bb55c176 --- /dev/null +++ b/Client/Gui/playerlist.html @@ -0,0 +1,31 @@ + + + + + + + + + + +
+ + + + + + + + + + + +
ID
Name
Ping
+
+ + + \ No newline at end of file diff --git a/Client/Gui/playerlist.js b/Client/Gui/playerlist.js new file mode 100644 index 00000000..e7610890 --- /dev/null +++ b/Client/Gui/playerlist.js @@ -0,0 +1,24 @@ +/** + * @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", (players) => { + + for (var player in players) + { + mp.gui.chat.push(player["Id"] + ", " + player["Name"] + ", " + player["Ping"]) + } +}); \ No newline at end of file diff --git a/Client/Gui/style.css b/Client/Gui/style.css new file mode 100644 index 00000000..d28c2277 --- /dev/null +++ b/Client/Gui/style.css @@ -0,0 +1,38 @@ +/** + * @overview Life of German Reallife - Save CSS style.css + * @author Orangebox, hydrant, VegaZ + * @copyright (c) 2008 - 2018 Life of German + */ + +.playerlist { + background-color: rgba(61, 68, 87, 0.50); + position: absolute; + top: 50%; + left: 50%; + margin-right: -50%; + transform: translate(-50%, -50%); + min-width: 60%; + text-align: center; +} + +body { + font-family: "Roboto", sans-serif; + -webkit-font-smoothing: antialiased; + overflow: hidden; +} +td { + align-content: stretch; + padding-left: 10px; + padding-right: 10px; + box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.2), 0 0 0 0 rgba(0, 0, 0, 0.24); + border-top: 2px double gray; + border-bottom: 2px double gray; + border-width: 0.5px; + width: auto; +} + +table { + margin: auto; + align-self:center; + width: 100%; +} \ No newline at end of file diff --git a/Client/Player/keys.js b/Client/Player/keys.js index d39d67ff..cc1a69be 100644 --- a/Client/Player/keys.js +++ b/Client/Player/keys.js @@ -15,6 +15,14 @@ mp.keys.bind(0x0D, false, function () { } }); +//I +mp.keys.bind(0x49, false, function () { + if (!chat) { + mp.events.callRemote("keyPress:I"); + mp.events.call("showPlayerlist"); + } +}); + //N mp.keys.bind(0x4E, false, function () { if (!chat) { diff --git a/Client/index.js b/Client/index.js index a494dc53..e32216ec 100644 --- a/Client/index.js +++ b/Client/index.js @@ -5,6 +5,7 @@ */ require('./Gui/infobox.js'); +require('./Gui/playerlist.js'); require('./Login/main.js'); require('./Player/keys.js'); require('./Save/main.js'); diff --git a/Server/Events/Key.cs b/Server/Events/Key.cs index f38999c9..9f150ff8 100644 --- a/Server/Events/Key.cs +++ b/Server/Events/Key.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Text; using GTANetworkAPI; +using reallife_gamemode.Server.Util; /** * @overview Life of German Reallife - Event Key (Key.cs) * @author VegaZ @@ -12,6 +13,23 @@ namespace reallife_gamemode.Server.Events { public class Key : Script { + [RemoteEvent("keyPress:I")] + public void KeyPressI(Client player) + { + List players = NAPI.Pools.GetAllPlayers(); + List ListPlayers = new List(); + + foreach(Client listPlayer in players) + { + var lPlayer = new ListPlayer(); + lPlayer.Id = listPlayer.Handle.Value; + lPlayer.Name = listPlayer.Name; + lPlayer.Ping = listPlayer.Ping; + + ListPlayers.Add(lPlayer); + } + player.TriggerEvent("fetchPlayerList", ListPlayers); + } [RemoteEvent("keyPress:N")] public void KeyPressN(Client player) { diff --git a/Server/Util/ListPlayer.cs b/Server/Util/ListPlayer.cs new file mode 100644 index 00000000..8de40e6c --- /dev/null +++ b/Server/Util/ListPlayer.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Text; +using GTANetworkAPI; + +/** + * @overview Life of German Reallife - Util ListPlayer ListPlayer.cs + * @author VegaZ + * @copyright (c) 2008 - 2018 Life of German + */ + +namespace reallife_gamemode.Server.Util +{ + public class ListPlayer : Script + { + public int Id; + public string Name; + public int Ping; + } +}