Jump to content
MakeWebGames

Recommended Posts

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

Top Posters In This Topic

  • 3 months later...
  • 4 years later...
Posted
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

Posted

no what id like to do with it is to have it so that primary & secondary use ammo and then the melee weapons don't use anything I have 4 different types of guns on my game currently but when I try and make an attack using a melee weapon it says I have no ammo for this weapon

Posted (edited)

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
  • 5 months later...
Posted

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.

Posted

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

Posted

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.

 

Posted
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

Posted

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)

Posted

Ok, this is my one and only project today. (Unless I hear back from Kyle)

 

You're unable to view this code.

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

 

Always shows This item is not a Gun! for the ammunition.php file

Posted

Well it started with GET ID & POST ID. The GET ID had to be changed from ID to id, in order for the page to display at all. So I've been playing around a bit with the ID v id part. And in either case the result is the same. This item is not a gun.

Posted

I think what kyle was trying to say in you need to change

You're unable to view this code.

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

To

You're unable to view this code.

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

Posted

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

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...