Jump to content
  • 0

Help to charge coins as a condition of deploy script


kingpapawawa

Question

i just added the SC_fnc_removecoins with the updated Virtual Garage thanks to @theduke
 

SC_fnc_removeCoins=
{
	private ["_player","_amount","_wealth","_newwealth", "_result"];
	_player = _this select 0;
	_amount = _this select 1;
	_result = false;
	_wealth = _player getVariable["cashMoney",0];  
	if(_amount > 0)then{
	if (_wealth < _amount) then {
	_result = false;
	} else {                         
	_newwealth = _wealth - _amount;
	_player setVariable["cashMoney",_newwealth, true];
	_player setVariable ["moneychanged",1,true];    
	_result = true;
	PVDZ_plr_Save = [_player,(magazines _player),true,true] ;
	publicVariableServer "PVDZ_plr_Save";            
	};
	}else{
	_result = true;
	};
	_result
};



Now that i have this in my compiles i wonder... how can i use this in other places.. like the final condition on deploy anything to charge coins for a user to deploy something..

 _condition    | string of code to evaluate to determine whether action is shown     | string | "!(isNull player) && {(getPlayerUID player) in DZE_DEPLOYABLE_ADMINS}"

Any thoughts?

 

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0
45 minutes ago, kingpapawawa said:

i just added the SC_fnc_removecoins with the updated Virtual Garage thanks to @theduke
 


SC_fnc_removeCoins=
{
	private ["_player","_amount","_wealth","_newwealth", "_result"];
	_player = _this select 0;
	_amount = _this select 1;
	_result = false;
	_wealth = _player getVariable["cashMoney",0];  
	if(_amount > 0)then{
	if (_wealth < _amount) then {
	_result = false;
	} else {                         
	_newwealth = _wealth - _amount;
	_player setVariable["cashMoney",_newwealth, true];
	_player setVariable ["moneychanged",1,true];    
	_result = true;
	PVDZ_plr_Save = [_player,(magazines _player),true,true] ;
	publicVariableServer "PVDZ_plr_Save";            
	};
	}else{
	_result = true;
	};
	_result
};



Now that i have this in my compiles i wonder... how can i use this in other places.. like the final condition on deploy anything to charge coins for a user to deploy something..

 _condition    | string of code to evaluate to determine whether action is shown     | string | "!(isNull player) && {(getPlayerUID player) in DZE_DEPLOYABLE_ADMINS}"

Any thoughts?

 

The config option doesn't work how you think it does.

It's just a condition of showing the actual deployable, in which case you would do something like:

"player getVariable [z_moneyVariable,0] >= 50000"

for example:

["ItemToolbox",[0,9,2],5,0.9,true,true,false,false,false,true,true,["MMT_Civ"],[],["ItemToolbox"],"player getVariable [z_moneyVariable,0] >= 50000"],

For it to actually take coins off you, it would need changes elsewhere

Link to comment
Share on other sites

  • 0

ok, so that checks to see if they have over 50k. essentially needs changes to the base part of deploy script to add an additional _takemoney  after _condition or ability to call a script.

Your version or deploy is quite a bit different but not sure that i can get either to actually save to the database. comparing the two in diffmerge have been very helpful in learning tho. seeing whats changed and trying to understand why.

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...