Files
reallife-gamemode/Server/Events/Key.cs
2018-11-03 22:34:45 +01:00

64 lines
2.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Text;
using GTANetworkAPI;
using Newtonsoft.Json;
using reallife_gamemode.Server.Extensions;
using reallife_gamemode.Server.Util;
/**
* @overview Life of German Reallife - Event Key (Key.cs)
* @author VegaZ
* @copyright (c) 2008 - 2018 Life of German
*/
namespace reallife_gamemode.Server.Events
{
public class Key : Script
{
[RemoteEvent("keyPress:NUM2")]
public void KeyPressNUM2(Client player)
{
if(player.GetData("editmode") == true && player.GetUser().IsAdmin(AdminLevel.HEADADMIN) == true)
{
TempBlip tempBlip = NAPI.Data.GetWorldData("blipTemplate");
SaveManager.OnSaveBlipData(player, tempBlip.Sprite.ToString(), tempBlip.Name, tempBlip.Scale.ToString(), tempBlip.Color.ToString(),
tempBlip.Transparency.ToString(), 200.ToString(), tempBlip.ShortRange.ToString(), 0.ToString(), 0.ToString());
}
}
[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", JsonConvert.SerializeObject(ListPlayers));
}
[RemoteEvent("keyPress:N")]
public void KeyPressN(Client player)
{
if (player.IsInVehicle && player.VehicleSeat == -1)
{
player.Vehicle.EngineStatus = !player.Vehicle.EngineStatus;
}
}
[RemoteEvent("keyPress:X")]
public void KeyPressX(Client player)
{
if (player.IsInVehicle)
{
player.Seatbelt = !player.Seatbelt;
}
}
}
}