posFromSpawnPlayer =
[
[12978.985352,9727.786133,0.0],
[12991.748047,7287.136719,0.0],
[12891.515625,3673.904785,0.0],
[13905.519531,12489.755859,0.0],
[10294.267578,2822.940918,0.0],
[13676.062500,12262.099609,0.0],
[10757.389648,2662.214844,0.0],
[13099.121094,6393.073242,0.0],
[13048.381836,3867.787354,0.0],
[12983.053711,5539.139160,0.0],
[13337.080078,5120.864258,0.0],
[12942.089844,8393.175781,0.0],
[13326.754883,5489.095703,0.0],
[12628.758789,10495.178711,0.0],
[9529.755859,1791.217529,0.0],
[12566.361328,6682.603027,0.0],
[13395.850586,5902.893555,0.0],
[13400.793945,4120.798340,0.0],
[13520.839844,4223.753906,0.0],
[13552.681641,4653.762695,0.0],
[13159.864258,5401.762695,0.0],
[13594.320313,4064.055176,0.0],
[13476.730469,6136.301270,0.0],
[11709.407227,3388.221191,0.0],
[13441.593750,5262.234375,0.0],
[13426.652344,5747.389160,0.0],
[12574.364258,3592.838623,0.0],
[13155.216797,5475.265625,0.0],
[9691.710938,1750.488647,0.0],
[13529.917969,3968.353760,0.0],
[10875.846680,2518.956543,0.0],
[11578.048828,3159.044922,0.0],
[10820.407227,2257.452393,0.0],
[12465.262695,8009.000977,0.0],
[13617.405273,12759.806641,0.0],
[12354.499023,3480.040283,0.0],
[13571.149414,3056.800293,0.0],
[13384.993164,3946.686768,0.0],
[11846.833008,3477.815918,0.0],
[11049.366211,2801.670654,0.0],
[13504.011719,5004.529297,0.0],
[13587.850586,6026.528320,0.0],
[11075.847656,3031.246826,0.0],
[9823.205078,2712.662354,0.0],
[11439.040039,3315.189453,0.0],
[12950.263672,5226.752930,0.0],
[9193.719727,1935.760254,0.0],
[9479.743164,2373.589111,0.0],
[13170.000000,7406.352051,0.0],
[13262.844727,7225.861328,0.0],
[12789.221680,10918.727539,0.0],
[12800.711914,10542.708008,0.0],
[14172.258789,12304.997070,0.0],
[12343.653320,10169.873047,0.0],
[14263.791016,12748.735352,0.0],
[13610.134766,11223.590820,0.0],
[13846.640625,12050.081055,0.0],
[12135.720703,10209.888672,0.0],
[13416.827148,11840.477539,0.0],
[12929.765625,8578.303711,0.0],
[13288.770508,11415.183594,0.0],
[13101.216797,7657.375488,0.0],
[13138.783203,6737.337891,0.0],
[13171.646484,6534.843262,0.0],
[12917.356445,9356.586914,0.0],
[13048.117188,8357.667969,0.0],
[13312.712891,6771.159668,0.0],
[12689.791016,8256.066406,0.0],
[12773.998047,7792.608398,0.0],
[12889.967773,8792.861328,0.0],
[12651.287109,8914.446289,0.0],
[12796.349609,10361.371094,0.0],
[13084.968750,7938.640137,0.0],
[12614.712891,7304.662598,0.0],
[13367.192383,10837.138672,0.0],
[12868.693359,9054.500000,0.0],
[12729.841797,11285.530273,0.0],
[14054.989258,11341.375000,0.0],
[13374.454102,6454.316895,0.0],
[13852.414063,11686.062500,0.0],
[13366.394531,4905.995605,0.0],
[14749.782227,13248.712891,0.0],
[13261.652344,11785.191406,0.0],
[13056.826172,4848.545410,0.0],
[15135.173828,13901.139648,0.0],
[11201.583984,3186.677246,0.0],
[14338.071289,12859.577148,0.0],
[14071.417969,12033.381836,0.0],
[13112.375000,11280.756836,0.0],
[13111.719727,10975.507813,0.0],
[11914.292969,3402.007080,0.0],
[14415.284180,14025.288086,0.0],
[14697.602539,13418.411133,0.0],
[12936.726563,10734.027344,0.0],
[14537.363281,14755.781250,0.0],
[15017.886719,13892.493164,0.0],
[14887.168945,14547.986328,0.0],
[12332.004883,8170.038574,0.0],
[10032.810547,2446.574219,0.0],
[12221.616211,8693.677734,0.0],
[10969.238281,2895.127197,0.0],
[9460.575195,2171.624756,0.0],
[14017.8,2959.1,0.0]
];
_clientNew =
{
diag_log format["CONNECTION: _id: %1 _uid: %2 _name: %3",_id,_uid,_name];
// new_spawn_default = compile preprocessFileLineNumbers "from0.61\costom_code\custom_fnc\new_spawn_default.sqf";
_id spawnForClient { titleText ["Start Game!","BLACK IN",3];};
_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!"];
//load data
_top = getArray(configFile >> "cfgCharacterCreation" >> "top");
_bottom = getArray(configFile >> "cfgCharacterCreation" >> "bottom");
_shoe = getArray(configFile >> "cfgCharacterCreation" >> "shoe");
_myTop = _top select (floor random (count _top));
_myBottom = _bottom select (floor random (count _bottom));
_myShoe = _shoe select (floor random (count _shoe));
_mySkin = DZ_SkinsArray select (floor random (count DZ_SkinsArray));
_pos = posFromSpawnPlayer select (floor random (count posFromSpawnPlayer));
_agent = createAgent [_mySkin, _pos, [], 0, "NONE"];
{null = _agent createInInventory _x} forEach [_myTop,_myBottom,_myShoe];
//_v = _agent createInInventory "tool_flashlight";
//_v = _agent createInInventory "tool_transmitter";
//_v = _agent createInInventory "consumable_battery9V";_v setVariable ["power",30000];
//_v = _agent createInInventory "Consumable_Chemlight_White";
_v = _agent createInInventory "Consumable_Roadflare";
_v = _agent createInInventory "Consumable_Rags"; _v setQuantity 1;
if (_uid in array_donategroup_ADMIN) then
{
_isdonate = true;
_v = _agent createInInventory "Gorka_pants_summer";
_v = _agent createInInventory "Gorka_up_summer";
_v = _agent createInInventory "BagTortilla";
_v = _agent createInInventory "MilitaryBoots_Black";
_v = _agent createInInventory "GorkaHelmet_complete_Green";
_v = _agent createInInventory "HighCapacityVest_Olive";
_v = _agent createInInventory "WorkingGloves_Brown";
_v = _agent createInInventory "BalaclavaMask_Green";
_v = _agent createInInventory "Medical_Morphine";
_v = _agent createInInventory "Medical_BandageDressing";_v setVariable ["quantity",1];
_v = _agent createInInventory "Medical_TransfusionKit";
_v = _agent createInInventory "AKM";
_v = _agent createInInventory "Att_Bipod_Atlas";
_v = _agent createInInventory "Att_Light_Universal";
_v = _agent createInInventory "Att_Buttstock_AK_Wood";
_v = _agent createInInventory "Att_Optic_PSO1";
_v = _agent createInInventory "Att_Handguard_AK_Rail_Black";
_v = _agent createInInventory "Att_Suppressor_AK";
_v = _agent createInInventory "M_AKM_drum_Black";
_v = _agent createInInventory "M_AKM_drum_Black";
_v = _agent createInInventory "M_AKM_drum_Black";
_v = _agent createInInventory "FireFighterAxe";
_v = _agent createInInventory "glock19";
_v = _agent createInInventory "Att_Suppressor_Pistol";
_v = _agent createInInventory "M_Glock_15Rnd";
_v = _agent createInInventory "M_Glock_15Rnd";
_v = _agent createInInventory "CombatKnife";
_v = _agent createInInventory "Drink_Canteen";_v setVariable ["quantity",1000];
_v = _agent createInInventory "Drink_Canteen";_v setVariable ["quantity",1000];
_v = _agent createInInventory "Food_Rice";_v setVariable ["quantity",1];
_v = _agent createInInventory "Consumable_Matchbox";_v setVariable ["quantity",100];
_v = _agent createInInventory "Tool_LeatherSewingKit";
_v = _agent createInInventory "Tool_SewingKit";
};
_agent call init_newPlayer;
call init_newBody;
};
diag_log format ["CONNECT: FINISHED!"];
};
_clientRespawn =
{
[_uid, _agent] call fnc_dbDestroyProfile;
_id spawnForClient { titleText ["Respawning....","BLACK IN",3];};
diag_log format["RESPAWN: NEW PLAYER!"];
//load data
_top = getArray(configFile >> "cfgCharacterCreation" >> "top");
_bottom = getArray(configFile >> "cfgCharacterCreation" >> "bottom");
_shoe = getArray(configFile >> "cfgCharacterCreation" >> "shoe");
_myTop = _top select (floor random (count _top));
_myBottom = _bottom select (floor random (count _bottom));
_myShoe = _shoe select (floor random (count _shoe));
_mySkin = DZ_SkinsArray select (floor random (count DZ_SkinsArray));
_pos = posFromSpawnPlayer select (floor random (count posFromSpawnPlayer));
_agent = createAgent [_mySkin, _pos, [], 0, "NONE"];
{null = _agent createInInventory _x} forEach [_myTop,_myBottom,_myShoe];
//_v = _agent createInInventory "tool_flashlight";
//_v = _agent createInInventory "tool_transmitter";
//_v = _agent createInInventory "consumable_battery9V";_v setVariable ["power",30000];
//_v = _agent createInInventory "Consumable_Chemlight_White";
_v = _agent createInInventory "Consumable_Roadflare";
_v = _agent createInInventory "Consumable_Rags"; _v setQuantity 1;
if (_uid in array_donategroup_ADMIN) then
{
_isdonate = true;
_v = _agent createInInventory "Gorka_pants_summer";
_v = _agent createInInventory "Gorka_up_summer";
_v = _agent createInInventory "BagTortilla";
_v = _agent createInInventory "MilitaryBoots_Black";
_v = _agent createInInventory "GorkaHelmet_complete_Green";
_v = _agent createInInventory "HighCapacityVest_Olive";
_v = _agent createInInventory "WorkingGloves_Brown";
_v = _agent createInInventory "BalaclavaMask_Green";
_v = _agent createInInventory "Medical_Morphine";
_v = _agent createInInventory "Medical_BandageDressing";_v setVariable ["quantity",1];
_v = _agent createInInventory "Medical_TransfusionKit";
_v = _agent createInInventory "AKM";
_v = _agent createInInventory "Att_Bipod_Atlas";
_v = _agent createInInventory "Att_Light_Universal";
_v = _agent createInInventory "Att_Buttstock_AK_Wood";
_v = _agent createInInventory "Att_Optic_PSO1";
_v = _agent createInInventory "Att_Handguard_AK_Rail_Black";
_v = _agent createInInventory "Att_Suppressor_AK";
_v = _agent createInInventory "M_AKM_drum_Black";
_v = _agent createInInventory "M_AKM_drum_Black";
_v = _agent createInInventory "M_AKM_drum_Black";
_v = _agent createInInventory "FireFighterAxe";
_v = _agent createInInventory "glock19";
_v = _agent createInInventory "Att_Suppressor_Pistol";
_v = _agent createInInventory "M_Glock_15Rnd";
_v = _agent createInInventory "M_Glock_15Rnd";
_v = _agent createInInventory "CombatKnife";
_v = _agent createInInventory "Drink_Canteen";_v setVariable ["quantity",1000];
_v = _agent createInInventory "Drink_Canteen";_v setVariable ["quantity",1000];
_v = _agent createInInventory "Food_Rice";_v setVariable ["quantity",1];
_v = _agent createInInventory "Consumable_Matchbox";_v setVariable ["quantity",100];
_v = _agent createInInventory "Tool_LeatherSewingKit";
_v = _agent createInInventory "Tool_SewingKit";
};
_agent call init_newPlayer;
//_agent initDBIDs [ _cid, _pid ];
call init_newBody;
};
_disconnectPlayer =
{
_uid = getClientUID _id;
_killed = [0,_uid,_agent] call dbSavePlayer;
_vm = [_agent,_id,_name,_queueTime,_killed,_uid] spawn
{
private ["_agent","_id","_uid"];
_agent = _this select 0;
_id = _this select 1;
_name = _this select 2;
_queueTime = _this select 3;
_killed = _this select 4;
_uid = _this select 5;
diag_log format ["DISCONNECT: Player %1 name %2 UID %3 try disconnect from server.", _agent, _name, _uid];
if ( !_killed ) then {
[1,_uid,_agent] call dbSavePlayer;
};
if (!isNull _agent) then
{
endDisconnectPlayer _agent;
};
};
};
// Create player on connection
onClientRespawn _clientRespawn;
onPlayerConnecting _clientNew;
onPlayerDisconnected _disconnectPlayer;