// This script is written by AWA
// Modified by FallingSheep
private["_antihack","_array","_player","_hackType","_hackValue"];
diag_log "ANTI-HACK 0.1 Loading...";
_antihack =
{
// We wait for the player to login
waitUntil { sleep 1; !isNil 'PVDZE_plr_LoginRecord' };
//Banned items/weapons check
[] spawn
{
while {true} do
{
_items = weapons player;
{
if (_x in _items) then
{
player removeWeapon _x;
serverMSG = [name player, 'Hacked Item'];
publicVariableServer 'serverMSG';
diag_log "ANTI-HACK 0.1: Removed banned item/weapon!";
};
} forEach ['BAF_AS50_TWS','UZI_SD_EP1'];
sleep 30;
};
};
// Anti-teleport (Made by West-Tom(?))
[] spawn
{
private["_curposes","_lastPoses","_curTime","_lastTime","_distance","_distance2","_difftime","_speed","_maxspeed","_mount","_FPS","_getpos"];
while {true} do
{
_curposes = getPosASL player;
_lastPoses = player getVariable["lastKnownPosition", _curposes];
_curTime = time;
_lastTime = player getVariable ["lastPOS", _curtime];
_distance = _lastPoses distance _curPoses;
_difftime = _curtime - _lasttime;
if (_difftime == 0) then
{
_difftime = 0.001;
};
_speed = _distance / _difftime;
_maxspeed = 30;
_mount = vehicle player;
if (_mount == player && _speed > _maxspeed && (_curPoses select 0) > 2 AND (_lastPoses select 0) > 2) then
{
diag_log "ANTI-HACK 0.1: Found teleport attempt!";
player setPosASL _lastPoses;
}else{
player setVariable["lastKnownPosition", _curposes];
player setVariable ["lastPOS", _curtime];
};
sleep 0.1;
};
while {true} do {
_FPS = round(diag_fps);
if (_FPS < 6) then {
PVAHR_ = 'Kick';
publicVariableClient "PVAHR_";
}else{
sleep 10;
};
};
while{true} do {
_getpos = getpos player;
uisleep 1.5;
_distance2 = player distance _getpos;
if (_distance2 > 40 ) then {
PVAHR_ = 'Kick';
publicVariableClient "PVAHR_";
};
};
};
// Detection of hack variables (Made by ???)
[] spawn
{private["_sleepVariableCheck", "_badPublicVariables"];
_sleepVariableCheck = 30;
_badPublicVariables =
["pic", "veh", "god", "wuat_fpsMonitor", "unitList", "list_wrecked",
"p", "fffffffffff", "markPos", "pos", "marker", "TentS", "VL", "MV",
"mk2", "i", "j", "fuckmegrandma", "mehatingjews", "scode", "TTT5OptionNR",
"igodokxtt", "omgwtfbbq", "namePlayer", "thingtoattachto", "HaxSmokeOn", "v",
"antiloop", "ARGT_JUMP", "selecteditem", "moptions", "delaymenu", "gluemenu",
"spawnweapons1", "abcd", "skinmenu", "playericons", "changebackpack", "keymenu",
"img", "surrmenu", "footSpeedIndex", "ctrl_onKeyDown", "plrshldblcklst",
"musekeys", "dontAddToTheArray", "morphtoanimals", "playerDistanceScreen",
"debugConsoleIndex", "MY_KEYDOWN_FNC", "TAG_onKeyDown", "changestats", "helpmenu",
"unitsmenu", "xZombieBait", "shnmenu", "slag", "tempslag", "dayzRespawn2", "dayzRespawn3",
"hangender", "addgun", "ESP", "BIS_fnc_3dCredits_n", "ViLayer", "maphalf", "activeITEMlist",
"activeITEMlistanzahl", "xyzaa", "iBeFlying", "rem", "DAYZ_CA1_Lollipops", "bowonky", "HMDIR", "HDIR"];
diag_log "ANTI-HACK 0.1 - Detection of hack variables started!";
while {true} do{
{
if !(isNil _x) exitWith
{
diag_log "ANTI-HACK 0.1 Found a hack variable!";
// Notify the server!
serverMSG = [player, "hacked variable", _x];
publicVariableServer "serverMSG";
// Do a remote execution to get detected!
// The hack variable is also passed to BE logs.
player setVehicleInit format ["hint '%1';", _x];
processInitCommands;
clearVehicleInit player;
};
} forEach _badPublicVariables;
sleep _sleepVariableCheck;
};
};
// Detecting hack menus (Made by AWA)
[] spawn
{
private["_keyDownHandlerCount", "_keyUpHandlerCount", "_ctrlDrawHandlerCount"];
diag_log "ANTI-HACK 0.1 - Hack menu check started!";
while {true} do{
(findDisplay 46) displayRemoveAllEventHandlers "KeyUp";
((findDisplay 12) displayCtrl 51) ctrlRemoveAllEventHandlers "Draw";
if (!(isNull findDisplay 3030) || !(isNull findDisplay 155)) then
{
diag_log "ANTI-HACK 0.1 - Found a hack menu!";
serverMSG = [player, "hack menu", _x];
publicVariableServer "serverMSG";
player setVehicleInit "hint 'menu';";
processInitCommands;
clearVehicleInit player;
};
sleep 5;
};
};
// Block/reset godmode & more (Made by AWA)
[] spawn
{
private["_sleepGodModeCheck", "_terrainGrid","_recoilSettings","_zombieCheck","_damageHandler","_unconsciousFunction"];
_sleepGodModeCheck = 5;
_terrainGrid = 25;
_recoilSettings = unitRecoilCoefficient player;
_zombieCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_zombieCheck.sqf";
_damageHandler = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_damageHandler.sqf";
_unconsciousFunction = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_unconscious.sqf";
diag_log "ANTI-HACK 0.1 Godmode check started!";
while {true} do{
if ((player getPlayerUID in AdminList) || (!canbuild))then{
//do nothing as they are and admin or in safezone
}else{
player_zombieCheck = _zombieCheck;
fnc_usec_damageHandler = _damageHandler;
fnc_usec_unconscious = _unconsciousFunction;
player removeAllEventHandlers "handleDamage";
player addEventHandler ["handleDamage",{ _this call fnc_usec_damageHandler;0 }];
player allowDamage true;
if (unitRecoilCoefficient player != _recoilSettings) exitWith
{
diag_log "ANTI-HACK 0.1 Detected recoil hack!";
serverMSG = [player, "no recoil", "null"];
publicVariableServer "serverMSG";
player setVehicleInit format ["hint 'No recoil: %1, %2';", "no recoil", unitRecoilCoefficient player];
processInitCommands;
clearVehicleInit player;
};
setTerrainGrid _terrainGrid;
playableUnits = [player];
allUnits = [player];
allMissionObjects = [player];
entities = [player];
sleep _sleepGodModeCheck;
};
};
// Detect hacked/spawned vehicles (made by AWA)
[] spawn
{
private["_sleepVehicleCheck", "_legitVehicles"];
_sleepVehicleCheck = 15;
_legitVehicles = ["", "TentStorage", "ParachuteWest", "Wire_cat1", "Hedgehog", "Sandbag1_DZ", "BearTrap_DZ","Old_bike_TK_CIV_EP1","TT650_Civ","CSJ_GyroC"];
{_x setVariable ["serverLEGIT", "1", false];} forEach vehicles;
while {true} do
{
{
// Check that this isn't a legit spawn
if(format ["%1", _x getVariable "serverLEGIT"] != "1" && !(format ["%1", typeOf _x] in _legitVehicles)) then
{
diag_log "ANTI-HACK 0.1: Found a hacked vehicle!";
// Notify the server!
serverMSG = [player, "hacked vehicle", typeOf _x];
publicVariableServer "serverMSG";
player setVehicleInit format ["hint 'Hacked vehicle: %1';", typeOf _x];
processInitCommands;
clearVehicleInit player;
};
} forEach vehicles;
sleep _sleepVehicleCheck;
};
};
};
diag_log "ANTI-HACK 0.1: Adding public variable handler";
"serverMSG" addPublicVariableEventHandler
{
_array = _this select 1;
_player = _array select 0;
_hackType = _array select 1;
_hackValue = format ["%1", _array select 2];
diag_log format ["ANTI-HACK 0.1: %1 (%2) was detected for %3 with the value '%4'", name _player, getPlayerUID _player, _hackType, _hackValue];
};
// Send the anti-hack to all clients, even those connecting after this!
[nil, nil, "per", rSPAWN, [], _antihack] call RE;
diag_log "ANTI-HACK 0.1: Anti-hack Loaded!";