Делюсь сегодняшними изысканиями (+ внес изменения):
1.
Сделал в начале входа в dbLoadPlayer.sqf от 123new отключение звука и затемнение экрана. Теперь как при родном входе на оф серверах.
В начале файла
0 fadeSound 0.0;
0 fadeSpeech 0.0;
0 fadeRadio 0.0;
понизить звук до 0.0 в течение 0 секунд
+ затемнение экрана setEVUser 5;
Затем по завершению цикла ожидания
1 fadeSound 1;
1 fadeSpeech 1;
1 fadeRadio 1;
повысить звук до 1 в течение 1 секунд
и убираем затемнение setEVUser 0;
(время в течение которого меняем звук до нужно уровня относительно текущего - команда - уровень звука от 0 до 1 )
_clientNew =
{
private "_agent";
_uid = getClientUID _id;
_savedChar = _uid call fnc_dbFindInProfile;
_isAlive = _savedChar select 0;
_pos = _savedChar select 2;
//Fade screen and sounds for client.
[_id] spawnForClient {
0 fadeSound 0.0;
0 fadeSpeech 0.0;
0 fadeRadio 0.0;
setEVUser -5;
};
diag_log format["CONNECTION: _id: %1 _uid: %2 _name: %3",_id,_uid,_name];
if (DZ_Enable_Login_Disconnect_Messages) then
{
{
[_x, format["Player %1 connected to server",_name], "colorStatusChannel"] call fnc_playerMessage;
} foreach players;
};
if (DZ_TIME_WAITING_SPAWN_PLAYER > 0) then
{
[_id,DZ_TIME_WAITING_SPAWN_PLAYER] spawnForClient {
sTIMER = _this select 1;
null = [] spawn {while {sTIMER > -1} do {setEVUser -5}};
disableUserInput true;
while {sTIMER > -1} do {
titleText[format["Spawning in %1 seconds... Please wait...",sTIMER],"BLACK",10e10];
sTIMER = sTIMER - 1;
sleep 1;
};
disableUserInput false;
titleText["Spawning...","PLAIN",10e10];
//unfading sound
1 fadeSound 1;
1 fadeSpeech 1;
1 fadeRadio 1;
//Force to unfade screen
setEVUser 0;
};
};
//CUSTOM
if (!isNil "DZ_PLAYER_SAVE") then {
if (DZ_PLAYER_SAVE) then {
if (_isAlive) then {
diag_log format["CONNECTION: Player save enabled by DZ_PLAYER_SAVE. Try to load saved profile."];
[_id,_uid,_pos] call fnc_previousPlayer;
} else {
diag_log format["CONNECTION: Player save enabled by DZ_PLAYER_SAVE. Create new player becouse no saved profiles."];
[_id,_uid] call fnc_newPlayer;
};
} else {
diag_log format["CONNECTION: Player save disabled by DZ_PLAYER_SAVE. Create new player."];
[_id,_uid] call fnc_newPlayer;
};
} else {
if (_isAlive) then {[_id,_uid,_pos] call fnc_previousPlayer} else {[_id,_uid] call fnc_newPlayer};
};
//find agent
{
if ((name _x) == _name) then
{
_agent = _x;
};
} foreach players;
diag_log format["CONNECTION: FOR PLAYER WITH UID %1 AND NAME %2 PROCEDURE CONNECT IS FINISHED! AGENT IS: %3",_uid,_name,_agent];
};
_clientRespawn =
{
_uid = getClientUID _id;
diag_log format["RESPAWN: PLAYER WITH UID %1 PRESS RESPAWN BUTTON!",_uid];
_vm = [_id,_uid,DZ_TIME_WAITING_RESPAWN_PLAYER] spawn
{
_id = _this select 0;
_uid = _this select 1;
_timer = _this select 2;
_uid call fnc_dbDestroyProfile;
connectedPlayers set [(connectedPlayers find _id), 0];
if (_timer > 0) then {
while {_timer > -1} do {
[_id,_timer] spawnForClient {titleText[format["Respawning in %1 seconds... Please wait...",(_this select 1)],"PLAIN",10e10];};
_timer = _timer - 1;
sleep 1;
};
};
sleep 1;
//[_id] spawnForClient {titleText["Respawning...","BLACK",1];};
[_id] spawnForClient {titleText["Respawning...","PLAIN",1];};
[_id,_uid] call fnc_newPlayer;
diag_log format["RESPAWN: PLAYER WITH UID %1 FINISH RESPAWN PLAYER!",_uid];
};
};
_disconnectPlayer =
{
_uid = getClientUID _id;
diag_log format["DISCONNECT: PLAYER %2 WITH UID %1 PRESS DISCONNECT!",_uid,_name];
_killed = [0,_uid,_agent] call dbSavePlayer;
if (DZ_PLAYER_SAVE) then {
if ( !_killed ) then {
[1,_uid,_agent] call dbSavePlayer;
};
};
_vm = [_agent,_id,_name,_queueTime,_killed,_uid,DZ_Enable_Login_Disconnect_Messages,DZ_TIME_EXIT_AGENT] spawn
{
private ["_agent","_id","_uid","Enable_Login_Disconnect_Messages","TIME_EXIT_AGENT"];
_agent = _this select 0;
_id = _this select 1;
_name = _this select 2;
_queueTime = _this select 3;
_killed = _this select 4;
_uid = _this select 5;
Enable_Login_Disconnect_Messages = _this select 6;
TIME_EXIT_AGENT = _this select 7;
//_isDummy = _agent getVariable ["isDummy",false];
if (Enable_Login_Disconnect_Messages) then
{
{
[_x, format["Player %1 disconnected from server",_name], "colorStatusChannel"] call fnc_playerMessage;
} foreach players;
};
diag_log format ["DISCONNECT: Player %1 name %2 UID %3 disconnected from server. Agent player exist in server and wait save if players save enabled!", _agent, _name, _uid];
diag_log format ["SCHEDULER: Removing disconnecting clientId %1, name %2", _id, _name];
_freedPos = connectedPlayers find _id;
if (_freedPos >= 0) then
{
connectedPlayers set [_freedPos,0];
diag_log format ["SCHEDULER: Updated 'connected players' array %1", connectedPlayers];
};
if (isNull _agent) then
{
diag_log format ["SCHEDULER: Agent is null - disconnecting clientId %1, name %2", _id, _name];
};
if (!isNull _agent) then
{
if (vehicle _agent != _agent) then
{
moveOut _agent;
};
sleep 1;
_agent playAction "SitDown";
if (TIME_EXIT_AGENT > 0) then {
sleep TIME_EXIT_AGENT;
};
if (DZ_PLAYER_SAVE) then {
_killed = [0,_uid,_agent] call dbSavePlayer;
if ( !_killed ) then {
[1,_uid,_agent] call dbSavePlayer;
};
if ((lifeState _agent == "ALIVE") and (not captive _agent)) then
{
_agent call dbSavePlayerPrep;
_result = [_uid, _agent] call fnc_dbSaveToProfile;
diag_log format ["DISCONNECT: Player %1 name %2 UID %3 SAVED server when him disconnect!", _agent, _name, _uid];
};
} else {
_uid call fnc_dbDestroyProfile;
diag_log format ["DISCONNECT: Player %1 name %2 UID %3 ERASED when him disconnect!", _agent, _name, _uid];
};
};
if (!isNull _agent) then
{
endDisconnectPlayer [ _agent, _uid ];
};
};
};
onPlayerConnecting _clientNew;
onClientRespawn _clientRespawn;
onPlayerDisconnected _disconnectPlayer;
2. Отображение происходящего после гибели (вместо черного экрана). В идеале это можно сделать в brain_player_client.fsm, но при выносе его в файл миссии он не работает
посему сделал так, и, получилось
в конце event_playerKilled.sqf (внес поправку - убрал setEVUser -5 в конце, тк если клиент зареспавнится быстрей чем отработает код, то может экран стать черным после респавна - код же до сих пор будет выполняться на клиенте)
[owner _agent,DZ_TIME_DELETE_DEAD_PLAYER] spawnForClient {
titleText ["YOU ARE DEAD!","PLAIN",10];
sleep 1;
setEVUser -4;
sleep 0.5;
setEVUser -3;
sleep 0.5;
setEVUser -2;
sleep 0.5;
setEVUser -1;
sleep 0.5;
setEVUser 0;
sleep 0.5;
setEVUser 0;
sleep 0.5;
setEVUser 0;
};
Циклом заморачиваться не стал, лень было. Сделал тупо.
+ Нужно еще поиграться задержками.
Сначала экран конечно темнеет, но затем снова всё становится видно и можно наблюдать происходящее, как тебя лутают итд итп, пока не нажмешь respawn или exit или не истечет время удаления агента/трупа.
Это все к тому, что я планирую где-то тут запихать камеру показывающую действие убийцы после убийства, а затем принудительный респавн, по истечении времени, если клиент сам не нажал respawn или exit...