Jump to content
Sign in to follow this  
Guest

(money script) error undefined variable in expression: this

Recommended Posts

Guest

Buy script:

if (Mymoney < 250) then

{

Hint "You do not have enough money";

} else {

Mymoney = Mymoney -250;

this addWeapon "AK_74";

Hint "You bought an AK_47";

};

init script:

Mymoney = 250

player init:

Buy_Ak47 = this AddAction ["<t color="#F6FF00"">" +"Buy Ak47", "buy.sqf];

Share this post


Link to post
Share on other sites

Replace "this" with "player" or even better, use parameters:

buy.sqf:

_caller = _this select 1;
_caller addWeapon "AK_74";

Share this post


Link to post
Share on other sites
Guest
replace this by _this

When i do that, it says: No entry 'config.bin/CfgWeapons.AK_47'.

Share this post


Link to post
Share on other sites
Guest

I did that...It says No entry 'config.bin/CfgWeapons.AK_47'. too...

Share this post


Link to post
Share on other sites

Well, there is no AK-47 in Arma 3 vanilla. I guess you need an addon for that.^^

Share this post


Link to post
Share on other sites
Guest
Well, there is no AK-47 in Arma 3 vanilla. I guess you need an addon for that.^^

hahaha, I feel really stupid now...

---------- Post added at 10:52 ---------- Previous post was at 10:48 ----------

Well, there is no AK-47 in Arma 3 vanilla. I guess you need an addon for that.^^

Do you know where there is a list of items/weapons/etc..?

and btw, i'd like to have multiple weapons/items to buy, how would i go on and do that?

Edited by Guest

Share this post


Link to post
Share on other sites

The Arma 3 asset library should be the address for you.

If you want to stick with your approach you could add another action to buy a different weapon but that's getting out of hand when you add more and more weapons. A dialog based system might be the better idea. Maybe there are already scripts out there, I don't know and I've never tried doing this.^^

Share this post


Link to post
Share on other sites
Guest
The Arma 3 asset library should be the address for you.

If you want to stick with your approach you could add another action to buy a different weapon but that's getting out of hand when you add more and more weapons. A dialog based system might be the better idea. Maybe there are already scripts out there, I don't know and I've never tried doing this.^^

I'll take a look, thanks a lot for your help and everyone else's help. :)

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  

×