Jump to content

Group Menu broken? Kick / Invite for Admin not possible


He-Man

Recommended Posts

  • 2 weeks later...

To give the Buttons their functions back, change in ...\mpmissions\epoch.xxx\epoch_code\init\client_init.sqf:

EPOCH_group_level_img = ["x\addons\a3_epoch_code\Data\owner.paa", "x\addons\a3_epoch_code\Data\mod.paa", "x\addons\a3_epoch_code\Data\member.paa"];

to

EPOCH_group_level_img = ["x\addons\a3_epoch_code\data\owner.paa", "x\addons\a3_epoch_code\data\mod.paa", "x\addons\a3_epoch_code\data\member.paa"];

 

When adding a member / change moderators...

The diplay reloads, but is empty. To prevent an empty display add in ...\mpmissions\epoch.xxx\epoch_code\gui\scripts\group\EPOCH_Group_update.sqf a sleep:

if (!isNull (findDisplay -1300)) then {
    (findDisplay -1300) closeDisplay 0;
    createDialog "Epoch_myGroup";
};

to

if (!isNull (findDisplay -1300)) then {
    (findDisplay -1300) closeDisplay 0;
    uisleep 0.2;     // new
    createDialog "Epoch_myGroup";
};
 

Optional: By changing moderators...

If the player is not ingame, you become a "dead player" in your group array. To prevent this, you can take the player name from the db. To do this, change in ...\a3_epoch_server\compile\epoch_group\EPOCH_server_upgradeGroup.sqf:

Spoiler

        {
            _selectedPlayerName = if (alive _x) then {name _x};
            if ((_x getVariable ["GROUP",""]) != _groupID) then {
                _x setVariable ["GROUP", _groupID];
                _group = grpNull;
                {
                    if ((_x getVariable["GROUP",""]) == _groupID) exitWith {
                        _group = group _x;
                    };
                }count playableUnits;

                if (isNull _group) then {
                    _group = createGroup west;
                };
                [_x] joinSilent _group;
            };
        } forEach (allPlayers select {getPlayerUID _x == _selectedPlayerUID});
        
        _removePlayerArray = _contentArray select _modOrMemberRevert;

to 

Spoiler

        {
            _selectedPlayerName = if (alive _x) then {name _x};
            if ((_x getVariable ["GROUP",""]) != _groupID) then {
                _x setVariable ["GROUP", _groupID];
                _group = grpNull;
                {
                    if ((_x getVariable["GROUP",""]) == _groupID) exitWith {
                        _group = group _x;
                    };
                }count playableUnits;

                if (isNull _group) then {
                    _group = createGroup west;
                };
                [_x] joinSilent _group;
            };
        } forEach (allPlayers select {getPlayerUID _x == _selectedPlayerUID});
        
// new ...
        _memberrange = ["PlayerData", _selectedPlayerUID] call EPOCH_fnc_server_hiveGETRANGE;
        if (count (_memberrange select 1) > 0) then {
            if (typename (_memberrange select 1 select 0) == "STRING") then {
                _selectedPlayerName = _memberrange select 1 select 0;
            };
        };
// ... new

        _removePlayerArray = _contentArray select _modOrMemberRevert;

I hope this helps...

He-Man

Link to comment
Share on other sites

Here the complete working files:

client_init.sqf

Spoiler

/*
    Author: Aaron Clark - EpochMod.com

    Contributors:

    Description:
    Initalize variables used client side and start login FSM

    Licence:
    Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike

    Github:
    https://github.com/EpochModTeam/Epoch/tree/master/Sources/epoch_code/init/client_init.sqf
*/
EPOCH_CraftingItem = "";
EPOCH_ESP_TARGETS = [];
EPOCH_ESPMAP_TARGETS = [];
EPOCH_ESPGROUPS = [];
EPOCH_ESPGROUPCOLORS = [];
EPOCH_ESP_PLAYER = false;
EPOCH_ESP_VEHICLES = false;
EPOCH_ESP_VEHICLEPLAYER = [];
EPOCH_group_level_img = ["x\addons\a3_epoch_code\data\owner.paa", "x\addons\a3_epoch_code\data\mod.paa", "x\addons\a3_epoch_code\data\member.paa"];
if (isNil 'EPOCH_diag_fps') then {
    EPOCH_diag_fps = 0;
};
EPOCH_playerIsSwimming = false;
EPOCH_lastTrash = diag_tickTime;
EPOCH_tradeDone = false;
EPOCH_bankBalance = 0;
EPOCH_antiWallCount = 0;
EPOCH_lastTargetTime = diag_tickTime;
EPOCH_lastSave = diag_tickTime;
EPOCH_arr_countdown = [];
EP_light = objNull;
EPOCH_p2ptradeTarget = objNull;
EPOCH_lastPlayerPos = getPosATL player;
EPOCH_Holstered = "";
Epoch_invited_GroupUID = "";
Epoch_invited_GroupName = "";
Epoch_invited_GroupUIDs = [];
Epoch_invited_GroupUIDsPrev = [];
Epoch_my_Group = [];
EPOCH_lastPlayerPos = [0,0,0];
EPOCH_prevOffer = [];
EPOCH_drawIcon3d = false;
EPOCH_velTransform = false;
EPOCH_stabilityTarget = objNull;
EPOCH_currentTarget = objNull;
EPOCH_LootedBlds = [];
EPOCH_lootObjects = [];
EPOCH_soundLevel = 1;
EPOCH_arr_interactedObjs = [];
EPOCH_buildOption = 0;
EPOCH_nearestLocations = [];

["EPOCH_onEachFrame", "onEachFrame", EPOCH_onEachFrame] call BIS_fnc_addStackedEventHandler;

EPOCH_LastAirDrop = time;
EPOCH_AirDropCheck = getNumber(getMissionConfig "CfgEpochAirDrop" >> "AirDropFreq");
if(EPOCH_AirDropCheck < 120)then{EPOCH_AirDropCheck = 120;};
EPOCH_AirDropChance = getNumber(getMissionConfig "CfgEpochAirDrop" >> "AirDropChance");
if(EPOCH_AirDropChance < 0)then{EPOCH_AirDropChance = 101;EPOCH_AirDropCheck = 99999;};

EPOCH_droneRndChance = 100;

// Custom Keys
EPOCH_keysActionPressed = false; //prevents EH spam
0 call EPOCH_clientKeyMap;

//ON INIT and RESPAWN
call EPOCH_clientInit;

[] execFSM "epoch_code\system\SPVEH.fsm";
[] execFSM "epoch_code\system\player_login.fsm";

true
 

EPOCH_Group_update.sqf:

Spoiler

/*
    Author: Niklas Wagner - EpochMod.com

    Contributors: Aaron Clark

    Description:
    TODO: DESC-TBA

    Licence:
    Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike

    Github:
    https://github.com/EpochModTeam/Epoch/tree/master/Sources/epoch_code/gui/group/EPOCH_Group_update.sqf
*/
if (!isNull (findDisplay -1300)) then {
    (findDisplay -1300) closeDisplay 0;
    uisleep 0.2;                            // Ignatz
    createDialog "Epoch_myGroup";
};
 

EPOCH_server_upgradeGroup.sqf:

Spoiler

/*
    Author: Aaron Clark - EpochMod.com

    Contributors:

    Description:
    Add or remove members from a group

    Licence:
    Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike

    Github:
    https://github.com/EpochModTeam/Epoch/tree/master/Sources/epoch_server/compile/epoch_group/EPOCH_server_updatePlayerGroup.sqf
*/
private ["_groupID","_selectedPlayerUID","_addOrRemove","_modOrMember","_modOrMemberRevert","_response","_contentArray","_modArray","_memberArray","_selectedPlayerName","_group","_removePlayerArray","_modOrMemberArray","_found"];

if !([_this select 4, _this select 5] call EPOCH_server_getPToken) exitWith {};

_groupID = _this select 0;
if (_groupID == "") exitWith{ diag_log format["Epoch: GROUP: No Group Selected %1", _this]; };

diag_log format["Epoch: GROUP: Update %1", _this];

_selectedPlayerUID = _this select 1;
_addOrRemove = _this select 2; //add = true
_modOrMember = if (_this select 3) then [{3},{4}];
_modOrMemberRevert = if (_this select 3) then [{4},{3}];

// [_groupName, _leaderName, _groupSize, _modArray, _memberArray]
_response = ["Group", _groupID] call EPOCH_fnc_server_hiveGETRANGE;
if ((_response select 0) == 1 && (_response select 1) isEqualType []) then {
    _contentArray = _response select 1;

    //_groupName = _contentArray select 0;
    //_leaderName = _contentArray select 1;
    //_groupSize = _contentArray select 2;
    _modArray = _contentArray select 3;
    _memberArray = _contentArray select 4;

    if (_addOrRemove) then { //Add
        _selectedPlayerName = "Dead Player";

        {
            _selectedPlayerName = if (alive _x) then {name _x};
            if ((_x getVariable ["GROUP",""]) != _groupID) then {
                _x setVariable ["GROUP", _groupID];
                _group = grpNull;
                {
                    if ((_x getVariable["GROUP",""]) == _groupID) exitWith {
                        _group = group _x;
                    };
                }count playableUnits;

                if (isNull _group) then {
                    _group = createGroup west;
                };
                [_x] joinSilent _group;
            };
        } forEach (allPlayers select {getPlayerUID _x == _selectedPlayerUID});
        
// new ...
        _memberrange = ["PlayerData", _selectedPlayerUID] call EPOCH_fnc_server_hiveGETRANGE;
        if (count (_memberrange select 1) > 0) then {
            if (typename (_memberrange select 1 select 0) == "STRING") then {
                _selectedPlayerName = _memberrange select 1 select 0;
            };
        };
// ... new

        _removePlayerArray = _contentArray select _modOrMemberRevert;

        {
            if (_x select 0 == _selectedPlayerUID) exitWith {
                _removePlayerArray deleteAt _forEachIndex;
                _contentArray set [_modOrMemberRevert, _removePlayerArray];
            };
        } forEach _removePlayerArray;

        _modOrMemberArray = _contentArray select _modOrMember;
        _modOrMemberArray pushBack [_selectedPlayerUID, _selectedPlayerName];

        _contentArray set [_modOrMember, _modOrMemberArray];

    } else {

        //Remove
        _found = false;

        {
            _x setVariable ["GROUP", nil];
            [_x] joinSilent (createGroup west);
            [["resetGroup", true], _x] call EPOCH_sendRemoteExecClient;
        } forEach (allPlayers select {getPlayerUID _x == _selectedPlayerUID});

        {
            if (_x select 0 == _selectedPlayerUID) exitWith {
                _memberArray deleteAt _forEachIndex;
                _found = true;
            };
        } forEach _memberArray;

        if (_found) then {
            _contentArray set [4, _memberArray];
        } else {
            {
                if (_x select 0 == _selectedPlayerUID) exitWith {
                    _modArray deleteAt _forEachIndex;
                    _found = true;
                };
            } forEach _modArray;
            _contentArray set [3, _modArray];
        };

        if (!_found) then {
            diag_log format ["Epoch: %1 cannot remove Player! (%1)", __FILE__, _this]
        };
    };

    {
        [["groupUpdate", _contentArray], _x] call EPOCH_sendRemoteExecClient;
    } forEach (allPlayers select {(_x getVariable["GROUP", ""]) == _groupID});

    // Save Group Data
    ["Group", _groupID, _contentArray] call EPOCH_fnc_server_hiveSET;
};
 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...