Немного подправленный dbLoad_Player.sqf
Ошибочка - ; забыл в конце одного условия поставить )))
поправил
//thanks 123new
_DZ_PVP_MISSON_LOCATION = missionNamespace getVariable "DZ_PVP_MISSON_LOCATION";
if ( _DZ_PVP_MISSON_LOCATION == "SZ" ) then {
posFromSpawnPlayer =
[
[4959.93,10108.76],
[4030.00,10750.00],
[4630.69,10483.01],
[5090.47,9811.48],
[4312.64,10349.27],
[4781.96,10571.71],
[5206.82,9870.85],
[4743.94,9445.59],
[5159.30,9989.97],
[4887.04,10686.55],
[5122.33,10080.00],
[4827.05,10853.81],
[5242.59,10223.49],
[4928.99,10324.03],
[4824.70,10364.45],
[4488.14,10020.55],
[4748.23,10535.18],
[4673.25,10583.48],
[4524.51,10897.56],
[5331.00,10923.01]
];
};
if ( _DZ_PVP_MISSON_LOCATION == "OLDSOBOR" ) then {
posFromSpawnPlayer =
[
[6010.52,7742.64,0.0],
[6053.10,7044.12,0.0]
];
};
diag_log format["dbLoadPlayer.sqf: Spawn coordinates set for mission - %1",_DZ_PVP_MISSON_LOCATION];
_clientNew =
{
diag_log format["CONNECTION: _id: %1 _uid: %2 _name: %3",_id,_uid,_name];
_id spawnForClient { titleText ["Please wait!","BLACK IN",3];};
if (DZ_Enable_Login_Disconnect_Messages) then
{
{
[_x, format["Player %1 connected to server",_name], "colorStatusChannel"] call fnc_playerMessage;
} foreach players;
};
_savedChar = _uid call fnc_dbFindInProfile;
_isAlive = _savedChar select 0;
_isOnline = true;
_pos = _savedChar select 2;
diag_log format["CONNECTION DEBUG INFO: _isAlive: %1 _isOnline: %2 _pos: %3 _savedChar: %4 ",_isAlive,_isOnline,_pos,_savedChar];
if (_isAlive) then
{
diag_log format ["CONNECTION: TRY LOAD PLAYER!"];
_uid = getClientUID _id;
_uidFound = 0;
for "_i" from 0 to count players - 1 do
{
_actPlayer = players select _i;
_actPlayerUid = getPlayerUID _actPlayer;
if ( _actPlayerUid == _uid ) then { _uidFound = 1; };
};
if ( _uidFound == 0 ) then
{
_agent = _uid call fnc_dbLoadFromProfile;
call init_newBody;
//----- simple scheduler part -----
_freePos = connectedPlayers find 0;
connectedPlayers set [_freePos,_id];
null = _agent call fnc_reloadWeaponOnSpawn;
null = [_agent,call compile callFunction ["DataBaseRead","QUICKBAR",format["UID_%1",_uid]]] call fnc_addQuickBarItems;
} else
{
diag_log format["CONNECTION: Player %1 has double UID on connect server, we are don't load him!",_uid];
_id statusChat ["Your have double UID on connect server, we are don't load this.","ColorImportant"];
};
};
if (!_isAlive) then
{
diag_log format["CONNECTION: SPAWN NEW PLAYER!"];
_mySkin = DZ_SkinsArray select (floor random (count DZ_SkinsArray));
_pos = posFromSpawnPlayer select (floor random (count posFromSpawnPlayer));
_agent = createAgent [_mySkin, _pos, [], 0, "NONE"];
call createFullEquipment;
_agent call init_newPlayer;
call init_newBody;
};
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],"PLAIN",10e10];
sTIMER = sTIMER - 1;
sleep 1;
};
disableUserInput false;
titleText["","PLAIN",10e10];
};
};
diag_log format ["CONNECT: FINISHED!"];
};
_clientRespawn =
{
_uid = getClientUID _id;
[_uid, _agent] call fnc_dbDestroyProfile;
_id spawnForClient { titleText ["Respawning....","BLACK IN",3];};
diag_log format["RESPAWN: NEW PLAYER! UID: %1",_uid];
sleep DZ_TIME_WAITING_SPAWN_PLAYER;
_mySkin = DZ_SkinsArray select (floor random (count DZ_SkinsArray));
_pos = posFromSpawnPlayer select (floor random (count posFromSpawnPlayer));
_agent = createAgent [_mySkin, _pos, [], 0, "NONE"];
call createFullEquipment;
_agent call init_newPlayer;
call init_newBody;
};
_disconnectPlayer =
{
_uid = getClientUID _id;
_killed = [0,_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;
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 try disconnect from server.", _agent, _name, _uid];
if (vehicle _agent != _agent) then
{
moveOut _agent;
};
if (DZ_PLAYER_SAVE) then
{
if (!isNull _agent) then
{
sleep 1;
_agent playAction "SitDown";
sleep TIME_EXIT_AGENT;
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, _agent] call fnc_dbDestroyProfile;
diag_log format ["DISCONNECT: Player %1 name %2 UID %3 destroy player data.", _agent, _name, _uid];
//вот тут забыл поставить ; после }
};
if (!isNull _agent) then
{
endDisconnectPlayer [ _agent, _uid ];
};
};
};
// Create player on connection
onClientRespawn _clientRespawn;
onPlayerConnecting _clientNew;
onPlayerDisconnected _disconnectPlayer;