Jump to content
MakeWebGames

Ammo


Guest Sniko`

Recommended Posts

  • 1 year later...
  • Replies 66
  • Created
  • Last Reply

Top Posters In This Topic

  • 3 months later...
  • 4 years later...
This will enable you to buy ammo for each gun.

Try this.

Run SQL:

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

Create ammunition.php:

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

In inventory.php find:

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

In attack.php replace:

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

with:

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

Also in attack.php find:

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

replace with:

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

Change the 4's in this to your item type id for guns.

if anyone could help me set this up to use melee weapons with this please msg me I have it working for guns but cant figure it out for melee weapons

thanks clay420

Link to comment
Share on other sites

awesome thanks so much man I'm gonna give that a try and see what happens

Just tried out your code Coly010 and I made that work, Thank you again I would have never thought of that on my own lol

 

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

Edited by classified
Link to comment
Share on other sites

  • 5 months later...

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

does not seem to correspond to a valid mysql. I updated to item type 15 (gun). But the mysql structure is does not contain those values. I'm just learning to read mysql, so please bear with me here.

 

I wouldn't suggest saying that it's invalid MySQL if you are just learning to read it.

The MySQL syntax in and of itself is perfectly fine and valid.

Also, when I copy/paste your code into Notepad++, it's all on one line. Put statements on separate lines next time - makes it easier to read.

~G7470

Link to comment
Share on other sites

not completely valid i think:

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

The where clause is probably where you are having the problems.

change to:

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

Nice catch, although if those are standard MCCode tables (and judging by this, they are) the ambiguity of those fields is perfectly fine for the MySQL engine because the other table doesn't have those fields defined. Unless for whatever reason PHP doesn't approve of it (which I highly doubt) this should still run properly.

Should this be fixed irregardless? Absolutely. If you're going to put aliases on your tables in a query, you should write your SQL statements with those aliases throughout the query.

~G7470

Link to comment
Share on other sites

Right now my debug is turned on so I see every little error even.

I'm using mysqli with mccode v2.0.5

Issue here is if I input the weapon category id which is 15 then the buy ammunition link doesn't appear. If I remove just the 15 the button will appear, but then tells me it is not a valid weapon when I try to buy ammo.

The error on inventory.php without the id is of course:

A non-critical error has occurred. Page execution will continue. Below are the details:

PHP Notice: Undefined index: weip (8)

A non-critical error has occurred. Page execution will continue. Below are the details:

PHP Notice: Undefined variable: i (8)

Link to comment
Share on other sites

yeah I know. But I have been playing around with it a bit. The post ID v id doesn't seem to make a difference. But the GET ID v id did. That's why I tried playing around with those values. Have reverted the post id back to ID (all instances of post id) and just back to square one. No matter what This item is not a Gun

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...