Add Playerlist (tablist)

This commit is contained in:
VegaZ
2018-10-03 19:02:48 +02:00
parent 55c95cc5c3
commit e7b2c06e92
7 changed files with 140 additions and 0 deletions

View File

@@ -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)
{