Skip to content

Commit 2e2bb1e

Browse files
authored
Merge pull request #225 from carmineos/clrcore-update
clrcore: updated ServerWrappers to use API
2 parents 325da4e + a832a9e commit 2e2bb1e

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

code/client/clrcore/Server/ServerWrappers.cs

+11-12
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
using System.Collections.Generic;
44
using System.Linq;
55

6-
using static CitizenFX.Core.Native.Function;
7-
using static CitizenFX.Core.Native.Hash;
6+
using static CitizenFX.Core.Native.API;
87

98
namespace CitizenFX.Core
109
{
@@ -24,19 +23,19 @@ internal Player(string sourceString)
2423
m_handle = sourceString;
2524
}
2625

27-
public string Name => Call<string>(GET_PLAYER_NAME, m_handle);
26+
public string Name => GetPlayerName(m_handle);
2827

29-
public int Ping => Call<int>(GET_PLAYER_PING, m_handle);
28+
public int Ping => GetPlayerPing(m_handle);
3029

31-
public int LastMsg => Call<int>(GET_PLAYER_LAST_MSG, m_handle);
30+
public int LastMsg => GetPlayerLastMsg(m_handle);
3231

3332
public IdentifierCollection Identifiers => new IdentifierCollection(this);
3433

35-
public string EndPoint => Call<string>(GET_PLAYER_ENDPOINT, m_handle);
34+
public string EndPoint => GetPlayerEndpoint(m_handle);
3635

3736
public Ped Character => Ped.FromPlayerHandle(m_handle);
3837

39-
public void Drop(string reason) => Call(DROP_PLAYER, m_handle, reason);
38+
public void Drop(string reason) => DropPlayer(m_handle, reason);
4039

4140
public void TriggerEvent(string eventName, params object[] args)
4241
{
@@ -46,7 +45,7 @@ public void TriggerEvent(string eventName, params object[] args)
4645
{
4746
fixed (byte* serialized = &argsSerialized[0])
4847
{
49-
Call(TRIGGER_CLIENT_EVENT_INTERNAL, eventName, m_handle, serialized, argsSerialized.Length);
48+
TriggerClientEventInternal(eventName, m_handle, serialized, argsSerialized.Length);
5049
}
5150
}
5251
}
@@ -93,11 +92,11 @@ internal IdentifierCollection(Player player)
9392

9493
public IEnumerator<string> GetEnumerator()
9594
{
96-
int numIndices = Call<int>(GET_NUM_PLAYER_IDENTIFIERS, m_player.Handle);
95+
int numIndices = GetNumPlayerIdentifiers(m_player.Handle);
9796

9897
for (var i = 0; i < numIndices; i++)
9998
{
100-
yield return Call<string>(GET_PLAYER_IDENTIFIER, m_player.Handle, i);
99+
yield return GetPlayerIdentifier(m_player.Handle, i);
101100
}
102101
}
103102

@@ -121,11 +120,11 @@ public class PlayerList : IEnumerable<Player>
121120
{
122121
public IEnumerator<Player> GetEnumerator()
123122
{
124-
int numIndices = Call<int>(GET_NUM_PLAYER_INDICES);
123+
int numIndices = GetNumPlayerIndices();
125124

126125
for (var i = 0; i < numIndices; i++)
127126
{
128-
yield return new Player(Call<string>(GET_PLAYER_FROM_INDEX, i));
127+
yield return new Player(GetPlayerFromIndex(i));
129128
}
130129
}
131130

0 commit comments

Comments
 (0)