Add Playerlist (tablist)
This commit is contained in:
@@ -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<Client> players = NAPI.Pools.GetAllPlayers();
|
||||
List<ListPlayer> ListPlayers = new List<ListPlayer>();
|
||||
|
||||
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)
|
||||
{
|
||||
|
||||
20
Server/Util/ListPlayer.cs
Normal file
20
Server/Util/ListPlayer.cs
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user