Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
syncplayerlist.c
Go to the documentation of this file.
1
class
SyncPlayerList
2
{
3
ref
array<ref SyncPlayer>
m_PlayerList
;
4
5
void
CreatePlayerList
()
6
{
7
if
(
g_Game
.IsServer())
8
{
9
m_PlayerList
=
new
array<ref SyncPlayer>
();
10
11
array<PlayerIdentity>
identities =
new
array<PlayerIdentity>
();
12
g_Game
.GetPlayerIndentities(identities);
13
14
foreach
(
auto
identity : identities)
15
{
16
SyncPlayer
sync_player =
new
SyncPlayer
;
17
sync_player.
m_Identity
= identity;
18
sync_player.
m_UID
= identity.GetPlainId();
19
sync_player.
m_PlayerName
= identity.GetPlainName();
20
m_PlayerList
.Insert(sync_player);
21
}
22
}
23
}
24
25
static
SyncPlayerList
Compare
(
SyncPlayerList
a,
SyncPlayerList
b)
26
{
27
SyncPlayerList
new_list =
new
SyncPlayerList
;
28
new_list.
m_PlayerList
=
new
array<ref SyncPlayer>
;
29
30
if
(!a && b && b.
m_PlayerList
)
31
{
32
foreach
(
SyncPlayer
player3 : b.
m_PlayerList
)
33
{
34
new_list.
m_PlayerList
.Insert(player3);
35
}
36
}
37
else
if
(a && a.
m_PlayerList
&& !b)
38
{
39
foreach
(
SyncPlayer
player4 : a.
m_PlayerList
)
40
{
41
new_list.
m_PlayerList
.Insert(player4);
42
}
43
}
44
else
if
(a && a.
m_PlayerList
&& b && b.
m_PlayerList
)
45
{
46
array<ref SyncPlayer>
array_a = a.
m_PlayerList
;
47
array<ref SyncPlayer>
array_b = b.
m_PlayerList
;
48
49
foreach
(
SyncPlayer
player : array_b)
50
{
51
bool
found =
false
;
52
foreach
(
SyncPlayer
player2 : array_a)
53
{
54
if
(player.m_UID == player2.m_UID)
55
{
56
found =
true
;
57
break
;
58
}
59
}
60
61
if
(!found)
62
{
63
new_list.
m_PlayerList
.Insert(player);
64
}
65
}
66
}
67
return
new_list;
68
}
69
}
SyncPlayer
Definition
syncplayer.c:2
SyncPlayer::m_Identity
PlayerIdentity m_Identity
Definition
syncplayer.c:3
SyncPlayer::m_UID
string m_UID
Keeping for backwards compatability with mods.
Definition
syncplayer.c:8
SyncPlayer::m_PlayerName
string m_PlayerName
Definition
syncplayer.c:11
SyncPlayerList
Definition
syncplayerlist.c:2
SyncPlayerList::Compare
static SyncPlayerList Compare(SyncPlayerList a, SyncPlayerList b)
Definition
syncplayerlist.c:25
SyncPlayerList::CreatePlayerList
void CreatePlayerList()
Definition
syncplayerlist.c:5
SyncPlayerList::m_PlayerList
ref array< ref SyncPlayer > m_PlayerList
Definition
syncplayerlist.c:3
array
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Definition
isboxcollidinggeometryproxyclasses.c:28
g_Game
DayZGame g_Game
Definition
dayzgame.c:3942
Games
Dayz
scripts
3_game
client
syncplayerlist.c
Generated by
1.17.0