Change parameter order for consistency

This commit is contained in:
Sardelka
2022-07-04 21:35:01 +08:00
parent a53b514fec
commit 56cd17401b
3 changed files with 14 additions and 14 deletions

View File

@ -251,7 +251,7 @@ namespace RageCoop.Server.Scripting
/// <param name="name">The name of the event, will be hashed to an int. For optimal performence, you should hash it in a static contructor inside the shared library, then call <see cref="SendCustomEvent(int, List{object}, List{Client})"/>.</param>
/// <param name="args">See <see cref="CustomEventReceivedArgs"/> for a list of supported types.</param>
/// <param name="targets">The target clients to send. Leave it null to send to all clients</param>
public void SendCustomEvent(string name, List<Client> targets = null, List<object> args = null)
public void SendCustomEvent(List<Client> targets, string name, List<object> args = null)
{
targets ??= new(Server.Clients.Values);
var p = new Packets.CustomEvent()
@ -271,11 +271,11 @@ namespace RageCoop.Server.Scripting
/// <param name="hash"></param>
/// <param name="args"></param>
/// /// <param name="clients">Clients to send, null for all clients</param>
public void SendNativeCall(GTA.Native.Hash hash, List<Client> clients, List<object> args)
public void SendNativeCall(List<Client> clients, GTA.Native.Hash hash, List<object> args)
{
var argsList = new List<object>(args);
argsList.InsertRange(0, new object[] { (byte)TypeCode.Empty, (ulong)hash });
SendCustomEvent(CustomEvents.NativeCall,clients, argsList);
SendCustomEvent(clients, CustomEvents.NativeCall, argsList);
}
/// <summary>
@ -284,11 +284,11 @@ namespace RageCoop.Server.Scripting
/// <param name="hash"></param>
/// <param name="args"></param>
/// /// <param name="clients">Clients to send, null for all clients</param>
public void SendNativeCall(GTA.Native.Hash hash, List<Client> clients = null, params object[] args)
public void SendNativeCall(List<Client> clients , GTA.Native.Hash hash, params object[] args)
{
var argsList = new List<object>(args);
argsList.InsertRange(0, new object[] { (byte)TypeCode.Empty, (ulong)hash });
SendCustomEvent(CustomEvents.NativeCall, clients, argsList);
SendCustomEvent(clients, CustomEvents.NativeCall, argsList);
}
/// <summary>
@ -297,7 +297,7 @@ namespace RageCoop.Server.Scripting
/// <param name="eventHash">An unique identifier of the event, you can use <see cref="CustomEvents.Hash(string)"/> to get it from a string</param>
/// <param name="args">The objects conataing your data, see <see cref="Scripting.CustomEventReceivedArgs.Args"/> for supported types.</param>
/// <param name="targets">The target clients to send. Leave it null to send to all clients</param>
public void SendCustomEvent(int eventHash, List<Client> targets = null, List<object> args=null)
public void SendCustomEvent(List<Client> targets , int eventHash, List<object> args=null)
{
targets ??= new(Server.Clients.Values);
var p = new Packets.CustomEvent()
@ -317,9 +317,9 @@ namespace RageCoop.Server.Scripting
/// <param name="eventHash">An unique identifier of the event, you can use <see cref="CustomEvents.Hash(string)"/> to get it from a string</param>
/// <param name="args">The objects conataing your data, see <see cref="Scripting.CustomEventReceivedArgs.Args"/> for supported types.</param>
/// <param name="targets">The target clients to send. Leave it null to send to all clients</param>
public void SendCustomEvent(int eventHash, List<Client> targets, params object[] args)
public void SendCustomEvent(List<Client> targets, int eventHash, params object[] args)
{
SendCustomEvent(eventHash,targets,new List<object>(args));
SendCustomEvent(targets, eventHash,new List<object>(args));
}
/// <summary>
/// Register an handler to the specifed event hash, one event can have multiple handlers.