Jump to content
Sign in to follow this  
mr_shadow

[code] Varriables spelling check

Recommended Posts

Hello, can someone tell me how to make this work correct?

_pos = getpos player;
vehname= "Land_Money_F";
_veh = vehname createVehicle _pos;

_playermoney= player getVariable 'mymoney';
_veh setVariable['mymoney',((player getVariable 'mymoney') + _playermoney),true];	


[ [_veh], "deadmoney_fncMP_pickupAction", true, true] spawn BIS_fnc_MP;  

I know where the mistake exactly is:

_veh setVariable['mymoney',((player getVariable 'mymoney') + _playermoney),true];

I'm trying to do something like this:

_veh setVariable["mymoney",+ _playermoney,true];	

Which is obviously not working.

Any help please?

---------- Post added at 21:29 ---------- Previous post was at 21:18 ----------

Nevermind, fixed.

Share this post


Link to post
Share on other sites

Make sure you post the solution if you solve it yourself. Nothing more frustrating when researching and finally finding the appropriate thread all for nothing because the OP "Fixed his own issue" and didn't post the fix :p

Share this post


Link to post
Share on other sites
_moneyPile = createVehicle ["Land_Money_F", getpos player, [], 0, "CAN_COLLIDE"]; //This syntax is way faster than the old one
_playermoney= player getVariable ["mymoney",0]; //Now _playermoney is 0 if the variable doesn't exist
_moneyPile setvariable ["mymoney",_playermoney]; //Didn't quite get what you were trying to do, double the money amount the player had or just have the moneypile have the same amount?

Share this post


Link to post
Share on other sites
_pos = getpos player;
vehname= "Land_Money_F";
_veh = vehname createVehicle _pos;
_playermoney= player getVariable 'mymoney';

_veh setVariable["mymoney",0,true];
_veh setVariable["mymoney", (_veh getVariable "mymoney") + _playermoney,true];	

[ [_veh], "deadmoney_fncMP_pickupAction", true, true] spawn BIS_fnc_MP;  	

Share this post


Link to post
Share on other sites

Yeah I'd use create vehicle array instead and set a default value for mymoney incase it's nil. Though I think he already solved the issue :confused:

Oops ninja'd by shadow. Thanks for posting the solution. Better late than never =). This benefits future readers =)

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  

×