Help with _dikCode's

Merg

Well-Known Member
Hello,

I am thinking of creating a script for blocking ALT + F4, F1 and F2.

This is my work so far...
Code:
#include "\vbs2\headers\dikCodes.hpp"
#include "\bin\dikCodes.h"
waitUntil {!IsNil "dayz_animalCheck"};

private ["_dikCode"];
    AK_really_loud_sounds = {[60,15] call fnc_usec_pitchWhine;for "_i" from 1 to 15 do {playSound format ["%1",_this select 0];};};
    AK_slap_them = {_randomnr = [2,-1] call BIS_fnc_selectRandom;(vehicle player) SetVelocity [_randomnr * random (4) * cos getdir (vehicle player), _randomnr * random (4) * cos getdir (vehicle player), random (4)];};



if (_dikCode = 0x3C or 0x3E or 0x3B) then{

        [] spawn AK_slap_them;
   
        ["beat04"] spawn AK_really_loud_sounds;

cuttext ["This key is banned on this server. You will die!", "PLAIN DOWN"];

sleep 2;

player setDamage 1;

};

It does not seem to work, would be happy for any help :)

Thanks
 
also try searching for each key indvidually, if we can get this to work it would be awesome, i ll look into this as well, maybe set it to wipe gear/character if they alt+f4 :p
 
Unless you are looking for the keys combined, alt is used to look freely without turning.

With your current code only hitting alt would kill you, not both combined.

Something like this should work. Might need modified.
Code:
//Get the display
_display = (findDisplay 46);
_display displayAddEventHandler ['KeyUp','_this call NoAltF4'];

NoAltF4 = {
    //Get the keys
    _key = _this select 1;
    _alt = _this select 4;
   
    //If F4 and Alt are hit
    if ((_key == 0x3E) && (_alt)) then
    {
        //And the player is in combat
        _isInCombat = player getVariable['startcombattimer',0];
        if (str _isInCombat != '0') then
        {
            //Kill them
            player setDamage 2;
        };
    };
};
 
Unless you are looking for the keys combined, alt is used to look freely without turning.

With your current code only hitting alt would kill you, not both combined.

Something like this should work. Might need modified.
Code:
//Get the display
_display = (findDisplay 46);
_display displayAddEventHandler ['KeyUp','_this call NoAltF4'];

NoAltF4 = {
    //Get the keys
    _key = _this select 1;
    _alt = _this select 4;
  
    //If F4 and Alt are hit
    if ((_key == 0x3E) && (_alt)) then
    {
        //And the player is in combat
        _isInCombat = player getVariable['startcombattimer',0];
        if (str _isInCombat != '0') then
        {
            //Kill them
            player setDamage 2;
        };
    };
};
Yes, This was just for testing :)
 
also try searching for each key indvidually, if we can get this to work it would be awesome, i ll look into this as well, maybe set it to wipe gear/character if they alt+f4 :p
Cool! I mean there are many anti-combat log scripts out there but this would be a pretty simple one :)
 
i would go like this: ALT+f4 spawns a Z horde that eats the player.
Problem: if the client hangs sometimes you have to alt+F4 to close it.
 
i would go like this: ALT+f4 spawns a Z horde that eats the player.
Problem: if the client hangs sometimes you have to alt+F4 to close it.

1. The problem is that alt-f4 is hardcoded into programs to close the program. Unless you can nullify it and prevent it from closing the game, spawning a zombie horde on them does nothing as they will still exit the game.

2. The client does freeze sometimes, which means you have to close it to get out. However the majority of people end processes the way its intended to be done, which is with the Task Manager. You can hit Ctrl+Alt+Delete to get the user window, and then click task manager, or hit Ctrl+Shift+Esc to directly open Task Manager and then end arma2OA.exe.

The code I posted checks that the player has hit Alt+F4 and is also in combat, which means they have fired a weapon in the last 30 seconds. This shouldn't cause issues unless someone is shooting random stuff, freezes, and then hit Alt+F4. Even then, it is just a death, and a knowledgeable admin who can install scripts instead of copy and paste should know how things work well enough to navigate his database and resurrect the players body.
 
F4 detection does not work when ALT is held first.
Hmm that might be tricky, maybe we could make it si that if the player is in combat and presses F4 it runs the script. I got mine working now kind of...
Code:
dayz_spaceInterrupt = {
    private ["_dikCode", "_handled"];
    _dikCode = _this select 1;
    _handled = false;
    if (_dikCode == 0x3E) then {
        if (debugMonitor) then {
            debugMonitor = false;
            hintSilent "";
        } else {[] spawn fnc_debug;};
    };
    _handled
};
fnc_debug = {
    debugMonitor = true;
    if (debugMonitor) then
    {
        cuttext ["Dont combat log!!", "PLAIN DOWN"];
        [] spawn DS_slap_them;
        sleep 1;
        player setDamage 1;
    };
};

I copied some code from a toggable debug monitor.
 
Maybe its checking for F4 first in the if, and since its triggering at Alt being pressed it runs through before the player hits alt?

Try this:
Code:
//Get the display
_display = (findDisplay 46);
_display displayAddEventHandler ['KeyUp','_this call NoAltF4'];

NoAltF4 = {
    //Get the keys
    _key = _this select 1;
    _alt = _this select 4;
  
    //If F4 and Alt are hit
    if ((_alt) && (_key == 0x3E)) then
    {
        //And the player is in combat
        _isInCombat = player getVariable['startcombattimer',0];
        if (str _isInCombat != '0') then
        {
            //Kill them
            player setDamage 2;
        };
    };
};

This of course means that someone cold hit F4 and hit alt if that even works.

Maybe making it a while loop checking for both keys would be better, as it might be a timing thing.
Then you could have it spawn it instead of call so it just keeps looping.
 
Maybe its checking for F4 first in the if, and since its triggering at Alt being pressed it runs through before the player hits alt?

Try this:
Code:
//Get the display
_display = (findDisplay 46);
_display displayAddEventHandler ['KeyUp','_this call NoAltF4'];

NoAltF4 = {
    //Get the keys
    _key = _this select 1;
    _alt = _this select 4;
 
    //If F4 and Alt are hit
    if ((_alt) && (_key == 0x3E)) then
    {
        //And the player is in combat
        _isInCombat = player getVariable['startcombattimer',0];
        if (str _isInCombat != '0') then
        {
            //Kill them
            player setDamage 2;
        };
    };
};

This of course means that someone cold hit F4 and hit alt if that even works.

Maybe making it a while loop checking for both keys would be better, as it might be a timing thing.
Then you could have it spawn it instead of call so it just keeps looping.
I tried that but no luck
 
Back
Top