mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 04:02:37 +03:00
Group server side evenHandlers directly on server
All server eventhandlers are group together now. dayz_server\eventHandlers\server_eventhandler.sqf
This commit is contained in:
@@ -910,3 +910,57 @@ fnc_lockCode = {
|
|||||||
|
|
||||||
_code
|
_code
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Enable this if your server got nuked on Chernarus or Chernarus Winter.
|
||||||
|
/*
|
||||||
|
if (toLower worldName in ["chernarus","chernarus_winter"]) then { //need to add building coordinates for other maps
|
||||||
|
{
|
||||||
|
local _fckingcode = {
|
||||||
|
local _building = _this select 0;
|
||||||
|
local _part = _this select 1;
|
||||||
|
local _dmgLvl = 1 min (_this select 2);
|
||||||
|
local _who = _this select 3;
|
||||||
|
local _ammo = _this select 4;
|
||||||
|
if (_part != 'glass' && _dmgLvl > 0.01) then {
|
||||||
|
if (isServer) then {
|
||||||
|
diag_log ['Log building damage', _this];
|
||||||
|
} else {
|
||||||
|
local _dis = 0;
|
||||||
|
if (isNull _who) then {
|
||||||
|
if (_ammo != "" && _ammo isKindOf "HelicopterExploSmall") then {
|
||||||
|
_who = player;
|
||||||
|
_dist = round (_who distance _building);
|
||||||
|
PVDZ_sec_atp = format ["UID#%1 d4maged %2 %5 to %3pct with ammo %4 at dist4nce %6m.",
|
||||||
|
getPlayerUID _who, typeOf _building, round (100 * _dmgLvl), _ammo, _part, _dist];
|
||||||
|
publicVariableServer "PVDZ_sec_atp";
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
if (_who == player) then {
|
||||||
|
_dist = round (_who distance _building);
|
||||||
|
PVDZ_sec_atp = format ["UID#%1 d4maged %2 %5 to %3pct with ammo %4 at dist4nce %6m.",
|
||||||
|
getPlayerUID _who, typeOf _building, round (100 * _dmgLvl), _ammo, _part, _dist];
|
||||||
|
publicVariableServer "PVDZ_sec_atp";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if ((!isNull _who) && {(_who distance _building < 150)}) then {_dmgLvl} else {0}
|
||||||
|
};
|
||||||
|
local _building = [_x select 0,_x select 1,0] nearestObject (_x select 2);
|
||||||
|
_building removeAllEventHandlers "handleDamage";
|
||||||
|
_building addEventHandler ["handleDamage", _fckingcode];
|
||||||
|
} forEach [
|
||||||
|
[7069,7727,206458], [6009,7815,203486], [10638,8016,272598], [6553,5598,223435], [6914,11431,141876],
|
||||||
|
[4660,9596,145234], [4788,10257,143923], [11467,7479,276453], [4628,10489,137736], [4551,6395,212964],
|
||||||
|
[3815,8948,132069], [3804,8925,132182], [11957,9120,261904], [12031,9158,261252], [12057,9103,261945],
|
||||||
|
[12227,9518,256625], [12237,9493,262727], [12256,9508,262732], [12275,9479,262631], [3064,7975,172476],
|
||||||
|
[3055,7855,172835], [12742,9593,259691], [11254,12210,236245], [12780,10128,257815], [12805,10089,258268],
|
||||||
|
[12803,10119,258288], [11251,4274,353940], [13100,7177,297715], [7098,2738,966951], [6817,2702,966613],
|
||||||
|
[6379,2791,965644], [6414,2760,965688], [6371,2747,965657], [6386,2735,965658], [6410,2716,965659],
|
||||||
|
[6383,2691,965643], [6899,2561,969372], [6854,2556,969371], [6770,2525,968272], [6901,2484,969736],
|
||||||
|
[6783,2485,968116], [6507,2532,967694], [6835,2388,969223], [6578,2402,968509], [6661,2345,968949],
|
||||||
|
[6679,2302,969332], [2587,5069,188570], [6537,2302,968797], [10424,2562,362226], [10420,2368,363222],
|
||||||
|
[10443,2345,363318], [10481,2358,363308], [10365,2241,363748], [10518,2288,364628], [10457,2256,363454],
|
||||||
|
[10174,1810,366820], [3589,2175,328944]
|
||||||
|
];
|
||||||
|
};*/
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
"PVDZ_hlt_Bleed" addPublicVariableEventHandler {(_this select 1) spawn fnc_usec_damageBleed};
|
"PVDZ_hlt_Bleed" addPublicVariableEventHandler {(_this select 1) spawn fnc_usec_damageBleed};
|
||||||
"PVCDZ_veh_SH" addPublicVariableEventHandler {(_this select 1) call fnc_veh_handleDam}; // set damage to vehicle part
|
"PVCDZ_veh_SH" addPublicVariableEventHandler {(_this select 1) call fnc_veh_handleDam}; // set damage to vehicle part
|
||||||
"PVDZ_veh_SF" addPublicVariableEventHandler {(_this select 1) call fnc_veh_handleRepair}; // repair a part from a vehicle
|
"PVDZ_veh_SF" addPublicVariableEventHandler {(_this select 1) call fnc_veh_handleRepair}; // repair a part from a vehicle
|
||||||
"PVCDZ_obj_HideBody" addPublicVariableEventHandler {hideBody (_this select 1)};
|
|
||||||
"PVCDZ_obj_GutBody" addPublicVariableEventHandler {(_this select 1) spawn local_gutObject};
|
"PVCDZ_obj_GutBody" addPublicVariableEventHandler {(_this select 1) spawn local_gutObject};
|
||||||
"PVCDZ_veh_SetFuel" addPublicVariableEventHandler {(_this select 1) spawn local_setFuel};
|
"PVCDZ_veh_SetFuel" addPublicVariableEventHandler {(_this select 1) spawn local_setFuel};
|
||||||
"PVCDZ_veh_engineSwitch" addPublicVariableEventHandler {(_this select 1) spawn dayz_engineSwitch};
|
"PVCDZ_veh_engineSwitch" addPublicVariableEventHandler {(_this select 1) spawn dayz_engineSwitch};
|
||||||
@@ -15,162 +14,13 @@ if (dayz_groupSystem) then {
|
|||||||
"PVDZ_groupInvite" addPublicVariableEventHandler {(_this select 1) call dayz_groupInvite};
|
"PVDZ_groupInvite" addPublicVariableEventHandler {(_this select 1) call dayz_groupInvite};
|
||||||
};
|
};
|
||||||
|
|
||||||
if (toLower worldName == "chernarus") then { //need to add building coordinates for other maps
|
// Server Eventhandler moved to dayz_server\eventHandlers\server_eventhandler.sqf
|
||||||
{
|
|
||||||
private ["_building","_fckingcode"];
|
|
||||||
|
|
||||||
_fckingcode = {
|
|
||||||
private ["_building","_part","_dmgLvl","_who","_ammo","_dist"];
|
|
||||||
|
|
||||||
_building = _this select 0;
|
|
||||||
_part = _this select 1;
|
|
||||||
_dmgLvl = 1 min (_this select 2);
|
|
||||||
_who = _this select 3;
|
|
||||||
_ammo = _this select 4;
|
|
||||||
if (_part != 'glass' && _dmgLvl > 0.01) then {
|
|
||||||
if (isServer) then {
|
|
||||||
diag_log ['Log building damage', _this];
|
|
||||||
} else {
|
|
||||||
if (isNull _who) then {
|
|
||||||
if (_ammo != "" && _ammo isKindOf "HelicopterExploSmall") then {
|
|
||||||
_who = player;
|
|
||||||
_dist = round (_who distance _building);
|
|
||||||
PVDZ_sec_atp = format ["UID#%1 d4maged %2 %5 to %3pct with ammo %4 at dist4nce %6m.",
|
|
||||||
getPlayerUID _who, typeOf _building, round (100 * _dmgLvl), _ammo, _part, _dist];
|
|
||||||
publicVariableServer "PVDZ_sec_atp";
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
if (_who == player) then {
|
|
||||||
_dist = round (_who distance _building);
|
|
||||||
PVDZ_sec_atp = format ["UID#%1 d4maged %2 %5 to %3pct with ammo %4 at dist4nce %6m.",
|
|
||||||
getPlayerUID _who, typeOf _building, round (100 * _dmgLvl), _ammo, _part, _dist];
|
|
||||||
publicVariableServer "PVDZ_sec_atp";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
if ((!isNull _who) && {(_who distance _building < 150)}) then {_dmgLvl} else {0}
|
|
||||||
};
|
|
||||||
_building = [_x select 0,_x select 1,0] nearestObject (_x select 2);
|
|
||||||
_building removeAllEventHandlers "handleDamage";
|
|
||||||
_building addEventHandler ["handleDamage", _fckingcode];
|
|
||||||
} forEach [
|
|
||||||
[7069,7727,206458], [6009,7815,203486], [10638,8016,272598], [6553,5598,223435], [6914,11431,141876],
|
|
||||||
[4660,9596,145234], [4788,10257,143923], [11467,7479,276453], [4628,10489,137736], [4551,6395,212964],
|
|
||||||
[3815,8948,132069], [3804,8925,132182], [11957,9120,261904], [12031,9158,261252], [12057,9103,261945],
|
|
||||||
[12227,9518,256625], [12237,9493,262727], [12256,9508,262732], [12275,9479,262631], [3064,7975,172476],
|
|
||||||
[3055,7855,172835], [12742,9593,259691], [11254,12210,236245], [12780,10128,257815], [12805,10089,258268],
|
|
||||||
[12803,10119,258288], [11251,4274,353940], [13100,7177,297715], [7098,2738,966951], [6817,2702,966613],
|
|
||||||
[6379,2791,965644], [6414,2760,965688], [6371,2747,965657], [6386,2735,965658], [6410,2716,965659],
|
|
||||||
[6383,2691,965643], [6899,2561,969372], [6854,2556,969371], [6770,2525,968272], [6901,2484,969736],
|
|
||||||
[6783,2485,968116], [6507,2532,967694], [6835,2388,969223], [6578,2402,968509], [6661,2345,968949],
|
|
||||||
[6679,2302,969332], [2587,5069,188570], [6537,2302,968797], [10424,2562,362226], [10420,2368,363222],
|
|
||||||
[10443,2345,363318], [10481,2358,363308], [10365,2241,363748], [10518,2288,364628], [10457,2256,363454],
|
|
||||||
[10174,1810,366820], [3589,2175,328944]
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
// Server only
|
|
||||||
if (isServer) then {
|
|
||||||
"PVDZ_plr_Death" addPublicVariableEventHandler {_id = (_this select 1) spawn server_playerDied};
|
|
||||||
"PVDZ_plr_Save" addPublicVariableEventHandler {_id = (_this select 1) call server_playerSync;};
|
|
||||||
"PVDZ_plr_SwitchMove" addPublicVariableEventHandler {((_this select 1) select 0) switchMove ((_this select 1) select 1);}; //Needed to execute switchMove on server machine. rSwitchMove only executes on other clients
|
|
||||||
"PVDZ_obj_Publish" addPublicVariableEventHandler {(_this select 1) call server_publishObj}; //Used by built items (Epoch and Vanilla)
|
|
||||||
"PVDZ_veh_Save" addPublicVariableEventHandler {(_this select 1) call server_updateObject};
|
|
||||||
"PVDZ_plr_Login1" addPublicVariableEventHandler {_id = (_this select 1) call server_playerLogin};
|
|
||||||
"PVDZ_plr_Login2" addPublicVariableEventHandler {(_this select 1) call server_playerSetup};
|
|
||||||
"PVDZ_plr_LoginRecord" addPublicVariableEventHandler {_id = (_this select 1) spawn dayz_recordLogin};
|
|
||||||
"PVDZ_obj_Destroy" addPublicVariableEventHandler {(_this select 1) call server_deleteObj};
|
|
||||||
"PVDZ_send" addPublicVariableEventHandler {(_this select 1) call server_sendToClient};
|
|
||||||
//"PVDZ_dayzCarBomb" addPublicVariableEventHandler {[_this select 1] execVM "\z\addons\dayz_code\actions\detonate_bomb.sqf";};
|
|
||||||
//[player,[medical Array]];
|
|
||||||
"PVDZ_playerMedicalSync" addPublicVariableEventHandler { (_this select 1) call server_medicalSync; ((_this select 1) select 0) setVariable["Medical",((_this select 1) select 1),false]; }; //diag_log format["%1 - %2",((_this select 1) select 0),((_this select 1) select 1)]; };
|
|
||||||
|
|
||||||
// EPOCH ADDITIONS
|
|
||||||
"PVDZE_maintainArea" addPublicVariableEventHandler {(_this select 1) spawn server_maintainArea};
|
|
||||||
"PVDZE_obj_Swap" addPublicVariableEventHandler {(_this select 1) spawn server_swapObject}; //Used to downgrade and upgrade Epoch buildables
|
|
||||||
"PVDZE_veh_Publish2" addPublicVariableEventHandler {(_this select 1) call server_publishVeh2}; //Used to purchase vehicles at traders
|
|
||||||
"PVDZE_veh_Upgrade" addPublicVariableEventHandler {(_this select 1) spawn server_publishVeh3}; //Used for car upgrades
|
|
||||||
"PVDZE_obj_Trade" addPublicVariableEventHandler {(_this select 1) spawn server_tradeObj};
|
|
||||||
"PVDZE_plr_DeathB" addPublicVariableEventHandler {(_this select 1) spawn server_deaths};
|
|
||||||
"PVDZE_handleSafeGear" addPublicVariableEventHandler {(_this select 1) call server_handleSafeGear};
|
|
||||||
if (dayz_groupSystem) then {
|
|
||||||
"PVDZ_Server_UpdateGroup" addPublicVariableEventHandler {(_this select 1) spawn server_updateGroup};
|
|
||||||
};
|
|
||||||
"PVDZE_PingSend" addPublicVariableEventHandler {PVDZE_PingReceived = 1; (owner (_this select 1)) publicVariableClient "PVDZE_PingReceived";};
|
|
||||||
|
|
||||||
"PVDZ_Server_Simulation" addPublicVariableEventHandler {
|
|
||||||
_agent = (_this select 1) select 0;
|
|
||||||
_control = (_this select 1) select 1;
|
|
||||||
|
|
||||||
_agent enableSimulation _control;
|
|
||||||
};
|
|
||||||
|
|
||||||
"PVDZ_obj_Delete" addPublicVariableEventHandler {
|
|
||||||
_obj = (_this select 1) select 0;
|
|
||||||
_player = (_this select 1) select 1;
|
|
||||||
_type = typeOf _obj;
|
|
||||||
_dis = _player distance _obj;
|
|
||||||
|
|
||||||
if (_type in Dayz_plants) then {
|
|
||||||
if (_dis < 3) then {
|
|
||||||
deleteVehicle _obj;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
if (_type == "Blood_Trail_DZ") then {
|
|
||||||
deleteVehicle _obj;
|
|
||||||
};
|
|
||||||
|
|
||||||
//Make sure object is a cardboardbox and make sure the player distance is under 15 meters from object
|
|
||||||
if (_type iskindOf "CardboardBox") then {
|
|
||||||
if (_dis < 15) then {
|
|
||||||
deleteVehicle _obj;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
"PVDZ_serverStoreVar" addPublicVariableEventHandler {
|
|
||||||
_obj = (_this select 1) select 0;
|
|
||||||
_name = (_this select 1) select 1;
|
|
||||||
_value = (_this select 1) select 2;
|
|
||||||
|
|
||||||
_obj setVariable [_name, _value];
|
|
||||||
/*
|
|
||||||
switch (_name) do {
|
|
||||||
case "looted": {
|
|
||||||
_obj = ((_this select 1) select 0);
|
|
||||||
_name = "looted";
|
|
||||||
_value = ((_this select 1) select 2);
|
|
||||||
|
|
||||||
_obj setVariable [_name, _value];
|
|
||||||
};
|
|
||||||
case "zombieSpawn": {
|
|
||||||
_obj = ((_this select 1) select 0);
|
|
||||||
_name = "zombieSpawn";
|
|
||||||
_value = ((_this select 1) select 2);
|
|
||||||
|
|
||||||
_obj setVariable [_name, _value];
|
|
||||||
};
|
|
||||||
case "USEC_BloodQty": {
|
|
||||||
_obj = ((_this select 1) select 0);
|
|
||||||
_name = ((_this select 1) select 1);
|
|
||||||
_value = ((_this select 1) select 2);
|
|
||||||
//diag_log format ["%1, %2, %3", _obj, _name, _value];
|
|
||||||
if (isPlayer _obj) then {
|
|
||||||
_obj setVariable [_name, _value];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
//Client only
|
//Client only
|
||||||
if (!isDedicated) then {
|
if (!isDedicated) then {
|
||||||
"dayzSetDate" addPublicVariableEventHandler {
|
"dayzSetDate" addPublicVariableEventHandler {
|
||||||
_newdate = _this select 1;
|
local _newdate = _this select 1;
|
||||||
_date = +(date); // [year, month, day, hour, minute].
|
local _date = +(date); // [year, month, day, hour, minute].
|
||||||
//diag_log ['Date & time received:', _newdate, 'Local date on this client:', _date];
|
//diag_log ['Date & time received:', _newdate, 'Local date on this client:', _date];
|
||||||
{
|
{
|
||||||
if (_x != _newdate select _forEachIndex) exitWith {
|
if (_x != _newdate select _forEachIndex) exitWith {
|
||||||
@@ -199,7 +49,7 @@ if (!isDedicated) then {
|
|||||||
"PVCDZ_hlt_Wipe" addPublicVariableEventHandler {(_this select 1) call player_medABWipe};
|
"PVCDZ_hlt_Wipe" addPublicVariableEventHandler {(_this select 1) call player_medABWipe};
|
||||||
|
|
||||||
"PVCDZ_plr_Legs" addPublicVariableEventHandler {
|
"PVCDZ_plr_Legs" addPublicVariableEventHandler {
|
||||||
_entity = (_this select 1) select 0;
|
local _entity = (_this select 1) select 0;
|
||||||
_entity setHit ["legs", 1];
|
_entity setHit ["legs", 1];
|
||||||
|
|
||||||
if (isPlayer _entity) then {
|
if (isPlayer _entity) then {
|
||||||
@@ -208,8 +58,8 @@ if (!isDedicated) then {
|
|||||||
};
|
};
|
||||||
|
|
||||||
"PVDZ_receiveUnconscious" addPublicVariableEventHandler {
|
"PVDZ_receiveUnconscious" addPublicVariableEventHandler {
|
||||||
_unit = (_this select 1) select 0;
|
local _unit = (_this select 1) select 0;
|
||||||
_duration = (_this select 1) select 1;
|
local _duration = (_this select 1) select 1;
|
||||||
|
|
||||||
diag_log format["%1,%2",_unit,_duration];
|
diag_log format["%1,%2",_unit,_duration];
|
||||||
[_unit,_duration] call fnc_usec_damageUnconscious;
|
[_unit,_duration] call fnc_usec_damageUnconscious;
|
||||||
|
|||||||
103
SQF/dayz_server/eventHandlers/server_eventHandler.sqf
Normal file
103
SQF/dayz_server/eventHandlers/server_eventHandler.sqf
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
"PVDZ_plr_Death" addPublicVariableEventHandler {_id = (_this select 1) spawn server_playerDied};
|
||||||
|
"PVDZ_plr_Save" addPublicVariableEventHandler {_id = (_this select 1) call server_playerSync;};
|
||||||
|
"PVDZ_plr_SwitchMove" addPublicVariableEventHandler {((_this select 1) select 0) switchMove ((_this select 1) select 1);}; //Needed to execute switchMove on server machine. rSwitchMove only executes on other clients
|
||||||
|
"PVDZ_obj_Publish" addPublicVariableEventHandler {(_this select 1) call server_publishObj}; //Used by built items (Epoch and Vanilla)
|
||||||
|
"PVDZ_veh_Save" addPublicVariableEventHandler {(_this select 1) call server_updateObject};
|
||||||
|
"PVDZ_plr_Login1" addPublicVariableEventHandler {_id = (_this select 1) call server_playerLogin};
|
||||||
|
"PVDZ_plr_Login2" addPublicVariableEventHandler {(_this select 1) call server_playerSetup};
|
||||||
|
"PVDZ_plr_LoginRecord" addPublicVariableEventHandler {_id = (_this select 1) spawn dayz_recordLogin};
|
||||||
|
"PVDZ_obj_Destroy" addPublicVariableEventHandler {(_this select 1) call server_deleteObj};
|
||||||
|
"PVDZ_plr_Delete" addPublicVariableEventHandler {(_this select 1) spawn sched_co_deleteVehicle}; // Delete hided players
|
||||||
|
"PVDZ_send" addPublicVariableEventHandler {(_this select 1) call server_sendToClient};
|
||||||
|
//"PVDZ_dayzCarBomb" addPublicVariableEventHandler {[_this select 1] execVM "\z\addons\dayz_code\actions\detonate_bomb.sqf";};
|
||||||
|
//[player,[medical Array]];
|
||||||
|
"PVDZ_playerMedicalSync" addPublicVariableEventHandler { (_this select 1) call server_medicalSync; ((_this select 1) select 0) setVariable["Medical",((_this select 1) select 1),false]; }; //diag_log format["%1 - %2",((_this select 1) select 0),((_this select 1) select 1)]; };
|
||||||
|
|
||||||
|
// EPOCH ADDITIONS
|
||||||
|
"PVDZE_maintainArea" addPublicVariableEventHandler {(_this select 1) spawn server_maintainArea};
|
||||||
|
"PVDZE_obj_Swap" addPublicVariableEventHandler {(_this select 1) spawn server_swapObject}; //Used to downgrade and upgrade Epoch buildables
|
||||||
|
"PVDZE_veh_Publish2" addPublicVariableEventHandler {(_this select 1) call server_publishVeh2}; //Used to purchase vehicles at traders
|
||||||
|
"PVDZE_veh_Upgrade" addPublicVariableEventHandler {(_this select 1) spawn server_publishVeh3}; //Used for car upgrades
|
||||||
|
"PVDZE_obj_Trade" addPublicVariableEventHandler {(_this select 1) spawn server_tradeObj}; //Logs trading
|
||||||
|
"PVDZE_plr_DeathB" addPublicVariableEventHandler {(_this select 1) spawn server_deaths};
|
||||||
|
"PVDZE_handleSafeGear" addPublicVariableEventHandler {(_this select 1) call server_handleSafeGear};
|
||||||
|
|
||||||
|
if (dayz_groupSystem) then {
|
||||||
|
"PVDZ_Server_UpdateGroup" addPublicVariableEventHandler {(_this select 1) spawn server_updateGroup};
|
||||||
|
};
|
||||||
|
|
||||||
|
"PVDZE_PingSend" addPublicVariableEventHandler {PVDZE_PingReceived = 1; (owner (_this select 1)) publicVariableClient "PVDZE_PingReceived";};
|
||||||
|
|
||||||
|
"PVDZ_Server_Simulation" addPublicVariableEventHandler {
|
||||||
|
local _agent = (_this select 1) select 0;
|
||||||
|
local _control = (_this select 1) select 1;
|
||||||
|
|
||||||
|
_agent enableSimulation _control;
|
||||||
|
};
|
||||||
|
|
||||||
|
"PVDZ_obj_Delete" addPublicVariableEventHandler {
|
||||||
|
local _obj = (_this select 1) select 0;
|
||||||
|
local _player = (_this select 1) select 1;
|
||||||
|
local _type = typeOf _obj;
|
||||||
|
local _dis = _player distance _obj;
|
||||||
|
|
||||||
|
if (_type in Dayz_plants) then {
|
||||||
|
if (_dis < 3) then {
|
||||||
|
deleteVehicle _obj;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_type == "Blood_Trail_DZ") then {
|
||||||
|
deleteVehicle _obj;
|
||||||
|
};
|
||||||
|
|
||||||
|
//Make sure object is a cardboardbox and make sure the player distance is under 15 meters from object
|
||||||
|
if (_type iskindOf "CardboardBox") then {
|
||||||
|
if (_dis < 15) then {
|
||||||
|
deleteVehicle _obj;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
"PVDZ_serverStoreVar" addPublicVariableEventHandler {
|
||||||
|
local _obj = (_this select 1) select 0;
|
||||||
|
local _name = (_this select 1) select 1;
|
||||||
|
local _value = (_this select 1) select 2;
|
||||||
|
|
||||||
|
_obj setVariable [_name, _value];
|
||||||
|
};
|
||||||
|
|
||||||
|
"PVDZ_sec_atp" addPublicVariableEventHandler {
|
||||||
|
local _y = _this select 1;
|
||||||
|
|
||||||
|
call {
|
||||||
|
if (typeName _y == "STRING") exitwith { // just some logs from the client
|
||||||
|
diag_log _y;
|
||||||
|
};
|
||||||
|
if (count _y == 2) exitwith { // wrong side
|
||||||
|
diag_log format["P1ayer %1 reports possible 'side' hack. Server may be compromised!",(_y select 1) call fa_plr2Str];
|
||||||
|
};
|
||||||
|
// player hit
|
||||||
|
local _source = _y select 1;
|
||||||
|
if (!isNull _source) then {
|
||||||
|
local _unit = _y select 0;
|
||||||
|
diag_log format ["P1ayer %1 hit by %2 %3 from %4 meters in %5 for %6 damage",
|
||||||
|
_unit call fa_plr2Str, if (!isPlayer _source && alive _source) then {"AI"} else {_source call fa_plr2Str}, _y select 2, _y select 3, _y select 4, _y select 5];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
"PVDZ_objgather_Knockdown" addPublicVariableEventHandler {
|
||||||
|
local _tree = (_this select 1) select 0;
|
||||||
|
local _player = (_this select 1) select 1;
|
||||||
|
local _dis = _player distance _tree;
|
||||||
|
local _name = if (alive _player) then {name _player} else {"DeadPlayer"};
|
||||||
|
local _uid = getPlayerUID _player;
|
||||||
|
local _treeModel = _tree call fn_getModelName;
|
||||||
|
|
||||||
|
if (_dis < 30 && {_treeModel in dayz_trees or (_treeModel in dayz_plant)} && {_uid != ""}) then {
|
||||||
|
_tree setDamage 1;
|
||||||
|
dayz_choppedTrees set [count dayz_choppedTrees,_tree];
|
||||||
|
diag_log format["Server setDamage on tree or plant %1 chopped down by %2(%3)",_treeModel,_name,_uid];
|
||||||
|
};
|
||||||
|
};
|
||||||
@@ -53,10 +53,8 @@ spawn_vehicles = compile preprocessFileLineNumbers "\z\addons\dayz_server\compil
|
|||||||
call compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_changeCode.sqf";
|
call compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_changeCode.sqf";
|
||||||
|
|
||||||
server_medicalSync = {
|
server_medicalSync = {
|
||||||
private ["_player","_array"];
|
local _player = _this select 0;
|
||||||
|
local _array = _this select 1;
|
||||||
_player = _this select 0;
|
|
||||||
_array = _this select 1;
|
|
||||||
|
|
||||||
_player setVariable ["USEC_isDead",(_array select 0)]; //0
|
_player setVariable ["USEC_isDead",(_array select 0)]; //0
|
||||||
_player setVariable ["NORRN_unconscious",(_array select 1)]; //1
|
_player setVariable ["NORRN_unconscious",(_array select 1)]; //1
|
||||||
@@ -74,21 +72,9 @@ server_medicalSync = {
|
|||||||
_player setVariable ["messing",(_array select 13)]; //13
|
_player setVariable ["messing",(_array select 13)]; //13
|
||||||
_player setVariable ["blood_testdone",(_array select 14)]; //14
|
_player setVariable ["blood_testdone",(_array select 14)]; //14
|
||||||
};
|
};
|
||||||
/*
|
|
||||||
dayz_Achievements = {
|
|
||||||
_achievementID = (_this select 0) select 0;
|
|
||||||
_player = (_this select 0) select 1;
|
|
||||||
_playerOwnerID = owner _player;
|
|
||||||
|
|
||||||
_achievements = _player getVariable "Achievements";
|
|
||||||
_achievements set [_achievementID,1];
|
|
||||||
_player setVariable ["Achievements",_achievements];
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
|
|
||||||
vehicle_handleServerKilled = {
|
vehicle_handleServerKilled = {
|
||||||
private "_unit";
|
local _unit = _this select 0;
|
||||||
_unit = _this select 0;
|
|
||||||
|
|
||||||
[_unit,"killed",false,false,"SERVER",dayz_serverKey] call server_updateObject;
|
[_unit,"killed",false,false,"SERVER",dayz_serverKey] call server_updateObject;
|
||||||
_unit removeAllMPEventHandlers "MPKilled";
|
_unit removeAllMPEventHandlers "MPKilled";
|
||||||
@@ -99,22 +85,20 @@ vehicle_handleServerKilled = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
check_publishobject = {
|
check_publishobject = {
|
||||||
private ["_saveObject","_allowed","_object","_playername"];
|
local _object = _this select 0;
|
||||||
|
local _playername = _this select 1;
|
||||||
_object = _this select 0;
|
local _allowed = false;
|
||||||
_playername = _this select 1;
|
|
||||||
_allowed = false;
|
|
||||||
|
|
||||||
#ifdef OBJECT_DEBUG
|
#ifdef OBJECT_DEBUG
|
||||||
diag_log format["DEBUG: Checking if Object: %1 is allowed, published by %2",_object,_playername];
|
diag_log format["DEBUG: Checking if Object: %1 is allowed, published by %2",_object,_playername];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((typeOf _object) in DayZ_SafeObjects) then {
|
if ((typeOf _object) in DayZ_SafeObjects) then {
|
||||||
_saveObject = "DayZ_SafeObjects";
|
|
||||||
_allowed = true;
|
_allowed = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef OBJECT_DEBUG
|
#ifdef OBJECT_DEBUG
|
||||||
|
local _saveObject = "DayZ_SafeObjects";
|
||||||
diag_log format["DEBUG: Object: %1 published by %2 is allowed by %3",_object,_playername,_saveObject];
|
diag_log format["DEBUG: Object: %1 published by %2 is allowed by %3",_object,_playername,_saveObject];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -122,19 +106,17 @@ check_publishobject = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
server_hiveWrite = {
|
server_hiveWrite = {
|
||||||
private "_data";
|
|
||||||
//diag_log ("ATTEMPT WRITE: " + _this);
|
//diag_log ("ATTEMPT WRITE: " + _this);
|
||||||
_data = "HiveExt" callExtension _this;
|
local _data = "HiveExt" callExtension _this;
|
||||||
//diag_log ("WRITE: " +str(_data));
|
//diag_log ("WRITE: " +str(_data));
|
||||||
};
|
};
|
||||||
|
|
||||||
server_hiveReadWrite = {
|
server_hiveReadWrite = {
|
||||||
private ["_key","_resultArray","_data"];
|
local _key = _this;
|
||||||
_key = _this;
|
|
||||||
//diag_log ("ATTEMPT READ/WRITE: " + _key);
|
//diag_log ("ATTEMPT READ/WRITE: " + _key);
|
||||||
_data = "HiveExt" callExtension _key;
|
local _data = "HiveExt" callExtension _key;
|
||||||
//diag_log ("READ/WRITE: " +str(_data));
|
//diag_log ("READ/WRITE: " +str(_data));
|
||||||
_resultArray = call compile str formatText["%1", _data];
|
local _resultArray = call compile str formatText["%1", _data];
|
||||||
if (isNil "_resultArray") then {_resultArray = "HIVE CONNECTION ERROR";};
|
if (isNil "_resultArray") then {_resultArray = "HIVE CONNECTION ERROR";};
|
||||||
_resultArray
|
_resultArray
|
||||||
};
|
};
|
||||||
@@ -142,11 +124,12 @@ server_hiveReadWrite = {
|
|||||||
onPlayerDisconnected "[_uid,_name] call server_onPlayerDisconnect;";
|
onPlayerDisconnected "[_uid,_name] call server_onPlayerDisconnect;";
|
||||||
|
|
||||||
server_getStatsDiff = {
|
server_getStatsDiff = {
|
||||||
private ["_player","_playerUID","_new","_old","_result","_statsArray"];
|
local _player = _this select 0;
|
||||||
_player = _this select 0;
|
local _playerUID = _this select 1;
|
||||||
_playerUID = _this select 1;
|
local _result = [];
|
||||||
_result = [];
|
local _statsArray = missionNamespace getVariable _playerUID;
|
||||||
_statsArray = missionNamespace getVariable _playerUID;
|
local _new = 0;
|
||||||
|
local _old = 0;
|
||||||
|
|
||||||
if (isNil "_statsArray") exitWith {
|
if (isNil "_statsArray") exitWith {
|
||||||
diag_log format["Server_getStatsDiff error: playerUID %1 not found on server",_playerUID];
|
diag_log format["Server_getStatsDiff error: playerUID %1 not found on server",_playerUID];
|
||||||
@@ -169,84 +152,76 @@ server_getStatsDiff = {
|
|||||||
|
|
||||||
//seems max is 19 digits
|
//seems max is 19 digits
|
||||||
dayz_objectUID2 = {
|
dayz_objectUID2 = {
|
||||||
private["_position","_dir","_time" ,"_key"];
|
local _dir = _this select 0;
|
||||||
_dir = _this select 0;
|
local _time = round diag_tickTime;
|
||||||
_time = round diag_tickTime;
|
|
||||||
if (_time > 99999) then {_time = round(random 99999);}; //prevent overflow if server isn't restarted
|
if (_time > 99999) then {_time = round(random 99999);}; //prevent overflow if server isn't restarted
|
||||||
_key = "";
|
local _key = "";
|
||||||
_position = _this select 1;
|
local _position = _this select 1;
|
||||||
_key = format["%1%2%3%4", round(_time + abs(_position select 0)), round(_dir), round(abs(_position select 1)), _time];
|
_key = format["%1%2%3%4", round(_time + abs(_position select 0)), round(_dir), round(abs(_position select 1)), _time];
|
||||||
_key;
|
_key;
|
||||||
};
|
};
|
||||||
|
|
||||||
dayz_recordLogin = {
|
dayz_recordLogin = {
|
||||||
private ["_key","_status","_name"];
|
local _key = format["CHILD:103:%1:%2:%3:",_this select 0,_this select 1,_this select 2];
|
||||||
_key = format["CHILD:103:%1:%2:%3:",_this select 0,_this select 1,_this select 2];
|
|
||||||
_key call server_hiveWrite;
|
_key call server_hiveWrite;
|
||||||
|
|
||||||
_status = call {
|
local _status = call {
|
||||||
if ((_this select 2) == 0) exitwith { "CLIENT LOADED & PLAYING" };
|
if ((_this select 2) == 0) exitwith { "CLIENT LOADED & PLAYING" };
|
||||||
if ((_this select 2) == 1) exitwith { "LOGIN PUBLISHING, Location " +(_this select 4) };
|
if ((_this select 2) == 1) exitwith { "LOGIN PUBLISHING, Location " +(_this select 4) };
|
||||||
if ((_this select 2) == 2) exitwith { "LOGGING IN" };
|
if ((_this select 2) == 2) exitwith { "LOGGING IN" };
|
||||||
if ((_this select 2) == 3) exitwith { "LOGGED OUT, Location " +(_this select 4) };
|
if ((_this select 2) == 3) exitwith { "LOGGED OUT, Location " +(_this select 4) };
|
||||||
};
|
};
|
||||||
|
|
||||||
_name = if (typeName (_this select 3) == "ARRAY") then { toString (_this select 3) } else { _this select 3 };
|
local _name = if (typeName (_this select 3) == "ARRAY") then { toString (_this select 3) } else { _this select 3 };
|
||||||
diag_log format["INFO - Player: %1(UID:%3/CID:%4) Status: %2",_name,_status,(_this select 0),(_this select 1)];
|
diag_log format["INFO - Player: %1(UID:%3/CID:%4) Status: %2",_name,_status,(_this select 0),(_this select 1)];
|
||||||
};
|
};
|
||||||
|
|
||||||
generate_new_damage = {
|
generate_new_damage = {
|
||||||
private "_damage";
|
local _damage = ((random(DynamicVehicleDamageHigh-DynamicVehicleDamageLow))+DynamicVehicleDamageLow) / 100;
|
||||||
_damage = ((random(DynamicVehicleDamageHigh-DynamicVehicleDamageLow))+DynamicVehicleDamageLow) / 100;
|
|
||||||
_damage
|
_damage
|
||||||
};
|
};
|
||||||
|
|
||||||
server_hiveReadWriteLarge = {
|
server_hiveReadWriteLarge = {
|
||||||
private["_key","_resultArray","_data"];
|
local _key = _this;
|
||||||
_key = _this;
|
local _data = "HiveExt" callExtension _key;
|
||||||
_data = "HiveExt" callExtension _key;
|
local _resultArray = call compile _data;
|
||||||
_resultArray = call compile _data;
|
|
||||||
_resultArray
|
_resultArray
|
||||||
};
|
};
|
||||||
|
|
||||||
// coor2str: convert position to a GPS coordinates
|
// coor2str: convert position to a GPS coordinates
|
||||||
fa_coor2str = {
|
fa_coor2str = {
|
||||||
private["_pos","_res","_nearestCity","_town"];
|
local _pos = +(_this);
|
||||||
|
|
||||||
_pos = +(_this);
|
|
||||||
if (count _pos < 1) then {
|
if (count _pos < 1) then {
|
||||||
_pos = [0,0];
|
_pos = [0,0];
|
||||||
} else {
|
} else {
|
||||||
if (count _pos < 2) then { _pos = [_pos select 0,0]; };
|
if (count _pos < 2) then { _pos = [_pos select 0,0]; };
|
||||||
};
|
};
|
||||||
_nearestCity = nearestLocations [_pos, ["NameCityCapital","NameCity","NameVillage","NameLocal"],1000];
|
local _nearestCity = nearestLocations [_pos, ["NameCityCapital","NameCity","NameVillage","NameLocal"],1000];
|
||||||
_town = "Wilderness";
|
local _town = "Wilderness";
|
||||||
if (count _nearestCity > 0) then {_town = text (_nearestCity select 0)};
|
if (count _nearestCity > 0) then {_town = text (_nearestCity select 0)};
|
||||||
_res = format["%1 [%2]", _town, mapGridPosition _pos];
|
local _res = format["%1 [%2]", _town, mapGridPosition _pos];
|
||||||
|
|
||||||
_res
|
_res
|
||||||
};
|
};
|
||||||
|
|
||||||
// print player player PID and name. If name unknown then print UID.
|
// print player player PID and name. If name unknown then print UID.
|
||||||
fa_plr2str = {
|
fa_plr2str = {
|
||||||
private["_x","_res","_name"];
|
local _y = _this;
|
||||||
_x = _this;
|
local _res = "nobody";
|
||||||
_res = "nobody";
|
if (!isNil "_y") then {
|
||||||
if (!isNil "_x") then {
|
local _name = _y getVariable ["bodyName", nil];
|
||||||
_name = _x getVariable ["bodyName", nil];
|
if ((isNil "_name" OR {(_name == "")}) AND ({alive _y})) then { _name = name _y; };
|
||||||
if ((isNil "_name" OR {(_name == "")}) AND ({alive _x})) then { _name = name _x; };
|
if (isNil "_name" OR {(_name == "")}) then { _name = "UID#"+(getPlayerUID _y); };
|
||||||
if (isNil "_name" OR {(_name == "")}) then { _name = "UID#"+(getPlayerUID _x); };
|
_res = format["PID#%1(%2)", owner _y, _name ];
|
||||||
_res = format["PID#%1(%2)", owner _x, _name ];
|
|
||||||
};
|
};
|
||||||
_res
|
_res
|
||||||
};
|
};
|
||||||
|
|
||||||
array_reduceSize = {
|
array_reduceSize = {
|
||||||
private ["_array1","_array","_count","_num"];
|
local _array1 = _this select 0;
|
||||||
_array1 = _this select 0;
|
local _array = _array1 - ["Hatchet_Swing","Crowbar_Swing","Machete_Swing","Bat_Swing","BatBarbed_Swing","BatNails_Swing","Fishing_Swing","Sledge_Swing","CSGAS"];
|
||||||
_array = _array1 - ["Hatchet_Swing","Crowbar_Swing","Machete_Swing","Bat_Swing","BatBarbed_Swing","BatNails_Swing","Fishing_Swing","Sledge_Swing","CSGAS"];
|
local _count = _this select 1;
|
||||||
_count = _this select 1;
|
local _num = count _array;
|
||||||
_num = count _array;
|
|
||||||
if (_num > _count) then {
|
if (_num > _count) then {
|
||||||
_array resize _count;
|
_array resize _count;
|
||||||
};
|
};
|
||||||
@@ -255,4 +230,5 @@ array_reduceSize = {
|
|||||||
|
|
||||||
// Precise base building 1.0.5
|
// Precise base building 1.0.5
|
||||||
call compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\kk_functions.sqf";
|
call compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\kk_functions.sqf";
|
||||||
|
call compile preprocessFileLineNumbers "\z\addons\dayz_server\eventHandlers\server_eventHandler.sqf";
|
||||||
#include "mission_check.sqf"
|
#include "mission_check.sqf"
|
||||||
@@ -418,45 +418,6 @@ publicVariable "sm_done";
|
|||||||
|
|
||||||
execVM "\z\addons\dayz_server\system\lit_fireplaces.sqf";
|
execVM "\z\addons\dayz_server\system\lit_fireplaces.sqf";
|
||||||
|
|
||||||
"PVDZ_sec_atp" addPublicVariableEventHandler {
|
|
||||||
private ["_y","_unit","_source"];
|
|
||||||
|
|
||||||
_y = _this select 1;
|
|
||||||
|
|
||||||
call {
|
|
||||||
if (typeName _y == "STRING") exitwith { // just some logs from the client
|
|
||||||
diag_log _y;
|
|
||||||
};
|
|
||||||
if (count _y == 2) exitwith { // wrong side
|
|
||||||
diag_log format["P1ayer %1 reports possible 'side' hack. Server may be compromised!",(_y select 1) call fa_plr2Str];
|
|
||||||
};
|
|
||||||
// player hit
|
|
||||||
_unit = _y select 0;
|
|
||||||
_source = _y select 1;
|
|
||||||
if (!isNull _source) then {
|
|
||||||
diag_log format ["P1ayer %1 hit by %2 %3 from %4 meters in %5 for %6 damage",
|
|
||||||
_unit call fa_plr2Str, if (!isPlayer _source && alive _source) then {"AI"} else {_source call fa_plr2Str}, _y select 2, _y select 3, _y select 4, _y select 5];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
"PVDZ_objgather_Knockdown" addPublicVariableEventHandler {
|
|
||||||
private ["_tree", "_player", "_dis", "_name", "_uid", "_treeModel"];
|
|
||||||
|
|
||||||
_tree = (_this select 1) select 0;
|
|
||||||
_player = (_this select 1) select 1;
|
|
||||||
_dis = _player distance _tree;
|
|
||||||
_name = if (alive _player) then {name _player} else {"DeadPlayer"};
|
|
||||||
_uid = getPlayerUID _player;
|
|
||||||
_treeModel = _tree call fn_getModelName;
|
|
||||||
|
|
||||||
if (_dis < 30 && {_treeModel in dayz_trees or (_treeModel in dayz_plant)} && {_uid != ""}) then {
|
|
||||||
_tree setDamage 1;
|
|
||||||
dayz_choppedTrees set [count dayz_choppedTrees,_tree];
|
|
||||||
diag_log format["Server setDamage on tree or plant %1 chopped down by %2(%3)",_treeModel,_name,_uid];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
if (_hiveLoaded) then {
|
if (_hiveLoaded) then {
|
||||||
_serverVehicleCounter spawn {
|
_serverVehicleCounter spawn {
|
||||||
private ["_startTime","_cfgLootFile","_vehLimit"];
|
private ["_startTime","_cfgLootFile","_vehLimit"];
|
||||||
|
|||||||
Reference in New Issue
Block a user