mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 12:12:34 +03:00
Update server_sendToClient.sqf
Added server side security for higher risk PVDZ_send usage. Replace switch do block with inline function. Since only one option is selected for each call, a function using exitWith is the better option here. The transfuse completed option was removed. It is not used anywhere. Added options for drag, carry, load, and unconscious. There is a commented diag_log in the security check than can be used if server owners want it. However, Battleye logs all PVDZ_send usage.
This commit is contained in:
@@ -1,14 +1,29 @@
|
|||||||
private ["_unit","_variable","_arraytosend","_owner","_vehicle","_qty"];
|
private ["_unit","_variable","_arraytosend","_owner","_vehicle","_qty","_exitReason"];
|
||||||
//Inbound [_unit,"PVCDZ_hlt_Transfuse",[_unit,player,1000]]
|
//Inbound [_unit,"PVCDZ_hlt_Transfuse",[_unit,player,1000]]
|
||||||
_unit = _this select 0;
|
_unit = _this select 0;
|
||||||
_variable = _this select 1;
|
_variable = _this select 1;
|
||||||
_arraytosend = _this select 2;
|
_arraytosend = _this select 2;
|
||||||
_owner = owner _unit;
|
_owner = owner _unit;
|
||||||
|
_exitReason = "";
|
||||||
|
|
||||||
|
// Add security for higher risk PVDZ_Send usage
|
||||||
|
if (_variable in ["Unconscious","DragPlayer","DropPlayer","Legs","RemoveObject","CarryPlayer","LoadWounded","UnloadWounded"]) then {
|
||||||
|
private ["_verifyArray","_objPos","_clientKey","_activatingPlayer","_playerUID"];
|
||||||
|
_verifyArray = _this select 3;
|
||||||
|
_objPos = _verifyArray select 0; // can be object or position
|
||||||
|
_clientKey = _verifyArray select 1;
|
||||||
|
_activatingPlayer = _verifyArray select 2;
|
||||||
|
_playerUID = getPlayerUID _activatingPlayer;
|
||||||
|
_exitReason = [_verifyArray,_variable,_objPos,_clientKey,_playerUID,_activatingPlayer] call server_verifySender;
|
||||||
|
//diag_log text format ["server_sendToClient: Player [%1:%2] used function %3 on/at %4.",(name _activatingPlayer),_playerUID,_variable,_objPos];
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_exitReason != "") exitWith {diag_log _exitReason};
|
||||||
|
|
||||||
//diag_log format ["%1, %2, %3, %4", _unit, _variable, _arraytosend, _owner];
|
//diag_log format ["%1, %2, %3, %4", _unit, _variable, _arraytosend, _owner];
|
||||||
|
|
||||||
switch (_variable) do {
|
call {
|
||||||
case "VehHandleDam": {
|
if (_variable == "VehHandleDam") exitWith {
|
||||||
_vehicle = _arraytosend select 0;
|
_vehicle = _arraytosend select 0;
|
||||||
if (local _vehicle) then {
|
if (local _vehicle) then {
|
||||||
_arraytosend call fnc_veh_handleDam;
|
_arraytosend call fnc_veh_handleDam;
|
||||||
@@ -18,7 +33,7 @@ switch (_variable) do {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
case "SetFuel": {
|
if (_variable == "SetFuel") exitWith {
|
||||||
_vehicle = _arraytosend select 0;
|
_vehicle = _arraytosend select 0;
|
||||||
_qty = _arraytosend select 1;
|
_qty = _arraytosend select 1;
|
||||||
if (local _vehicle) then {
|
if (local _vehicle) then {
|
||||||
@@ -29,7 +44,7 @@ switch (_variable) do {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
case "SetEngineState": {
|
if (_variable == "SetEngineState") exitWith {
|
||||||
_vehicle = _arraytosend select 0;
|
_vehicle = _arraytosend select 0;
|
||||||
_state = _arraytosend select 1;
|
_state = _arraytosend select 1;
|
||||||
if (local _vehicle) then {
|
if (local _vehicle) then {
|
||||||
@@ -41,91 +56,105 @@ switch (_variable) do {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
case "GutBody": {
|
if (_variable == "GutBody") exitWith {
|
||||||
PVCDZ_obj_GutBody = _arraytosend;
|
PVCDZ_obj_GutBody = _arraytosend;
|
||||||
_owner publicVariableClient "PVCDZ_obj_GutBody";
|
_owner publicVariableClient "PVCDZ_obj_GutBody";
|
||||||
};
|
};
|
||||||
|
|
||||||
case "HideBody": {
|
if (_variable == "HideBody") exitWith {
|
||||||
PVCDZ_obj_HideBody = _arraytosend select 0;
|
PVCDZ_obj_HideBody = _arraytosend select 0;
|
||||||
_owner publicVariableClient "PVCDZ_obj_HideBody";
|
_owner publicVariableClient "PVCDZ_obj_HideBody";
|
||||||
};
|
};
|
||||||
|
|
||||||
case "Humanity": {
|
if (_variable == "Humanity") exitWith {
|
||||||
PVCDZ_plr_Humanity = _arraytosend;
|
PVCDZ_plr_Humanity = _arraytosend;
|
||||||
_owner publicVariableClient "PVCDZ_plr_Humanity";
|
_owner publicVariableClient "PVCDZ_plr_Humanity";
|
||||||
//diag_log ("Humanity" +str(PVCDZ_plr_Humanity));
|
//diag_log ("Humanity" +str(PVCDZ_plr_Humanity));
|
||||||
};
|
};
|
||||||
|
|
||||||
case "dayzSetDate": {
|
if (_variable == "dayzSetDate") exitWith {
|
||||||
dayzSetDate = dayz_storeTimeDate;
|
dayzSetDate = dayz_storeTimeDate;
|
||||||
_owner publicVariableClient "dayzSetDate";
|
_owner publicVariableClient "dayzSetDate";
|
||||||
//diag_log ("Time and date: " +str (dayz_storeTimeDate));
|
//diag_log ("Time and date: " +str (dayz_storeTimeDate));
|
||||||
};
|
};
|
||||||
|
|
||||||
case "Transfuse": {
|
if (_variable == "Transfuse") exitWith {
|
||||||
PVCDZ_hlt_Transfuse = _arraytosend;
|
PVCDZ_hlt_Transfuse = _arraytosend;
|
||||||
_owner publicVariableClient "PVCDZ_hlt_Transfuse";
|
_owner publicVariableClient "PVCDZ_hlt_Transfuse";
|
||||||
_unit setVariable ["medForceUpdate",true];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
case "Transfuse_completed": {
|
if (_variable == "Painkiller") exitWith {
|
||||||
PVCDZ_hlt_Transfuse_completed = true;
|
|
||||||
_owner publicVariableClient "PVCDZ_hlt_Transfuse_completed";
|
|
||||||
_unit setVariable ["medForceUpdate",true];
|
|
||||||
};
|
|
||||||
|
|
||||||
case "Painkiller": {
|
|
||||||
PVCDZ_hlt_PainK = _arraytosend;
|
PVCDZ_hlt_PainK = _arraytosend;
|
||||||
_owner publicVariableClient "PVCDZ_hlt_PainK";
|
_owner publicVariableClient "PVCDZ_hlt_PainK";
|
||||||
_unit setVariable ["medForceUpdate",true];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
case "Morphine": {
|
if (_variable == "Morphine") exitWith {
|
||||||
PVCDZ_hlt_Morphine = _arraytosend;
|
PVCDZ_hlt_Morphine = _arraytosend;
|
||||||
_owner publicVariableClient "PVCDZ_hlt_Morphine";
|
_owner publicVariableClient "PVCDZ_hlt_Morphine";
|
||||||
_unit setVariable ["hit_legs",0,false];
|
|
||||||
_unit setVariable ["hit_hands",0,false];
|
|
||||||
_unit setVariable ["medForceUpdate",true];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
case "Epinephrine": {
|
if (_variable == "Epinephrine") exitWith {
|
||||||
PVCDZ_hlt_Epi = _arraytosend;
|
PVCDZ_hlt_Epi = _arraytosend;
|
||||||
_owner publicVariableClient "PVCDZ_hlt_Epi";
|
_owner publicVariableClient "PVCDZ_hlt_Epi";
|
||||||
_unit setVariable ["medForceUpdate",true];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
case "Bandage": {
|
if (_variable == "Bandage") exitWith {
|
||||||
PVCDZ_hlt_Bandage = _arraytosend;
|
PVCDZ_hlt_Bandage = _arraytosend;
|
||||||
_owner publicVariableClient "PVCDZ_hlt_Bandage";
|
_owner publicVariableClient "PVCDZ_hlt_Bandage";
|
||||||
_unit setVariable ["medForceUpdate",true];
|
|
||||||
//diag_log ("Bandage: " +str(PVCDZ_hlt_Bandage));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
case "Antibiotics": {
|
if (_variable == "Antibiotics") exitWith {
|
||||||
PVCDZ_hlt_AntiB = _arraytosend;
|
PVCDZ_hlt_AntiB = _arraytosend;
|
||||||
_owner publicVariableClient "PVCDZ_hlt_AntiB";
|
_owner publicVariableClient "PVCDZ_hlt_AntiB";
|
||||||
_unit setVariable ["medForceUpdate",true];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
case "Legs": {
|
if (_variable == "Legs") exitWith {
|
||||||
PVCDZ_plr_Legs = _arraytosend;
|
PVCDZ_plr_Legs = _arraytosend;
|
||||||
_owner publicVariableClient "PVCDZ_plr_Legs";
|
_owner publicVariableClient "PVCDZ_plr_Legs";
|
||||||
};
|
};
|
||||||
|
|
||||||
//reset OpenTarget timer
|
if (_variable == "OpenTarget") exitWith {
|
||||||
case "OpenTarget": {
|
|
||||||
_unit setVariable ["OpenTarget",true,true];
|
_unit setVariable ["OpenTarget",true,true];
|
||||||
PVCDZ_OpenTarget_Reset = true;
|
PVCDZ_OpenTarget_Reset = true;
|
||||||
_owner publicVariableClient "PVCDZ_OpenTarget_Reset";
|
_owner publicVariableClient "PVCDZ_OpenTarget_Reset";
|
||||||
};
|
};
|
||||||
|
|
||||||
case "tagFriendly": {
|
if (_variable == "tagFriendly") exitWith {
|
||||||
PVDZE_plr_FriendRQ = _arraytosend;
|
PVDZE_plr_FriendRQ = _arraytosend;
|
||||||
_owner publicVariableClient "PVDZE_plr_FriendRQ";
|
_owner publicVariableClient "PVDZE_plr_FriendRQ";
|
||||||
};
|
};
|
||||||
|
|
||||||
case "RemoveObject": {
|
if (_variable == "Unconscious") exitWith {
|
||||||
|
PVDZ_receiveUnconscious = _arraytosend;
|
||||||
|
_owner publicVariableClient "PVDZ_receiveUnconscious";
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_variable == "DragPlayer") exitWith {
|
||||||
|
PVDZ_drg_RaDrag = _arraytosend;
|
||||||
|
_owner publicVariableClient "PVDZ_drg_RaDrag";
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_variable == "DropPlayer") exitWith {
|
||||||
|
PVDZ_drg_RaDrop = _arraytosend;
|
||||||
|
_owner publicVariableClient "PVDZ_drg_RaDrop";
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_variable == "CarryPlayer") exitWith {
|
||||||
|
PVDZ_drg_RaCarry = _arraytosend;
|
||||||
|
_owner publicVariableClient "PVDZ_drg_RaCarry";
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_variable == "LoadWounded") exitWith {
|
||||||
|
PVDZ_drg_RaLW = _arraytosend;
|
||||||
|
_owner publicVariableClient "PVDZ_drg_RaLW";
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_variable == "UnloadWounded") exitWith {
|
||||||
|
PVDZ_drg_RaUW = _arraytosend;
|
||||||
|
_owner publicVariableClient "PVDZ_drg_RaUW";
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_variable == "RemoveObject") exitWith {
|
||||||
PVDZE_obj_Remove = _arraytosend;
|
PVDZE_obj_Remove = _arraytosend;
|
||||||
{
|
{
|
||||||
_pOwner = owner _x;
|
_pOwner = owner _x;
|
||||||
@@ -134,5 +163,7 @@ switch (_variable) do {
|
|||||||
};
|
};
|
||||||
} forEach playableUnits;
|
} forEach playableUnits;
|
||||||
};
|
};
|
||||||
default { diag_log format ["%1, %2, %3, %4", _unit, _variable, _arraytosend, _owner]; };
|
|
||||||
|
//default
|
||||||
|
diag_log format ["%1, %2, %3, %4", _unit, _variable, _arraytosend, _owner];
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user