Skip to content

Commit

Permalink
move EmitRpc to IPlayer
Browse files Browse the repository at this point in the history
  • Loading branch information
Doxoh committed Oct 10, 2023
1 parent 58d973b commit 4864c68
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
6 changes: 0 additions & 6 deletions api/AltV.Net/Alt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,6 @@ public static void EmitEventUnreliableAllClients(string eventName, params object
public static void EmitUnreliableClients(IPlayer[] clients, string eventName, params object[] args) =>
Core.TriggerClientEventUnreliableForSome(clients, eventName, args);

public static void EmitRPCAnswer(IPlayer target, ushort answerId, object answer, string error) =>
Core.TriggerClientRPCAnswer(target, answerId, answer, error);

public static void EmitRPC(IPlayer target, string name, params object[] args) =>
Core.TriggerClientRPC(target, name, args);

public static IEnumerable<string> GetRegisteredClientEvents() => Core.GetRegisteredClientEvents();
public static IEnumerable<string> GetRegisteredServerEvents() => Core.GetRegisteredServerEvents();

Expand Down
4 changes: 4 additions & 0 deletions api/AltV.Net/Elements/Entities/IPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ void SetDateTime(int day, int month, int year, int hour,
/// <param name="args">Parameters</param>
void Emit(string eventName, params object[] args);

ushort EmitRPC(string name, params object[] args);

void EmitRPCAnswer(ushort answerId, object answer, string error);

/// <summary>
/// Triggers client side event for a player
/// </summary>
Expand Down
12 changes: 12 additions & 0 deletions api/AltV.Net/Elements/Entities/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1110,6 +1110,18 @@ public void Emit(string eventName, params object[] args)
Alt.Core.TriggerClientEvent(this, eventName, args);
}

public ushort EmitRPC(string name, params object[] args)
{
CheckIfEntityExists();
return Alt.Core.TriggerClientRPC(this, name, args);
}

public void EmitRPCAnswer(ushort answerId, object answer, string error)
{
CheckIfEntityExists();
Core.TriggerClientRPCAnswer(this, answerId, answer, error);
}

public void EmitUnreliable(string eventName, params object[] args)
{
CheckIfEntityExists();
Expand Down

0 comments on commit 4864c68

Please sign in to comment.