Jump to content
Haymaker

Multiply Variable Values?

Recommended Posts

private["_goods","_cash","_price"];




_goods = "Chemlight_yellow";
_cash = player getVariable "myCash";
_price = 10;
_num = count "_goods" in magazines player;


if ("Chemlight_yellow" in Magazines Player) then{


_price = _price + _num; // is there a way to achieve (_price = _price * _num)
_cash = _cash + _price;


player removeMagazine ["Chemlight_yellow",999999999];
["sellgoods",[format[(localize 'STR_HG_DLG_MC'),[(player getVariable '_cash')] call BIS_fnc_numberText]]] call BIS_fnc_showNotification;
player setVariable["myCash",_cash];
Hint "You have sold all of your wheat!";


}


else{


Hint "You don't have wheat!";
};



So I'm writing a script to sell items in the inventory of a player, but I've noticed you can't multiply numbers, or at least not with the characters I'm using. Help please?

Share this post


Link to post
Share on other sites

Sorry u r wrong because u can do this:

 

_price = _price * _num;
if price is 10 and num is 4 then after that operation _price is 40

the problem must be elsewhere

  • Like 1

Share this post


Link to post
Share on other sites

Sorry u r wrong because u can do this:

 

_price = _price * _num;
if price is 10 and num is 4 then after that operation _price is 40

the problem must be elsewhere

 

 

Oh okay, thanks!

 

I changed the _num variable and it works fine now!

_num = {_x == "Chemlight_Yellow"} count magazines player;

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×