Jump to content

Recommended Posts

Im improving my server protection and basically i need to detect players using allowDamage false, remoteexec, skipTime, setDamage... so if someone use any of this functions i will receive an alert. 

 

I tried the following codes but none works:

if (player getVariable [QGVAR(allowDamage), true]) then { 
player groupChat "this player is using godmode";
};
if (vehicle player getVariable["allowDamage",true]) then {
player groupChat "this player is using godmode";
};

Share this post


Link to post
Share on other sites
{

    _ouchmyface = "Bomb_04_F" createvehicle [0,0,550];
    _ouchmyface hideObject true;
    _ouchmyfaaace = (eyepos _x);
    _ouchmyface setposasl _ouchmyfaaace;
    _ouchmyface setDamage 1;
    if (alive _x) then {/* cheater */};
        
} foreach allplayers;

Best used with stacked onEachFrame for reliability.

 

Cheers

  • Like 1

Share this post


Link to post
Share on other sites
{

    _ouchmyface = "Bomb_04_F" createvehicle [0,0,550];
    _ouchmyface hideObject true;
    _ouchmyfaaace = (eyepos _x);
    _ouchmyface setposasl _ouchmyfaaace;
    _ouchmyface setDamage 1;
    if (alive _x) then {/* cheater */};
        
} foreach allplayers;

Best used with stacked onEachFrame for reliability.

 

Cheers

 

 

I don't get it, your code only loops players, set some variables and if this player is alive do nothing. I need a code that detect if a individual player has set up his allow damage to false or if he is using a malicious code like BIS_fnc_MP, skiptime...

Share this post


Link to post
Share on other sites

I don't get it...

That's a shame but I can confirm it works if you want to detect cheaters. :lol:

 

Try using allVariables to see if it's there at all.

Share this post


Link to post
Share on other sites

Try adapting grumpyOldMan's code.

 

Note that this code will have some pretty decent overhead if you loop it, so you may want to call it only on suspicious players.  You could even implement a voting system whereby the script runs and checks allowDamage = false on a player that has been "voted" as a suspected cheater by someone else.  

 

GrumpyOldMan's script basically does the following.  For each player, it does this:  Creates a bomb in the sky at map position 0,0,  hides the bomb, moves it to eye level of the player unit, and then detonates it, and then checks to see if the unit is alive.  If not, the player is a cheater.

 

Yes, this works, but it is obviously a joke solution because all players will explode regardless of whether they are cheating or not, and only the cheaters will survive.  

 

However, this may provide some insight into how to detect the state of allowDamage, since hit event handlers do not fire.  You could apply a similar concept by 

 

1: Obtaining the player's current damage state.  

https://community.bistudio.com/wiki/getAllHitPointsDamage

 

2: Then, determine if the player is about to die (or not, but risk killing them with the script if they are already hurt.  If they are close to death and will die from the test and this condition alone prevents the test from being run, then cheaters can circumvent it by setting their damage state to almost dead and THEN using allowDamage = false;.  To prevent this, perhaps tally the votes to check if the player is a cheater and if they are numerous, override this check.  The idea is that if you run this test on a player that is close to death, they could be innocent and you could kill them and annoy the player which is always bad.  By requiring more than 1 vote to run the test ONLY IF the player is damaged enough to die from the test, that means multiple people agree that they are likely to be cheating, in which case, the risk of the player being innocent will be lowered while the consequences of them being innocent and running the cheater allowDamage test, killing them, remains the same.  Striking a balance here will be hard.  Perhaps the test can be run with only one vote if the player would not die to the test, but require 2 or more votes if the player would.)

https://community.bistudio.com/wiki/damage

 

3: Spawning a 9mm bullet.

https://community.bistudio.com/wiki/createVehicle

 

4: Move the bullet BEHIND the player's chest.  May be complicated and involve a great deal of testing.  You will have to use some hardcoded and tested values along with some 3D geometry skills to place the bullet behind the back of the player regardless of the player's stace.

https://community.bistudio.com/wiki/setPosASL

https://community.bistudio.com/wiki/eyePos

https://community.bistudio.com/wiki/stance

https://community.bistudio.com/wiki/Math_Commands

 

 

5: Give the bullet a velocity in the direction of the player's chest.

https://community.bistudio.com/wiki/setVelocity

https://community.bistudio.com/wiki/BIS_fnc_dirTo

https://community.bistudio.com/wiki/vectorMultiply

 

6: Checking the player's damage state again and comparing it to the original.

https://community.bistudio.com/wiki/damage

 

 

7: Restore the player's health if they were damaged or flag them as a cheater if they were not.  Careful to restore the exact damage state to each hit part.

https://community.bistudio.com/wiki/setHitPointDamage

  • Like 1

Share this post


Link to post
Share on other sites

Try adapting grumpyOldMan's code.

 

Note that this code will have some pretty decent overhead if you loop it, so you may want to call it only on suspicious players.  You could even implement a voting system whereby the script runs and checks allowDamage = false on a player that has been "voted" as a suspected cheater by someone else.  

 

GrumpyOldMan's script basically does the following.  For each player, it does this:  Creates a bomb in the sky at map position 0,0,  hides the bomb, moves it to eye level of the player unit, and then detonates it, and then checks to see if the unit is alive.  If not, the player is a cheater.

 

Yes, this works, but it is obviously a joke solution because all players will explode regardless of whether they are cheating or not, and only the cheaters will survive.  

 

However, this may provide some insight into how to detect the state of allowDamage, since hit event handlers do not fire.  You could apply a similar concept by 

 

1: Obtaining the player's current damage state.  

https://community.bistudio.com/wiki/getAllHitPointsDamage

 

2: Then, determine if the player is about to die (or not, but risk killing them with the script if they are already hurt.  If they are close to death and will die from the test and this condition alone prevents the test from being run, then cheaters can circumvent it by setting their damage state to almost dead and THEN using allowDamage = false;.  To prevent this, perhaps tally the votes to check if the player is a cheater and if they are numerous, override this check.  The idea is that if you run this test on a player that is close to death, they could be innocent and you could kill them and annoy the player which is always bad.  By requiring more than 1 vote to run the test ONLY IF the player is damaged enough to die from the test, that means multiple people agree that they are likely to be cheating, in which case, the risk of the player being innocent will be lowered while the consequences of them being innocent and running the cheater allowDamage test, killing them, remains the same.  Striking a balance here will be hard.  Perhaps the test can be run with only one vote if the player would not die to the test, but require 2 or more votes if the player would.)

https://community.bistudio.com/wiki/damage

 

3: Spawning a 9mm bullet.

https://community.bistudio.com/wiki/createVehicle

 

4: Move the bullet BEHIND the player's chest.  May be complicated and involve a great deal of testing.

https://community.bistudio.com/wiki/setPosASL

https://community.bistudio.com/wiki/eyePos

https://community.bistudio.com/wiki/stance

https://community.bistudio.com/wiki/Math_Commands

 

 

5: Give the bullet a velocity in the direction of the player's chest.

https://community.bistudio.com/wiki/setVelocity

https://community.bistudio.com/wiki/BIS_fnc_dirTo

https://community.bistudio.com/wiki/vectorMultiply

 

6: Checking the player's damage state again and comparing it to the original.

https://community.bistudio.com/wiki/damage

 

 

7: Restore the player's health if they were damaged or flag them as a cheater if they were not.  Careful to restore the exact damage state to each hit part.

https://community.bistudio.com/wiki/setHitPointDamage

 

Very helpfull, thanks for making things clear for me, now i see what Grumpy Old Man script do, very sick but works.

Anyway i made my own solution, of course it dont cover damage handler godmode script but its a start:

if (player getVariable ["allowDamage", false]) then { 
	_namer = name player;
	_uidr = getPlayerUID player; 
	_adminuidr = 584687465463584716;
        
[format ["%1 is using Godmode and his UID is: %2", _namer, _uidr],"hint",_adminuidr,true] call BIS_fnc_MP; 
}

Share this post


Link to post
Share on other sites

Better approach:

 
if (player getVariable ["allowDamage", false]) then { 
	_namer = name player;
	_uidr = getPlayerUID player; 
 
	alertador ={
	_uid = _this select 1;
	_name = _this select 0;
	if(getPlayerUID player == "765611938438434")then{
	systemChat format ["%1 using godmode, his UID: %2", _name, _uid];
	};
};

[_namer, _uidr] remoteExec ["alertador", -2]; 
}

This is my final solution for allowdamage, just put it on a loop and change your uid and it will send a msg when some player use godmode.

Share this post


Link to post
Share on other sites

Interesting.  So allowDamage does create a variable (or alter a pre-existing one) in the object namespace of the object it was called on?

Share this post


Link to post
Share on other sites

Interesting.  So allowDamage does create a variable (or alter a pre-existing one) in the object namespace of the object it was called on?

 

Looks like it, for my surprise it works just like a variable.

Share this post


Link to post
Share on other sites

Just checked again and its not working, for some reason player getVariable ["allowDamage", false]) is not returning the actual value, any ideas?

Share this post


Link to post
Share on other sites

Using allowdamage false/true doesn't set any variables.

What gave you the idea?

If you'd at least tried if it sets any variable you'd see that it doesn't. Don't just blindly come to assumptions and spread this misinformation.

 

Cheers

Share this post


Link to post
Share on other sites

Easy way to inflict indirect damage to a player, without having to spawn bombs or other ammunition is to apply a certain amount of downward velocity to him.

  • Like 2

Share this post


Link to post
Share on other sites

Easy way to inflict indirect damage to a player, without having to spawn bombs or other ammunition is to apply a certain amount of downward velocity to him.

I can't help but think of this

  • Like 2

Share this post


Link to post
Share on other sites

"HandleDamage" event handler is hit with value 0 for damage if allowDamage is set to false.

 

UPD. And hitPartIndex is set to -1.

  • Like 1

Share this post


Link to post
Share on other sites

"HandleDamage" event handler is hit with value 0 for damage if allowDamage is set to false.

 

UPD. And hitPartIndex is set to -1.

 

Nice answer, i tested it with this code:

 

 

player addEventHandler ["HandleDamage", 

_hitPartIndex = _this select 5;
systemChat format ["%1 Damage taken:, his UID: %2", _hitPartIndex, _hitPartIndex];
}];
 

 

Looks like if the player is using godmode, it will always return -1. The problem is sometimes it returns -1 if your are NOT on godmode.

 

Results with godmode ON:

-1 Damage taken:-1
-1 Damage taken:-1
-1 Damage taken:-1
-1 Damage taken:-1
-1 Damage taken:-1
-1 Damage taken:-1
-1 Damage taken:-1
-1 Damage taken:-1

Results with godmode OFF:

 

 

1 Damage taken:1

2 Damage taken:2

3 Damage taken:3

4 Damage taken:4

5 Damage taken:5

6 Damage taken:6

7 Damage taken:7

8 Damage taken:8

9 Damage taken:9

10 Damage taken:10

-1 Damage taken:-1

Share this post


Link to post
Share on other sites

Looks like if the player is using godmode, it will always return -1. The problem is sometimes it returns -1 if your are NOT on godmode.

Then check the amount of damage too (is exactly 0 in godmode):

unit addEventHandler ["HandleDamage", 
{
    params ["_unit", "", "_damage", "", "", "_hitPartIndex"];
    private _uid = getPlayerUID _unit;
    //systemChat format ["%1 Damage taken: %2, his UID: %3", _hitPartIndex, _damage, _uid];
    if (_damage == 0 && _hitPartIndex == -1) then {
        // report cheater (don't use systemChat only: it reports on cheater's machine; e.g. use with remoteExec)
    }
}];

Also, check that -1 case for _damage value, should not be 0 when not in godmode.

 

UPD.

And don't forget this event handler hits locally, e.g. on _unit's machine. Consider not having it from the beginning of mission but spontaneously setting it remotely by server to perform check only, then remove (just in case cheater can use removeAllEventHandlers).

 

UPD2. Another plus of having EH spontaneously added is in the case when cheater has his own "HandleDamage" event handler which reduces the amount of damage inflicted. Your handler becomes last, and if I understand EH system correctly, you will see the value changed by cheater's handler (if he is smart he will not set it to 0, but reduce it significantly, so it still loks like he gets damage; but you can detect those cases too in your last EH).

  • Like 1

Share this post


Link to post
Share on other sites

Then check the amount of damage too (is exactly 0 in godmode):

unit addEventHandler ["HandleDamage", 
{
    params ["_unit", "", "_damage", "", "", "_hitPartIndex"];
    private _uid = getPlayerUID _unit;
    //systemChat format ["%1 Damage taken: %2, his UID: %3", _hitPartIndex, _damage, _uid];
    if (_damage == 0 && _hitPartIndex == -1) then {
        // report cheater (don't use systemChat only: it reports on cheater's machine; e.g. use with remoteExec)
    }
}];

Also, check that -1 case for _damage value, should not be 0 when not in godmode.

 

UPD.

And don't forget this event handler hits locally, e.g. on _unit's machine. Consider not having it from the beginning of mission but spontaneously setting it remotely by server to perform check only, then remove (just in case cheater can use removeAllEventHandlers).

 

UPD2. Another plus of having EH spontaneously added is in the case when cheater has his own "HandleDamage" event handler which reduces the amount of damage inflicted. Your handler becomes last, and if I understand EH system correctly, you will see the value changed by cheater's handler (if he is smart he will not set it to 0, but reduce it significantly, so it still loks like he gets damage; but you can detect those cases too in your last EH).

 

 

I was already testing this, and it seems to work ok:


goddetector = [] spawn { 
	while {true} do {
		{
		if (isnil ("god")) then { god = 0; }; 
		if (god==0) then { 
        god=1;
			player addEventHandler ["HandleDamage", {             
			_hitPartIndex = _this select 5;
			_damage = _this select 2;                      
				if (_damage == 0 && _hitPartIndex == -1) then {
				_namer = name player;
				_uidr = getPlayerUID player;                   
					alertador ={
					_uid = _this select 1;
					_name = _this select 0;
					if(getPlayerUID player == "768468463846487464")then{
					systemChat format ["%1 using godmode, his UID: %2", _name, _uid];
					};    
				};
				[_namer, _uidr] remoteExec ["alertador", -2]; 
			};
			}];
	};
	} remoteExec ["bis_fnc_call", -2]; 
	sleep 5
	};
};

Inject using Server Exec and all players get the damage handler for testing purposes.

It wont work on some maps and mods.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×