Jump to content
  • 0

DDOS Protection/Heli guard help please?


Th3-Hunter333

Question

Ok guys, trying to get something working here. The heli guard/ddos protection for helis script located here.

Spoiler

 

Obviously this isnt working ive Tried multiple different ways of implementing this and cant seem to figure it out. Im testing it by flying up and then alt tabbing from game and shutting the exe down in task manager.

Heli_Guard.sqf

Spoiler

//===========================================
// DDOS Heli Guard by Donnovan from Brazil.
//===========================================
// Don't remove credits.
//===========================================
// Changed for Epoch 1.0.6.1 by !_RedLink_! from Russia
//===========================================
private ["_message"];

//CHECK PILOT STATE AND IGNITE PROTECTION
if (hasInterface) then 
{
    while {true} do 
    {
        while {vehicle player != player} do 
        {
            _veh = vehicle player;
            if (_veh isKindOf "Air" && !(_veh isKindOf "ParachuteBase")) then 
            {
                if (driver _veh == player) then 
                {
                    _vehProtected = _veh getVariable ["donn_protect",false];
                    if (!_vehProtected) then 
                    {
                        _veh setVariable ["donn_protect",true,true];
                        donn_heli_monitor = _veh;
                        publicVariableServer "donn_heli_monitor";
                        //_message = format ["%1 (%2) lost connection %3 landed @%4", dayz_playerName, dayz_playerUID, _veh, mapGridPosition (getPosATL _veh)];
                    };
                    uiSleep 5;
                } else 
                {
                    uiSleep 5;
                };
            } else 
            {
                uiSleep 5;
            };
            uiSleep 3;
        };
        uiSleep 5;
    };
};
//PROTECT THE HELI
if (isServer) then 
{
    "donn_heli_monitor" addPublicVariableEventHandler 
    {
        _veh = _this select 1;
        _veh spawn 
        {
            _veh = _this;
            _crew = crew _veh;_crewOk = [];
            waitUntil {uiSleep 1.5;_crewOk = _crew;_crew = crew _veh;count _crew == 0};
        // changed !_RedLink_! start
            _abort=false;
            if((fuel _veh)<0.01)then{_abort=true;};
            {
                if (([_veh,_x] call object_getHit)>0.7)then
                    {
                        if(["Engine",_x,false] call fnc_inString)exitWith{_abort=true;};
                        if(["VRotor",_x,false] call fnc_inString)exitWith{_abort=true;};
                        if(["HRotor",_x,false] call fnc_inString)exitWith{_abort=true;};
                        if(["HitHull",_x,false] call fnc_inString)exitWith{_abort=true;};
                    };
            }forEach(_veh call vehicle_getHitpoints);
            if(_abort)exitWith
            {
                _veh setVariable ["donn_protect",false,true];
                diag_log (format["DDOS_HELI_GUARD: Техника: %1 в плохом состоянии, уничтожена.",_veh]);
                PVDZ_sec_atp = toArray (format ["DDOS_HELI_GUARD: Техника: %1 в плохом состоянии, уничтожена @%2.",_veh, mapGridPosition (getPosATL _veh)]);
                publicVariableServer "PVDZ_sec_atp";
            };
        // changed !_RedLink_! end
            _mans = nearestObjects [getPosATL _veh,["CAManBase"],100];
            _air = (getPosATL _veh) nearEntities ["Air",100];
            _DDOS = true;
            {if (_x in _mans) exitwith {_DDOS = false;};} forEach _crewOk;
            {_passenger = _x;{if (_passenger in crew _x) exitwith {_DDOS = false;};} forEach _air;} forEach _crewOk;
            if (_DDOS && ((getPosATL _veh) select 2) > 1.5) then 
            {
                private ["_vPosNew"];
                _vPos = getPosATL _veh;_mapCenter = getMarkerPos "center";_vehSafeRadius = (sizeOf typeOf _veh)/2 + 4;
                for "_k" from 1 to 100 do 
                {
                    _vPosNew = [[_vPos select 0,_vPos select 1,0],(18+(_k-1)*2)*(_k-1),(18+_k*2)*_k,_vehSafeRadius,0,15,0,[],[_mapCenter,[0,0,0]]] call BIS_fnc_findSafePos;
                    _x1 = round (_mapCenter select 0);_y1 = round (_mapCenter select 1);
                    _x2 = round (_vPosNew select 0);_y2 = round (_vPosNew select 1);
                    if !(_x1 == _x2 && _y1 == _y2) exitWith {};
                };
            // changed !_RedLink_! start
                if ((parseNumber(_veh getVariable ["CharacterID","0"])) !=0) then
                {[_veh,true] call local_lockUnlock;};
                //PVDZE_veh_Lock = [_veh,true];
                //publicVariable "PVDZE_veh_Lock";
                //};
            // changed !_RedLink_! end
                _vPosNew = [_vPosNew select 0,_vPosNew select 1,0.5];
                _veh setPosATL _vPosNew;
                _veh setVectorUp surfaceNormal _vPosNew;
                _veh setVelocity [0,0,0];
                _fuel = fuel _veh;
                _veh setFuel 0;
                uiSleep 2.5;
                _veh setFuel _fuel;
            // changed !_RedLink_! start
                PVDZ_veh_Save = [_veh, "all"];
                publicVariableServer "PVDZ_veh_Save";
            // changed !_RedLink_! end
                //_message = format ["%1 (%2) lost connection %3 landed @%4", dayz_playerName, dayz_playerUID, _veh, mapGridPosition (getPosATL _veh)];
            };
            _veh setVariable ["donn_protect",false,true];
        };
    };
};

Line im using to call this inside the main init.sqf at the bottom of the file

Spoiler

    //DDOS Heli Guard
    execVM "scripts\ddosHeliGuard\Heli_Guard.sqf";

No errors client sided or server sided 

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Under dayz_server.pbo inside of compile/server_onPlayerDisconnect.sqf i have also added this line of code to no availability in getting this script to work so im still at a loss here

// DDOS Heli Guard
if ((vehicle player) isKindOf "AIR") then {
                if (driver (vehicle player) == player) then {
                    _pos = ([((vehicle player) call fnc_getPos),10,1000,2,0,5,0] call BIS_fnc_findSafePos); //AH_fnc_getPos
                    [(vehicle player),[_pos select 0,_pos select 1,2]] call fnc_setPos; //AH_fnc_setPos
                    sleep 1;
                    {if (_x != player) then {_x action ['Eject',(vehicle player)]}} forEach (crew (vehicle player));
                    player action ['Eject',(vehicle player)];
                } else {
                    waitUntil {(vehicle player == player)};
                    sleep 1;
                };
            } else {
                sleep 1;
                {if (_x != player) then {_x action ['Eject',(vehicle player)]}} forEach (crew (vehicle player));
                player action ['Eject',(vehicle player)];
};

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...