official-antistasi-community / A3-Antistasi

Antistasi Community Version - work in progress - Discord https://discord.com/invite/TYDwCRKnKX
https://antistasi.de
Other
228 stars 154 forks source link

Re-Enable PVP switch timeout #3

Closed Spoffy closed 5 years ago

SEBArma commented 5 years ago

dont make it too long as admins might have to switch to fix issues rebels have while playing PVP

Toakan commented 5 years ago

Can you make Admins exempt from the check?

Bob-Murphy commented 5 years ago

That would be nice. What also would be nice is that you can go from (not petros side) to (petros side) without a timeout, but you have a timeout when you want to join the pvp side. This could be handy as sometimes also a member needs to switch fast for some HQ stuff in case the only member in rebel side goes offline.

Toakan commented 5 years ago

Something like this

_adminState = call BIS_fnc_admin;
if (_adminState = 2) then {_timeout = 0;} else {_timeout = 120};
Bob-Murphy commented 5 years ago

I know it's only an example but I would make the time-out at least 5 minutes, maybe even 10 minutes.

Toakan commented 5 years ago

Think this should do it.

if !(isServer) exitWith {};
_unit = _this select 0;
_adminState = admin owner _unit;
if (playerHasBeenPvP isEqualTo []) exitWith {};
_leave = false;
_id = getPlayerUID _unit;
{
if (_id == _x select 0 && _adminState != 2) then
    {
    if (time - 3600 <= _x select 1) then 
        {
            _leave = true
        };
    };
} forEach playerHasBeenPvP;
if (_leave) then
    {
    ["noPvP",false,1,false,false] remoteExec ["BIS_fnc_endMission",_unit];
    "Antistasi: player kicked because he has been rebel recently" remoteExec ["diag_log",_unit];
    };
Spoffy commented 5 years ago

Cheers for the code Toa, done in 4ad6da368dbcde696aef737bedaf2499be1a8cfb