mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-20 02:16:29 +03:00
Add group system
Initial commit, not tested in multiplayer yet. Some revisions still left to do.
This commit is contained in:
21
SQF/dayz_code/groups/disbandGroup.sqf
Normal file
21
SQF/dayz_code/groups/disbandGroup.sqf
Normal file
@@ -0,0 +1,21 @@
|
||||
private "_group";
|
||||
|
||||
_group = group player;
|
||||
if (count (units _group) == 1 or (!isNil "dayz_groupDisbandThread" && {!scriptDone dayz_groupDisbandThread})) exitWith {
|
||||
_this ctrlShow false;
|
||||
};
|
||||
|
||||
dayz_groupDisbanded = nil;
|
||||
PVDZ_Server_UpdateGroup = [4,player];
|
||||
publicVariableServer "PVDZ_Server_UpdateGroup";
|
||||
|
||||
dayz_groupDisbandThread = _group spawn {
|
||||
//Wait for response from server to confirm group finished updating in DB
|
||||
waitUntil {!isNil "dayz_groupDisbanded"};
|
||||
|
||||
{
|
||||
[_x] join grpNull;
|
||||
} count (units _this);
|
||||
|
||||
deleteGroup _this;
|
||||
};
|
||||
10
SQF/dayz_code/groups/filterGroup.sqf
Normal file
10
SQF/dayz_code/groups/filterGroup.sqf
Normal file
@@ -0,0 +1,10 @@
|
||||
private "_group";
|
||||
|
||||
_group = [];
|
||||
{
|
||||
if (alive _x && isPlayer _x) then {
|
||||
_group set [count _group,_x];
|
||||
};
|
||||
} count (units group _this);
|
||||
|
||||
_group
|
||||
8
SQF/dayz_code/groups/getCrew.sqf
Normal file
8
SQF/dayz_code/groups/getCrew.sqf
Normal file
@@ -0,0 +1,8 @@
|
||||
private "_crew";
|
||||
|
||||
_crew = [];
|
||||
{
|
||||
_crew set [count _crew, if (alive _x) then {name _x} else {"unknown"}];
|
||||
} count crew _this;
|
||||
|
||||
format ["%1%2",typeOf _this,_crew]
|
||||
10
SQF/dayz_code/groups/getPlayer.sqf
Normal file
10
SQF/dayz_code/groups/getPlayer.sqf
Normal file
@@ -0,0 +1,10 @@
|
||||
private "_player";
|
||||
|
||||
_player = objNull;
|
||||
{
|
||||
if (getPlayerUID _x == _this) exitWith {
|
||||
_player = _x;
|
||||
};
|
||||
} count allUnits;
|
||||
|
||||
_player
|
||||
45
SQF/dayz_code/groups/groupIcons.sqf
Normal file
45
SQF/dayz_code/groups/groupIcons.sqf
Normal file
@@ -0,0 +1,45 @@
|
||||
// OnEachFrame loop
|
||||
private ["_display","_distance","_group","_icon","_index","_pos","_scale","_screen","_text"];
|
||||
|
||||
_group = player call dayz_filterGroup;
|
||||
if (!visibleMap && count _group > 1 && cameraView in ["INTERNAL","EXTERNAL","GUNNER"]) then {
|
||||
80000 cutRsc ["DZ_GroupIcons","PLAIN"];
|
||||
|
||||
_display = uiNamespace getVariable "DZ_GroupIcons";
|
||||
_index = 0;
|
||||
{
|
||||
_pos = getPosATL _x;
|
||||
if (surfaceIsWater _pos) then {_pos = getPosASL _x;};
|
||||
_distance = _pos distance player;
|
||||
_icon = _display displayCtrl (100 + _index);
|
||||
if (_distance > 1 && _distance < 2500) then {
|
||||
_pos set [2,(_pos select 2) + 1.5];
|
||||
_screen = worldToScreen _pos;
|
||||
_text = composeText [image "\ca\ui\data\igui_side_unknown_ca.paa"," ",if (dayz_groupNameTags) then {name _x} else {""}];
|
||||
if (count _screen > 1) then {
|
||||
_scale = if (_distance < 200) then {.3} else {1 min ((1 - (_distance - 3) / 15) max .3)};
|
||||
_icon ctrlSetStructuredText _text;
|
||||
_icon ctrlSetPosition [(_screen select 0),(_screen select 1),.99,.65];
|
||||
_icon ctrlSetScale _scale;
|
||||
_icon ctrlSetFade ((1 - _scale) / 2);
|
||||
_icon ctrlCommit 0;
|
||||
_icon ctrlShow true;
|
||||
} else {
|
||||
_icon ctrlShow false;
|
||||
};
|
||||
} else {
|
||||
_icon ctrlShow false;
|
||||
};
|
||||
_index = _index + 1;
|
||||
} count _group;
|
||||
|
||||
if (dayz_oldGroupCount > count _group) then {
|
||||
_display displayCtrl (100 + _index) ctrlShow false;
|
||||
};
|
||||
|
||||
dayz_oldGroupCount = count _group;
|
||||
} else {
|
||||
if (!isNull (uiNamespace getVariable "DZ_GroupIcons")) then {
|
||||
80000 cutText ["","PLAIN"];
|
||||
};
|
||||
};
|
||||
36
SQF/dayz_code/groups/groupInvite.sqf
Normal file
36
SQF/dayz_code/groups/groupInvite.sqf
Normal file
@@ -0,0 +1,36 @@
|
||||
private ["_add","_inviter","_recipient","_uid","_unit"];
|
||||
|
||||
_add = _this select 0;
|
||||
_uid = _this select 1;
|
||||
|
||||
// Update active invites on all machines with the change
|
||||
if (_add) then {
|
||||
_inviter = _uid select 0;
|
||||
_recipient = _uid select 1;
|
||||
dayz_activeInvites set [count dayz_activeInvites,_uid];
|
||||
if (!isDedicated && {_recipient == getPlayerUID player} && {!dayz_requireRadio or {dayz_requireRadio && "ItemRadio" in items player}}) then {
|
||||
localize "STR_EPOCH_INVITE_NEW" call dayz_rollingMessages;
|
||||
};
|
||||
} else {
|
||||
// Remove all invites to this player
|
||||
_inviter = "0";
|
||||
_recipient = _uid;
|
||||
{
|
||||
if (_recipient == _x select 1) then {
|
||||
dayz_activeInvites set [_forEachIndex,"delete"];
|
||||
};
|
||||
} forEach dayz_activeInvites;
|
||||
dayz_activeInvites = dayz_activeInvites - ["delete"];
|
||||
};
|
||||
|
||||
// Send change to all active clients except the originator (they already updated themself)
|
||||
if (isServer) then {
|
||||
PVDZ_groupInvite = _this;
|
||||
{
|
||||
_unit = getPlayerUID _x;
|
||||
if (_unit != "" && ((!_add && _unit != _recipient) or (_add && _unit != _inviter))) then {
|
||||
// Don't use regular PV because JIP clients don't need it (dayz_activeInvites is synced to them in server_playerLogin)
|
||||
owner _x publicVariableClient "PVDZ_groupInvite";
|
||||
};
|
||||
} count allUnits;
|
||||
};
|
||||
57
SQF/dayz_code/groups/groupMarkers.sqf
Normal file
57
SQF/dayz_code/groups/groupMarkers.sqf
Normal file
@@ -0,0 +1,57 @@
|
||||
// Two second loop
|
||||
private ["_count","_group","_hasGPS","_index","_marker","_markBody","_markGroup","_markSelf","_pos","_self","_vehicle"];
|
||||
|
||||
_group = player call dayz_filterGroup;
|
||||
|
||||
if (dayz_requireRadio && {count _group > 1} && {!("ItemRadio" in items player)}) exitWith {
|
||||
[player] join grpNull;
|
||||
_group = [];
|
||||
if (!isNull findDisplay 80000) then {findDisplay 80000 closeDisplay 2;};
|
||||
localize "STR_EPOCH_RADIO_CONTACT_LOST" call dayz_rollingMessages;
|
||||
};
|
||||
|
||||
if (visibleMap or !isNull findDisplay 88890) then {
|
||||
_hasGPS = "ItemGPS" in items player;
|
||||
_markBody = (dayz_markBody == 1 or (dayz_markBody == 2 && _hasGPS));
|
||||
_markGroup = (dayz_markGroup == 1 or (dayz_markGroup == 2 && _hasGPS));
|
||||
_markSelf = (dayz_markSelf == 1 or (dayz_markSelf == 2 && _hasGPS));
|
||||
|
||||
_index = 0;
|
||||
{
|
||||
_self = _x == player;
|
||||
_vehicle = vehicle _x;
|
||||
if ((_self or _markGroup) && (!_self or _markSelf) && (driver _vehicle == _x)) then {
|
||||
_pos = getPosATL _x;
|
||||
if (surfaceIsWater _pos) then {_pos = getPosASL _x;};
|
||||
deleteMarkerLocal format["groupMember%1",_index];
|
||||
_marker = createMarkerLocal [format["groupMember%1",_index],_pos];
|
||||
_marker setMarkerTypeLocal "DestroyedVehicle";
|
||||
_marker setMarkerTextLocal format ["%1",if (_vehicle == _x) then {name _x} else {_vehicle call dayz_getCrew}];
|
||||
_marker setMarkerColorLocal "ColorGreen";
|
||||
} else {
|
||||
deleteMarkerLocal format["groupMember%1",_index];
|
||||
};
|
||||
_index = _index + 1;
|
||||
} count _group;
|
||||
|
||||
// Remove markers for group members that left
|
||||
_count = count _group;
|
||||
if (dayz_oldMemberCount > _count) then {
|
||||
for "_i" from _count to dayz_oldMemberCount do {deleteMarkerLocal format["groupMember%1",_i];};
|
||||
};
|
||||
dayz_oldMemberCount = _count;
|
||||
|
||||
if (_markBody) then {
|
||||
{
|
||||
if (_x getVariable["bodyName",""] == name player) then {
|
||||
deleteMarkerLocal "MyBody";
|
||||
_marker = createMarkerLocal ["MyBody",getPosATL _x];
|
||||
_marker setMarkerTypeLocal "DestroyedVehicle";
|
||||
_marker setMarkerTextLocal localize "STR_EPOCH_RIP";
|
||||
_marker setMarkerColorLocal "ColorRed";
|
||||
};
|
||||
} count allDead;
|
||||
} else {
|
||||
deleteMarkerLocal "MyBody";
|
||||
};
|
||||
};
|
||||
39
SQF/dayz_code/groups/init.sqf
Normal file
39
SQF/dayz_code/groups/init.sqf
Normal file
@@ -0,0 +1,39 @@
|
||||
private "_oldGroup";
|
||||
|
||||
if (count (units group player) > 1) then {
|
||||
[player] join grpNull;
|
||||
};
|
||||
|
||||
if (count dayz_myGroup > 1 && {!dayz_requireRadio or {dayz_requireRadio && "ItemRadio" in items player}}) then {
|
||||
{
|
||||
//Only auto join player into group if leader is in their savedGroup
|
||||
if (getPlayerUID leader _x in dayz_myGroup) exitWith {
|
||||
_oldGroup = group player;
|
||||
[player] join _x;
|
||||
if (count (units _oldGroup) == 0) then {deleteGroup _oldGroup;};
|
||||
|
||||
// Update saved group in DB
|
||||
PVDZ_Server_UpdateGroup = [0,player];
|
||||
publicVariableServer "PVDZ_Server_UpdateGroup";
|
||||
};
|
||||
} count allGroups;
|
||||
};
|
||||
|
||||
dayz_oldGroupCount = 0;
|
||||
dayz_oldMemberCount = 0;
|
||||
dayz_disbandGroup = compile preprocessFileLineNumbers "\z\addons\dayz_code\groups\disbandGroup.sqf";
|
||||
dayz_filterGroup = compile preprocessFileLineNumbers "\z\addons\dayz_code\groups\filterGroup.sqf";
|
||||
dayz_getCrew = compile preprocessFileLineNumbers "\z\addons\dayz_code\groups\getCrew.sqf";
|
||||
dayz_getPlayer = compile preprocessFileLineNumbers "\z\addons\dayz_code\groups\getPlayer.sqf";
|
||||
dayz_groupIcons = compile preprocessFileLineNumbers "\z\addons\dayz_code\groups\groupIcons.sqf";
|
||||
dayz_groupMarkers = compile preprocessFileLineNumbers "\z\addons\dayz_code\groups\groupMarkers.sqf";
|
||||
dayz_inviteToGroup = compile preprocessFileLineNumbers "\z\addons\dayz_code\groups\inviteToGroup.sqf";
|
||||
dayz_joinGroup = compile preprocessFileLineNumbers "\z\addons\dayz_code\groups\joinGroup.sqf";
|
||||
dayz_kickFromGroup = compile preprocessFileLineNumbers "\z\addons\dayz_code\groups\kickFromGroup.sqf";
|
||||
dayz_leaveGroup = compile preprocessFileLineNumbers "\z\addons\dayz_code\groups\leaveGroup.sqf";
|
||||
dayz_openGroupDialog = compile preprocessFileLineNumbers "\z\addons\dayz_code\groups\openDialog.sqf";
|
||||
dayz_promotePlayer = compile preprocessFileLineNumbers "\z\addons\dayz_code\groups\promotePlayer.sqf";
|
||||
dayz_rejectGroup = compile preprocessFileLineNumbers "\z\addons\dayz_code\groups\rejectGroup.sqf";
|
||||
dayz_selectGroupMember = compile preprocessFileLineNumbers "\z\addons\dayz_code\groups\selectGroupMember.sqf";
|
||||
dayz_selectPlayer = compile preprocessFileLineNumbers "\z\addons\dayz_code\groups\selectPlayer.sqf";
|
||||
dayz_groupInit = true;
|
||||
32
SQF/dayz_code/groups/inviteToGroup.sqf
Normal file
32
SQF/dayz_code/groups/inviteToGroup.sqf
Normal file
@@ -0,0 +1,32 @@
|
||||
private ["_hasInvite","_invite","_playerList","_recipient","_uid"];
|
||||
|
||||
disableSerialization;
|
||||
_playerList = findDisplay 80000 displayCtrl 1;
|
||||
_uid = _playerList lbData (lbCurSel _playerList);
|
||||
_recipient = _uid call dayz_getPlayer;
|
||||
|
||||
if (isNull _recipient or player != leader group player or count (units group _recipient) > 1) exitWith {
|
||||
_this ctrlShow false;
|
||||
};
|
||||
|
||||
_hasInvite = false;
|
||||
{
|
||||
if (_x select 1 == _uid) then {
|
||||
_hasInvite = true;
|
||||
};
|
||||
} forEach dayz_activeInvites;
|
||||
|
||||
if (_hasInvite) exitWith {
|
||||
systemChat localize "STR_EPOCH_INVITE_PENDING";
|
||||
};
|
||||
|
||||
_invite = [getPlayerUID player,_uid];
|
||||
|
||||
//Update locally with change
|
||||
dayz_activeInvites set [count dayz_activeInvites,_invite];
|
||||
|
||||
//Sync change to all remote machines (less data than sending whole array)
|
||||
PVDZ_groupInvite = [true,_invite];
|
||||
publicVariableServer "PVDZ_groupInvite";
|
||||
|
||||
systemChat format[localize "STR_EPOCH_INVITE_TO",name _recipient];
|
||||
32
SQF/dayz_code/groups/joinGroup.sqf
Normal file
32
SQF/dayz_code/groups/joinGroup.sqf
Normal file
@@ -0,0 +1,32 @@
|
||||
private ["_inviter","_inviterUID","_oldGroup","_uid"];
|
||||
|
||||
_inviterUID = "0";
|
||||
_uid = getPlayerUID player;
|
||||
|
||||
//Remove all invites to this player since they joined a group
|
||||
{
|
||||
if (_uid == _x select 1) then {
|
||||
_inviterUID = _x select 0; //Take most recent invite
|
||||
dayz_activeInvites set [_forEachIndex,"delete"];
|
||||
};
|
||||
} forEach dayz_activeInvites;
|
||||
dayz_activeInvites = dayz_activeInvites - ["delete"];
|
||||
|
||||
//Sync change to all remote machines (less data than sending whole array)
|
||||
PVDZ_groupInvite = [false,_uid];
|
||||
publicVariableServer "PVDZ_groupInvite";
|
||||
|
||||
_inviter = _inviterUID call dayz_getPlayer;
|
||||
|
||||
if (!isNull _inviter) then {
|
||||
_oldGroup = group player;
|
||||
[player] join (group _inviter);
|
||||
if (count (units _oldGroup) == 0) then {deleteGroup _oldGroup;};
|
||||
|
||||
// Update saved group in DB
|
||||
PVDZ_Server_UpdateGroup = [1,player];
|
||||
publicVariableServer "PVDZ_Server_UpdateGroup";
|
||||
} else {
|
||||
_this ctrlShow false;
|
||||
systemChat localize "STR_EPOCH_INVITE_EXPIRED";
|
||||
};
|
||||
15
SQF/dayz_code/groups/kickFromGroup.sqf
Normal file
15
SQF/dayz_code/groups/kickFromGroup.sqf
Normal file
@@ -0,0 +1,15 @@
|
||||
private ["_myGroup","_target","_targetUID"];
|
||||
|
||||
disableSerialization;
|
||||
_myGroup = findDisplay 80000 displayCtrl 2;
|
||||
_targetUID = _myGroup lbData (lbCurSel _myGroup);
|
||||
_target = _targetUID call dayz_getPlayer;
|
||||
|
||||
if (isNull _target or _target == player or player != leader group player) exitWith {
|
||||
_this ctrlShow false;
|
||||
};
|
||||
|
||||
[_target] join grpNull;
|
||||
|
||||
PVDZ_Server_UpdateGroup = [2,player,_targetUID];
|
||||
publicVariableServer "PVDZ_Server_UpdateGroup";
|
||||
16
SQF/dayz_code/groups/leaveGroup.sqf
Normal file
16
SQF/dayz_code/groups/leaveGroup.sqf
Normal file
@@ -0,0 +1,16 @@
|
||||
private "_group";
|
||||
_group = units group player;
|
||||
|
||||
if (count _group == 1 or (!isNil "dayz_groupLeftThread" && {!scriptDone dayz_groupLeftThread})) exitWith {
|
||||
_this ctrlShow false;
|
||||
};
|
||||
|
||||
dayz_groupLeft = nil;
|
||||
PVDZ_Server_UpdateGroup = [3,player];
|
||||
publicVariableServer "PVDZ_Server_UpdateGroup";
|
||||
|
||||
dayz_groupLeftThread = [] spawn {
|
||||
//Wait for response from server to confirm group finished updating in DB
|
||||
waitUntil {!isNil "dayz_groupLeft"};
|
||||
[player] join grpNull;
|
||||
};
|
||||
71
SQF/dayz_code/groups/openDialog.sqf
Normal file
71
SQF/dayz_code/groups/openDialog.sqf
Normal file
@@ -0,0 +1,71 @@
|
||||
if (!isNull findDisplay 80000) exitWith {};
|
||||
|
||||
private ["_disbandButton","_display","_group","_index","_inviteButton","_inviter","_inviterUID","_kickButton","_leader","_leaveButton","_myGroup","_playerList","_promoteButton","_uid"];
|
||||
disableSerialization;
|
||||
createDialog "DZ_GroupDialog";
|
||||
_display = findDisplay 80000;
|
||||
_uid = getPlayerUID player;
|
||||
_playerList = _display displayCtrl 1;
|
||||
_myGroup = _display displayCtrl 2;
|
||||
_inviteButton = _display displayCtrl 3;
|
||||
_kickButton = _display displayCtrl 4;
|
||||
_disbandButton = _display displayCtrl 5;
|
||||
_leaveButton = _display displayCtrl 6;
|
||||
_joinButton = _display displayCtrl 7;
|
||||
_rejectButton = _display displayCtrl 8;
|
||||
_inviteText = _display displayCtrl 9;
|
||||
_promoteButton = _display displayCtrl 10;
|
||||
{_x ctrlShow false;} count [_disbandButton,_inviteButton,_joinButton,_kickButton,_leaveButton,_promoteButton,_rejectButton];
|
||||
|
||||
while {!isNull findDisplay 80000} do {
|
||||
//Fill my group list
|
||||
_group = group player;
|
||||
_leader = leader _group;
|
||||
lbClear _myGroup;
|
||||
{
|
||||
if (alive _x && isPlayer _x) then {
|
||||
_index = _myGroup lbAdd (name _x);
|
||||
_myGroup lbSetData [_index,getPlayerUID _x];
|
||||
_myGroup lbSetPicture [_index, if (_x == _leader) then {"\ca\ui\data\icon_unit_teamleader_ca.paa"} else {"\ca\ui\data\map_bush_ca.paa"}];
|
||||
};
|
||||
} count (units _group);
|
||||
lbSort _myGroup;
|
||||
|
||||
if (lbSize _myGroup > 1) then {
|
||||
_leaveButton ctrlShow true;
|
||||
if (player == _leader) then {_disbandButton ctrlShow true};
|
||||
} else {
|
||||
{_x ctrlShow false} count [_disbandButton,_leaveButton];
|
||||
};
|
||||
|
||||
_hasInvite = false;
|
||||
{
|
||||
if (_x select 1 == _uid) then {
|
||||
_hasInvite = true;
|
||||
_inviterUID = _x select 0; //Take most recent invite
|
||||
};
|
||||
} forEach dayz_activeInvites;
|
||||
|
||||
if (_hasInvite) then {
|
||||
{_x ctrlShow true} count [_inviteText,_joinButton,_rejectButton];
|
||||
_inviter = _inviterUID call dayz_getPlayer;
|
||||
if (!isNull _inviter) then {
|
||||
_inviteText ctrlSetStructuredText parseText (format ["%1<br/>%2",localize "STR_EPOCH_INVITE_FROM",name _inviter]);
|
||||
};
|
||||
} else {
|
||||
{_x ctrlShow false} count [_inviteText,_joinButton,_rejectButton];
|
||||
};
|
||||
|
||||
//Fill player list
|
||||
lbClear _playerList;
|
||||
{
|
||||
if (isPlayer _x && _x != player) then {
|
||||
_index = _playerList lbAdd (name _x);
|
||||
_playerList lbSetData [_index, getPlayerUID _x];
|
||||
_playerList lbSetPicture [_index, if (count (units group _x) > 1) then {"\ca\ui\data\ui_task_failed_ca.paa"} else {"\ca\ui\data\ui_task_done_ca.paa"}];
|
||||
};
|
||||
} count allUnits;
|
||||
lbSort _playerList;
|
||||
|
||||
uiSleep 1;
|
||||
};
|
||||
23
SQF/dayz_code/groups/promotePlayer.sqf
Normal file
23
SQF/dayz_code/groups/promotePlayer.sqf
Normal file
@@ -0,0 +1,23 @@
|
||||
private ["_disbandButton","_display","_group","_myGroup","_target","_uid"];
|
||||
|
||||
disableSerialization;
|
||||
_display = findDisplay 80000;
|
||||
_myGroup = _display displayCtrl 2;
|
||||
_disbandButton = _display displayCtrl 5;
|
||||
_promoteButton = _this;
|
||||
_uid = _myGroup lbData (lbCurSel _myGroup);
|
||||
|
||||
_group = group player;
|
||||
_target = _uid call dayz_getPlayer;
|
||||
|
||||
if (player == leader _group && {!isNull _target} && {_target != player}) then {
|
||||
if (local _group) then {
|
||||
_group selectLeader _target; //group must be local
|
||||
_promoteButton ctrlShow false;
|
||||
_disbandButton ctrlShow false;
|
||||
} else {
|
||||
systemChat "Failed: Group must be local to do this";
|
||||
};
|
||||
} else {
|
||||
_promoteButton ctrlShow false;
|
||||
};
|
||||
16
SQF/dayz_code/groups/rejectGroup.sqf
Normal file
16
SQF/dayz_code/groups/rejectGroup.sqf
Normal file
@@ -0,0 +1,16 @@
|
||||
private "_uid";
|
||||
_uid = getPlayerUID player;
|
||||
|
||||
//Remove all invites to this player
|
||||
{
|
||||
if (_uid == _x select 1) then {
|
||||
dayz_activeInvites set [_forEachIndex,"delete"];
|
||||
};
|
||||
} forEach dayz_activeInvites;
|
||||
dayz_activeInvites = dayz_activeInvites - ["delete"];
|
||||
|
||||
_this ctrlShow false;
|
||||
|
||||
//Sync change to all remote machines (less data than sending whole array)
|
||||
PVDZ_groupInvite = [false,_uid];
|
||||
publicVariableServer "PVDZ_groupInvite";
|
||||
15
SQF/dayz_code/groups/selectGroupMember.sqf
Normal file
15
SQF/dayz_code/groups/selectGroupMember.sqf
Normal file
@@ -0,0 +1,15 @@
|
||||
private ["_display","_kickButton","_myGroup","_promoteButton","_target","_uid"];
|
||||
|
||||
disableSerialization;
|
||||
_display = findDisplay 80000;
|
||||
_myGroup = _this;
|
||||
_kickButton = _display displayCtrl 4;
|
||||
_promoteButton = _display displayCtrl 10;
|
||||
_uid = _myGroup lbData (lbCurSel _myGroup);
|
||||
_target = _uid call dayz_getPlayer;
|
||||
|
||||
if (player == leader group player && {!isNull _target} && {_target != player}) then {
|
||||
{_x ctrlShow true;} count [_kickButton,_promoteButton];
|
||||
} else {
|
||||
{_x ctrlShow false;} count [_kickButton,_promoteButton];
|
||||
};
|
||||
13
SQF/dayz_code/groups/selectPlayer.sqf
Normal file
13
SQF/dayz_code/groups/selectPlayer.sqf
Normal file
@@ -0,0 +1,13 @@
|
||||
private ["_inviteButton","_playerList","_target","_uid"];
|
||||
|
||||
disableSerialization;
|
||||
_playerList = _this;
|
||||
_inviteButton = findDisplay 80000 displayCtrl 3;
|
||||
_uid = _playerList lbData (lbCurSel _playerList);
|
||||
_target = _uid call dayz_getPlayer;
|
||||
|
||||
if (player == leader group player && {!isNull _target} && {count (units group _target) == 1}) then {
|
||||
_inviteButton ctrlShow true;
|
||||
} else {
|
||||
_inviteButton ctrlShow false;
|
||||
};
|
||||
42
SQF/dayz_code/groups/server_updateGroup.sqf
Normal file
42
SQF/dayz_code/groups/server_updateGroup.sqf
Normal file
@@ -0,0 +1,42 @@
|
||||
private ["_event","_groupUIDs","_key","_newGroup","_player","_playerUID","_targetUID"];
|
||||
|
||||
_event = _this select 0;
|
||||
_player = _this select 1;
|
||||
_targetUID = if (count _this > 2) then {_this select 2} else {"0"};
|
||||
_playerUID = getPlayerUID _player;
|
||||
|
||||
_groupUIDs = [];
|
||||
{
|
||||
if (alive _x && isPlayer _x) then {
|
||||
_groupUIDs set [count _groupUIDs,getPlayerUID _x];
|
||||
};
|
||||
} count (units group _player);
|
||||
|
||||
_newGroup = [];
|
||||
_newGroup = switch _event do {
|
||||
//Login
|
||||
case 0;
|
||||
//Join
|
||||
case 1;
|
||||
//Kick (target was already kicked from group)
|
||||
case 2: {_groupUIDs};
|
||||
//Leave
|
||||
case 3: {
|
||||
dayz_groupLeft = true;
|
||||
(owner _player) publicVariableClient "dayz_groupLeft";
|
||||
(_groupUIDs - [_playerUID])
|
||||
};
|
||||
//Disband
|
||||
case 4: {
|
||||
dayz_groupDisbanded = true;
|
||||
(owner _player) publicVariableClient "dayz_groupDisbanded";
|
||||
[]
|
||||
};
|
||||
};
|
||||
|
||||
// Update all group members' saved group in DB
|
||||
{
|
||||
_save = if ((_event == 2 && _x == _targetUID) or (_event == 3 && _x == _playerUID)) then {[]} else {_newGroup};
|
||||
_key = format ["CHILD:204:%1:%2:%3:",_x,dayZ_instance,_save];
|
||||
_key call server_hiveWrite;
|
||||
} count _groupUIDs;
|
||||
Reference in New Issue
Block a user