DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
BiosSessionService.c
Go to the documentation of this file.
2{
3 protected int m_GetSessionAttempts;
5
7
16 proto native EBiosError EnterGameplaySessionAsync(string session_address, int session_port);
17
19
30 proto native EBiosError LeaveGameplaySessionAsync(string session_address, int session_port);
31
33
36 proto native void OnSessionPlayerListUpdate(array<string> newPlayers);
37
39
47 void TryGetSession( string join_handle = "" )
48 {
49 if ( join_handle != "" )
50 {
52 m_CurrentHandle = join_handle;
53 }
54
55 if ( m_GetSessionAttempts < 10 )
57 else
58 g_Game.DisconnectSessionEx(DISCONNECT_SESSION_FLAGS_JOIN);
59 }
60
62
70 proto native EBiosError GetSessionAsync(string join_handle);
71
73
82 proto native EBiosError SetGameplayActivityAsync(string session_address, int session_port);
83
85 //proto native EBiosError SetLobbyActivityAsync(...);
86
88
95
97
107 proto native EBiosError ShowInviteToGameplaySessionAsync(string session_address, int session_port);
108
110
120 proto native EBiosError InviteToGameplaySessionAsync(string session_address, int session_port, array<string> invitee_list);
121
123 proto native void SetMultiplayState(bool is_active);
124
126
130 {
132 }
133
135
139 {
140 }
141
143
147 void OnGetGameplaySession(string session_address, int session_port)
148 {
150 switch (g_Game.GetGameState())
151 {
152 case DayZGameState.IN_GAME:
153 {
154 string addr;
155 int port;
156 bool found = GetGame().GetHostAddress( addr, port );
157 if (addr != session_address || port != session_port )
158 {
159 if (found)
160 {
161 OnlineServices.SetInviteServerInfo( session_address, session_port );
162 g_Game.GetUIManager().CloseAll();
163 if (!g_Game.GetUIManager().EnterScriptedMenu( MENU_INVITE_TIMER, null ))
164 {
165 NotificationSystem.AddNotification( NotificationType.CONNECT_FAIL_GENERIC, 6 );
166 }
167 }
168 else
169 {
170 NotificationSystem.AddNotification( NotificationType.JOIN_FAIL_GET_SESSION, 6 );
171 }
172 }
173 else
174 {
175 NotificationSystem.AddNotification( NotificationType.INVITE_FAIL_SAME_SERVER, 6, "#ps4_already_in_session" );
176 }
177 break;
178 }
179 case DayZGameState.CONNECTING:
180 {
181 g_Game.DisconnectSessionEx(DISCONNECT_SESSION_FLAGS_FORCE);
182 // Intentionally no break, fall through to connecting
183 }
184 default:
185 {
186 g_Game.ConnectFromJoin( session_address, session_port );
187 break;
188 }
189 }
190 }
191
193 /*void OnGetLobbySession(...)
194 {
195 }*/
196
198
202 {
205
206 #ifdef PLATFORM_XBOX
208 #endif
209 #ifdef PLATFORM_PS4
210 g_Game.DisconnectSessionEx(DISCONNECT_SESSION_FLAGS_JOIN);
211 #endif
212 }
213
215
220 void OnEnterGameplaySession(string session_address, int session_port, EBiosError error)
221 {
222 if ( !OnlineServices.ErrorCaught( error ) )
223 {
224 SetGameplayActivityAsync( session_address, session_port );
226 InviteToGameplaySessionAsync( session_address, session_port, OnlineServices.GetPendingInviteList() );
227
228 //OnlineServices.GetCurrentServerInfo(session_address, session_port);
229 }
230 }
231
233
237 {
238 }
239
241
245 {
247 }
248
250
254 {
255
256 }
257
259 {
261 }
262
263};
EBiosError
Possible Error codes for bios API. This is the list of errors that can be returned from bios API....
enum DisconnectSessionFlags DISCONNECT_SESSION_FLAGS_FORCE
DayZGame g_Game
Definition DayZGame.c:3654
const int DISCONNECT_SESSION_FLAGS_JOIN
Definition DayZGame.c:14
NotificationType
void OnEnterGameplaySession(string session_address, int session_port, EBiosError error)
Callback function.
void OnGetGameplaySession(string session_address, int session_port)
Callback function.
proto native EBiosError EnterGameplaySessionAsync(string session_address, int session_port)
Enter a gameplay session.
void OnClearActivity(EBiosError error)
Callback function.
void OnGetSessionError(EBiosError error)
//! Callback function, not implemented
proto native void OnSessionPlayerListUpdate(array< string > newPlayers)
Alerts engine that players in current session have changed.
proto native EBiosError InviteToGameplaySessionAsync(string session_address, int session_port, array< string > invitee_list)
Send invite to list of users.
proto native EBiosError ShowInviteToGameplaySessionAsync(string session_address, int session_port)
Show system UI to invite friends to current gameplay session.
array< string > GetSessionPlayerList()
void OnShowInviteToGameplaySession(EBiosError error)
Callback function.
protected int m_GetSessionAttempts
void OnInviteToGameplaySession(EBiosError error)
Callback function.
proto native EBiosError LeaveGameplaySessionAsync(string session_address, int session_port)
Leave a gameplay session.
void TryGetSession(string join_handle="")
Gets a session from a join handle.
void OnSetActivity(EBiosError error)
Callback function.
proto native void SetMultiplayState(bool is_active)
Notifiy about interactive multiplayer state.
proto native EBiosError GetSessionAsync(string join_handle)
Gets a session from a join handle.
proto native EBiosError ClearActivityAsync()
not implemented
void OnLeaveGameplaySession(EBiosError error)
Callback function.
proto native EBiosError SetGameplayActivityAsync(string session_address, int session_port)
Sets the activity to a gameplay session.
proto bool GetHostAddress(out string address, out int port)
Gets the server address. (from client)
override ScriptCallQueue GetCallQueue(int call_category)
Definition DayZGame.c:1153
static array< string > GetSimplePlayerList()
Definition ClientData.c:76
static void AddNotification(NotificationType type, float show_time, string detail_text="")
Send notification from default types to local player.
static void SetInviteServerInfo(string ip, int port)
static array< string > GetPendingInviteList()
static bool ErrorCaught(EBiosError error)
proto void CallLater(func fn, int delay=0, bool repeat=false, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto native CGame GetGame()
const int MENU_INVITE_TIMER
Definition constants.c:184
const int CALL_CATEGORY_SYSTEM
Definition tools.c:8