Combatlogout even when client isnt in combat anymore

Grafzahl

Valued Member!
On my servers i punish combatloggers with a 5 minute knockout and an infection... the problem now is, that i found out that the combatlogout-system of dayz doesnt work correctly, sometimes a user combatlogs while the weapon is blinking and the server doesnt notice it...

sometime a user logs out while not in combat since 30 seconds and the server notices a combatlogout. for the players this is realy frustrating... i also would like to set them to death, but if i cant make sure that the system works correctly i cant take this step ;)

I was looking in the code of server_onPlayerDisconnect.sqf:

Code:
_timeout = _object getVariable["combattimeout",0];
 
if (((_timeout - time) > 0)) then {
    diag_log format["COMBAT LOGGED: %1 (%2)", _playerName,_timeout];
};

And then i searched a bit for "time" in the arma2 scripting-wiki:


On overloaded servers (below ~10 server FPS), time readings are unreliable. Seconds actually take longer. While the clients keep a steady tempo, server time lags behind, resulting in considerable offset between client and server time (easily 30 minutes for a 2 hour game). Client time is synchronised to server time during JIP, but other than that it runs independently.

I gues nearly every server running 35+ players has a lower serverfps then 10, so i gues the client time differs from the server-time (after 1-2 hours of uptime), and this way even if a player isnt in combat anymore, the server compares these values and sees him combatlogging.

I think the only right way to check for a combatlogout is to get both values from the client on disconnect, then compare them... actually the combattime is taken from the client, and compared with the server time, or even a better way would be to set a variable on the client when he is not in combat and just get this variable on disconnect of the client.

Anyone who could help me with this?
 
Ok, think i got it, in my custom player_spawn_2.sqf i changed the code to:
Code:
    // If in combat, display counter and restrict logout
    _startcombattimer      = player getVariable["startcombattimer",0];
    if (_startcombattimer == 1) then {
        player setVariable["combattimeout", time + 30, true];
        player setVariable["startcombattimer", 0, true];
        dayz_combat = 1;
        player setVariable["incombat", 1, true];
    };
 
    _combattimeout = player getVariable["combattimeout",0];
    if (_combattimeout > 0) then {
        _timeleft = _combattimeout - time;
        if (_timeleft > 0) then {
                player setVariable["incombat", 1, true];
            //hintSilent format["In Combat: %1",round(_timeleft)];
        } else {
                player setVariable["incombat", 0, true];
            //hintSilent "Not in Combat";
            player setVariable["combattimeout", 0, true];
            dayz_combat = 0;
            _combatdisplay = uiNamespace getVariable 'DAYZ_GUI_display';
            _combatcontrol =    _combatdisplay displayCtrl 1307;
            _combatcontrol ctrlShow true;
        };
    } else {
        player setVariable["incombat", 0, true];
        //hintSilent "Not in Combat";
        dayz_combat = 0;
        _combatdisplay = uiNamespace getVariable 'DAYZ_GUI_display';
        _combatcontrol =    _combatdisplay displayCtrl 1307;
        _combatcontrol ctrlShow true;
    };

This way i have a variable "incombat" which is 1 if the player is in combat, and 0 if not.

server_onPlayerDisconnect.sqf
Code:
_isincombat = _object getVariable["incombat",0];
 
if ((_isincombat > 0)) then {
    diag_log format["COMBAT LOGGED: %1 (%2)", _playerName,_timeout];
};

This should always work and shouldnt produce false-positives. Now i can kill these pussys straight away ;)
 
Back
Top