Jump to content
  • 0

DZGM + ZSC - Paying coins for invite Player?


joe_candy

Question

Hey there...

 

I would like to use the group managemant system, but to invite a player should costs coins.

some idea how to realize that?

 

i've a idea like this

 

add at the inviteToGroup.sqf

 

 

Own Code deletet, cause was wrong. This code is the right one. Thx and credits to Gr8

if (player != leader group player) exitWith {systemChat "You are not the leader and can not invite people.";};

disableSerialization;

private ["_dialog","_playerListBox","_pTarget","_index","_playerData","_check","_hasInvite"];

_dialog = findDisplay 55510;
_playerListBox = _dialog displayCtrl 55511;
_index = lbCurSel _playerListBox;
_playerData = _playerListBox lbData _index;
_hasInvite = false;
_playerCash = player getVariable ["cashMoney",0]; // Check the Money
_price = 1000;
_check = 0;
{
    if ((!isNull _x) && {isPlayer _x} && {str(_x) == _playerData}) exitWith {_pTarget = _x;_check = 1;};
} count playableUnits;

if (_check == 0) exitWith {systemChat "You must select someone to invite first.";};
if (_pTarget == player) exitWith {systemChat "You can not invite yourself.";};
if (count units group _pTarget > 1) exitWith {systemChat "This player is already in a group.";};

{if (_x select 1 == getPlayerUID _pTarget) then {_hasInvite = true;};} forEach currentInvites;
if (_hasInvite) exitWith {systemChat "This player already has a pending invite.";};
if (_playerCash < _price) exitWith {systemChat "You need 1000 coins to invite a player.";}; // Check failed
currentInvites set [count currentInvites,[getPlayerUID player,getPlayerUID _pTarget]];
publicVariableServer "currentInvites";
player setVariable["cashMoney",(_playerCash - _price),true];
[nil,_pTarget,"loc", rTITLETEXT, format["You have received a group invite. Right Shift to view."], "PLAIN", 0] call RE;

systemChat format["You have invited %1 to join the group",name _pTarget];
systemChat "Press left windows key to toggle group name tags";

 

can't test it with myself ^^ just have to wait for the second server admin ^^

so i just ask here if my idea will be correct. ^^

 

PS: Ok, first test... it doesn't work... try to find the mistake

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0
if (player != leader group player) exitWith {systemChat "You are not the leader and can not invite people.";};

disableSerialization;

private ["_dialog","_playerListBox","_pTarget","_index","_playerData","_check","_hasInvite"];

_dialog = findDisplay 55510;
_playerListBox = _dialog displayCtrl 55511;
_index = lbCurSel _playerListBox;
_playerData = _playerListBox lbData _index;
_hasInvite = false;
_playerCash = player getVariable ["cashMoney",0]; // Check the Money
_price = 1000;
_check = 0;
{
	if ((!isNull _x) && {isPlayer _x} && {str(_x) == _playerData}) exitWith {_pTarget = _x;_check = 1;};
} count playableUnits;

if (_check == 0) exitWith {systemChat "You must select someone to invite first.";};
if (_pTarget == player) exitWith {systemChat "You can not invite yourself.";};
if (count units group _pTarget > 1) exitWith {systemChat "This player is already in a group.";};

{if (_x select 1 == getPlayerUID _pTarget) then {_hasInvite = true;};} forEach currentInvites;
if (_hasInvite) exitWith {systemChat "This player already has a pending invite.";};
if (_playerCash < _price) exitWith {systemChat "You need 1000 coins to invite a player.";}; // Check failed
currentInvites set [count currentInvites,[getPlayerUID player,getPlayerUID _pTarget]];
publicVariableServer "currentInvites";
player setVariable["cashMoney",(_playerCash - _price),true];
[nil,_pTarget,"loc", rTITLETEXT, format["You have received a group invite. Right Shift to view."], "PLAIN", 0] call RE;

systemChat format["You have invited %1 to join the group",name _pTarget];
systemChat "Press left windows key to toggle group name tags";

Your Code Is very confusing and wrong, Try this

Link to comment
Share on other sites

  • 0

Hey, thanks..

 

I just try to understand a code and config like my idea.. ^^

 

Your code looks really better ^^ first try works... now wait for my sec admin to test it more ^^

 

Edit: everything is fine... thanks a lot...

 

No Problem ! Nice try though

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...