Jump to content
Sign in to follow this  
MulleDK13

player addMagazine "LAWLauncher"; does not work!

Recommended Posts

Hi.

I'm working on my "2 Player Tournament" map, and it's going great.

I'm working on the tournament settings, and buy-scripts...

I have a dialog with some buttons.

"Buy LAW Launcher" and "Buy LAW"

The first is the weapon, and the last is magazines.

The LAW Launcher is inserted correctly when pushing the button, but the magazines won't appear when clicking "Buy LAW".

This is the Buy Mag script which is called when someone clicks the "Buy LAW" button.

Executed with: ["law" exec "buy_magazine.sqs"]

All the lines get executed buy not the law is empty!

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

;Script for Mortens Tournament 2006 (Written by MulleDK13)

_magazine = _this select 0;

? (_magazine == "law") : goto "buy_law"

? (_magazine == "") : goto "buy_nothing"

exit;

#buy_law

player addMagazine "LAWLauncher"

Player1Saldo = Player1Saldo - MPriceLAW;

_temp = "You bought a magazine!\n\nType: "

_temp = _temp + "LAW"

hint _temp

exit;

#buy_nothing

hint "ERROR! An error occurred! You tried to buy nothing!";

exit;

#ended

exit;

What is wrong?

Share this post


Link to post
Share on other sites

You're passing a string to the script -

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">"law" exec "buy_magazine.sqs"

then trying to access it as an array -

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_magazine = _this select 0;

You can either change the first line of your script to -

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_magazine = _this

or probably a better option (To make it easier for others to understand/use.) pass the arguments to the script in an array -

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">["law"] exec "buy_magazine.sqs"

Share this post


Link to post
Share on other sites

Oops.

I didn't mean...

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">["law" exec "buy_weapon.sqs"]

But...

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">["law"] exec "buy_weapon.sqs"

But the problem isn't there...

Cause the line where the mag is inserted is being executed! 'cause those hints are coming! but no LAW!

Share this post


Link to post
Share on other sites

hmmm, i can't see any errors in your script then!

but no LAW!

After the script has executed does the ammo show up in the 'gear' section of the notepad?

Share this post


Link to post
Share on other sites

Aaaah... lol! thank you!

The GEAR was full, so it could not be added... But no message was shown...

Is it possible to determine if the ammo were added successfully with the addMagazine command?

Share this post


Link to post
Share on other sites

I am not wanting to bring this post back up, but once you look at the string again...

... I suggest that you take a look at the forum rules. It specifically pointed out "No Swearing".

Just to let you know, I am not mad dude. smile_o.gif Can't you feel the love? Hahahaaaa!

PS.: I am not trying to be mister boss, or Good guy.

Share this post


Link to post
Share on other sites
... I suggest that you take a look at the forum rules. It specifically pointed out "No Swearing".

What do you mean??? Where did I swear?

Share this post


Link to post
Share on other sites
Dude I'm not mad.  smile_o.gif

Who knows? icon_rolleyes.gif

What do you really mean AgentJonathan?

Stop drink before posting man, it'll make others

help understanding what you want say. confused_o.gif

~S~ CD

Share this post


Link to post
Share on other sites

Here is a clear version:

Mulle, It is rude to cuss, and it offends people.

Quote[/b] ] Why the @#!* is there no magz.

Ps: not mad smile_o.gifsmile_o.gif

Share this post


Link to post
Share on other sites

No hard feelings. I just didn't want the mods/admin to get onto you. smile_o.gif Pleased to serve you (as long as you aint no tight-wad! biggrin_o.gif )

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  

×