Skip to content

Commit e860e6c

Browse files
committed
clrcore: updated ServerWrappers to use API
1 parent f2b3312 commit e860e6c

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

code/client/clrcore/Server/ServerWrappers.cs

+11-13
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
using System.Collections;
33
using System.Collections.Generic;
44
using System.Linq;
5-
6-
using static CitizenFX.Core.Native.Function;
7-
using static CitizenFX.Core.Native.Hash;
5+
using CitizenFX.Core.Native;
86

97
namespace CitizenFX.Core
108
{
@@ -24,19 +22,19 @@ internal Player(string sourceString)
2422
m_handle = sourceString;
2523
}
2624

27-
public string Name => Call<string>(GET_PLAYER_NAME, m_handle);
25+
public string Name => API.GetPlayerName(m_handle);
2826

29-
public int Ping => Call<int>(GET_PLAYER_PING, m_handle);
27+
public int Ping => API.GetPlayerPing(m_handle);
3028

31-
public int LastMsg => Call<int>(GET_PLAYER_LAST_MSG, m_handle);
29+
public int LastMsg => API.GetPlayerLastMsg(m_handle);
3230

3331
public IdentifierCollection Identifiers => new IdentifierCollection(this);
3432

35-
public string EndPoint => Call<string>(GET_PLAYER_ENDPOINT, m_handle);
33+
public string EndPoint => API.GetPlayerEndpoint(m_handle);
3634

3735
public Ped Character => Ped.FromPlayerHandle(m_handle);
3836

39-
public void Drop(string reason) => Call(DROP_PLAYER, m_handle, reason);
37+
public void Drop(string reason) => API.DropPlayer(m_handle, reason);
4038

4139
public void TriggerEvent(string eventName, params object[] args)
4240
{
@@ -46,7 +44,7 @@ public void TriggerEvent(string eventName, params object[] args)
4644
{
4745
fixed (byte* serialized = &argsSerialized[0])
4846
{
49-
Call(TRIGGER_CLIENT_EVENT_INTERNAL, eventName, m_handle, serialized, argsSerialized.Length);
47+
API.TriggerClientEventInternal(eventName, m_handle, serialized, argsSerialized.Length);
5048
}
5149
}
5250
}
@@ -93,11 +91,11 @@ internal IdentifierCollection(Player player)
9391

9492
public IEnumerator<string> GetEnumerator()
9593
{
96-
int numIndices = Call<int>(GET_NUM_PLAYER_IDENTIFIERS, m_player.Handle);
94+
int numIndices = API.GetNumPlayerIdentifiers(m_player.Handle);
9795

9896
for (var i = 0; i < numIndices; i++)
9997
{
100-
yield return Call<string>(GET_PLAYER_IDENTIFIER, m_player.Handle, i);
98+
yield return API.GetPlayerIdentifier(m_player.Handle, i);
10199
}
102100
}
103101

@@ -121,11 +119,11 @@ public class PlayerList : IEnumerable<Player>
121119
{
122120
public IEnumerator<Player> GetEnumerator()
123121
{
124-
int numIndices = Call<int>(GET_NUM_PLAYER_INDICES);
122+
int numIndices = API.GetNumPlayerIndices();
125123

126124
for (var i = 0; i < numIndices; i++)
127125
{
128-
yield return new Player(Call<string>(GET_PLAYER_FROM_INDEX, i));
126+
yield return new Player(API.GetPlayerFromIndex(i));
129127
}
130128
}
131129

0 commit comments

Comments
 (0)