DayZ
1.24
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
(
GetGame
().IsServer())
8
{
9
m_PlayerList
=
new
array<ref SyncPlayer>
();
10
11
array<PlayerIdentity>
identities
=
new
array<PlayerIdentity>
();
12
GetGame
().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
new_list
.m_PlayerList.Insert(
player3
);
34
}
35
else
if
(a && a.
m_PlayerList
&& !b)
36
{
37
foreach
(
SyncPlayer
player4
: a.
m_PlayerList
)
38
new_list
.m_PlayerList.Insert(
player4
);
39
}
40
else
if
(a && a.
m_PlayerList
&& b && b.
m_PlayerList
)
41
{
42
array<ref SyncPlayer>
array_a
= a.
m_PlayerList
;
43
array<ref SyncPlayer>
array_b
= b.
m_PlayerList
;
44
45
foreach
(
SyncPlayer
player
:
array_b
)
46
{
47
bool
found
=
false
;
48
foreach
(
SyncPlayer
player2
:
array_a
)
49
{
50
if
(
player
.m_UID ==
player2
.m_UID)
51
{
52
found
=
true
;
53
break
;
54
}
55
}
56
57
if
(!
found
)
58
new_list
.m_PlayerList.Insert(
player
);
59
}
60
}
61
return
new_list
;
62
}
63
}
Param3
Definition
EntityAI.c:95
SyncPlayer
Definition
SyncPlayer.c:2
SyncPlayerList
Definition
SyncPlayerList.c:2
SyncPlayerList::CreatePlayerList
void CreatePlayerList()
Definition
SyncPlayerList.c:5
SyncPlayerList::m_PlayerList
ref array< ref SyncPlayer > m_PlayerList
Definition
SyncPlayerList.c:3
SyncPlayerList::Compare
static SyncPlayerList Compare(SyncPlayerList a, SyncPlayerList b)
Definition
SyncPlayerList.c:25
GetGame
proto native CGame GetGame()
scripts
3_Game
Client
SyncPlayerList.c
Generated by
1.10.0