Jump to content
Sign in to follow this  
1para{god-father}

Help with Add action and passing a Value

Recommended Posts

Hi,

 

I have a little dialog so a player can drop some cash  - this all works they drop the cash fine and _money holds this value but then I need to attach an Addaction to the dropped money and pass the _money to the pickupcash.sqf , so when a player picks it up they get the correct amount.

 

just cannot seem to pass the value to .pickupcash.sqf



_cash = createVehicle ["Land_Money_F", [player, [0,1,0]] call relativePos, [], 0, "CAN_COLLIDE"];

///_money holds how much they dropped but not sure how to pass this using the addaction////

[[_cash ,[("<t color=""#FF0000"">" + ("Collect Money") + "</t>"),{_this execvm "scripts\pickupcash.sqf"},[],0,false,true, "",'']],"addAction",true,true,false] call BIS_fnc_MP;

pickupcash.sqf

deleteVehicle (_this select 0);  /// delete money

_money= _this select 1; ?????????????

hint "You've acquired xxx money";  // show amount they picked up

Share this post


Link to post
Share on other sites

You can pass arbitrary arguments via addAction. It is the parameter right after the path to the script (which, by the way, you can just use instead of running code that executes a script anyway). Just make the parameter equal to your money value, like this:

[[_cash ,[("<t color=""#FF0000"">" + ("Collect Money") + "</t>"),"scripts\pickupcash.sqf",myValue,0,false,true, "",'']],"addAction",true,true,false] call BIS_fnc_MP;

Note where I added "myValue" above. This is where you could put the value of the money dropped. Then, in your pickupcash.sqf:

_money= _this select 1;
_amount = _this select 3;
  • Like 1

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
Sign in to follow this  

×