80 lines
2.0 KiB
C#
80 lines
2.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Net;
|
|
using System.Text;
|
|
using ReallifeGamemode.Server.Core.API;
|
|
using ReallifeGamemode.Server.Types;
|
|
|
|
namespace ReallifeGamemode.Server.Core.RageMP
|
|
{
|
|
public class RagePlayer : RageEntity, IPlayer
|
|
{
|
|
private readonly GTANetworkAPI.Player client;
|
|
|
|
public string Name
|
|
{
|
|
get => client.Name;
|
|
set => client.Name = value;
|
|
}
|
|
|
|
public string SocialClubName => client.SocialClubName;
|
|
|
|
public IPAddress RemoteAddress => IPAddress.Parse(client.Address);
|
|
|
|
public IVehicle Vehicle => client.IsInVehicle ? new RageVehicle(client.Vehicle) : null;
|
|
|
|
public VehicleSeat VehicleSeat => (VehicleSeat)client.VehicleSeat;
|
|
|
|
public bool IsInVehicle => Vehicle != null;
|
|
|
|
public int Health { get => client.Health; set => client.Health = value; }
|
|
public int Armor { get => client.Armor; set => client.Armor = value; }
|
|
|
|
public RagePlayer(GTANetworkAPI.Player client) : base(client)
|
|
{
|
|
this.client = client;
|
|
}
|
|
|
|
public void SendRawMessage(string message)
|
|
{
|
|
client.SendChatMessage(message);
|
|
}
|
|
|
|
public void TriggerEventRaw(string eventName, params object[] args)
|
|
{
|
|
client.TriggerEvent(eventName, args);
|
|
}
|
|
|
|
public void SetIntoVehicle(IVehicle vehicle, VehicleSeat seat)
|
|
{
|
|
client.SetIntoVehicle(new GTANetworkAPI.NetHandle((ushort)vehicle.Handle, GTANetworkAPI.EntityType.Vehicle), (int)seat - 1);
|
|
}
|
|
|
|
public void Kick() => client.Kick();
|
|
|
|
public void SendNotification(string message, bool flashing = true)
|
|
{
|
|
client.SendNotification(message, flashing);
|
|
}
|
|
|
|
public void Spawn(Position position, float heading = 0)
|
|
{
|
|
Health = 100;
|
|
Armor = 0;
|
|
|
|
Position = position;
|
|
Heading = heading;
|
|
}
|
|
|
|
public void PlayAnimation(string dict, string name, AnimationFlags flags, float speed = 8.0f)
|
|
{
|
|
GTANetworkAPI.NAPI.Player.PlayPlayerAnimation(client, (int)flags, dict, name, speed);
|
|
}
|
|
|
|
public void CancelAnimation()
|
|
{
|
|
client.StopAnimation();
|
|
}
|
|
}
|
|
}
|