Bowla1111 Posted December 8, 2010 Posted December 8, 2010 where where do you change the 4's in item type id for guns. Quote
Ben-Nasha Posted April 9, 2011 Posted April 9, 2011 It would be better if you added a $rand so a random amount of bullets get shot... Quote
classified Posted October 14, 2015 Posted October 14, 2015 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 Quote
Veramys Posted October 15, 2015 Posted October 15, 2015 You want to give melee weapons an ammo count? Quote
classified Posted October 15, 2015 Posted October 15, 2015 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 Quote
Coly010 Posted October 15, 2015 Posted October 15, 2015 If (weapon_type == "melee"){ // ignore ammo code } else { // do ammo code } Somewhat pseudo code in nature Quote
classified Posted October 16, 2015 Posted October 16, 2015 (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 October 17, 2015 by classified Quote
boionfire81 Posted March 21, 2016 Posted March 21, 2016 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. Quote
G7470 Posted March 22, 2016 Posted March 22, 2016 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 Quote
Coly010 Posted March 22, 2016 Posted March 22, 2016 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. Quote
G7470 Posted March 22, 2016 Posted March 22, 2016 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 Quote
boionfire81 Posted March 22, 2016 Posted March 22, 2016 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) Quote
boionfire81 Posted March 22, 2016 Posted March 22, 2016 my bad, just mysql as I had to downgrade my php to work for the mccode. Quote
boionfire81 Posted March 29, 2016 Posted March 29, 2016 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 Quote
KyleMassacre Posted March 29, 2016 Posted March 29, 2016 Is the item's type 15 in the database? Quote
boionfire81 Posted March 29, 2016 Posted March 29, 2016 Yes in itemtypes data it is listed as 15, worded as Gun. Quote
KyleMassacre Posted March 30, 2016 Posted March 30, 2016 I don't know if the issue is that you have $_POST['ID'] and $_POST['id'] mixed together or not but you can try finding all the lowercase ones and making them uppercase Quote
boionfire81 Posted March 30, 2016 Posted March 30, 2016 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. Quote
AdamHull Posted March 30, 2016 Posted March 30, 2016 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. Quote
boionfire81 Posted March 30, 2016 Posted March 30, 2016 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 Quote
KyleMassacre Posted March 30, 2016 Posted March 30, 2016 When you go to purchase the ammo and it says this is not a gun, what is the URL that you are at? Quote
boionfire81 Posted March 30, 2016 Posted March 30, 2016 ammunition.php?ID=80 with 80 being the item id Quote
KyleMassacre Posted March 30, 2016 Posted March 30, 2016 Quick question, I know you are beginning but are you aware of the differences between $_POST and $_GET? Because it seems to me that some of your $_POST data actually needs to be $_GET Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.