Simple Inventory Script
NOTE: This is just a simple inventory addon/mod, not anything too fancy.
First, log in to phpMyAdmin or wherever you can manage your database and add a new table with the following: id, int(11), not null, auto_increment owner, varchar(40), latin1_general_ci, yes (NULL) itemtype, varchar(40), latin1_general_ci, yes (NULL) imgurl, varchar(120), latin1_general_ci, yes (NULL) This allows for ID search if such a mod is made, the owner, what kind of item it is, and its image's URL. Now create a new page with this script. PHP Code:
Now, in order for users to hold items, they need them to begin with, correct? To make a page (or part of a page) hand out an item to the current user, add this script where needed: PHP Code:
If I missed anything, please tell me, as well as if you find any glitches. This is my first major modification, so it can be improved. So give me feedback :colonu: EDIT: btw, if you need a replacement image or temporary image for an item, you may use what I made; http://img37.imageshack.us/img37/1815/74598913.png Code:
http://img37.imageshack.us/img37/1815/74598913.png |
this was very helpful, thanks! :3
|
I'm glad it helped you. :pleased:
|
YOU POSTED IT! :happycbig::smile:
This is definitely going to be useful. :OHSHITALION: I LOL'd at the text version of the :OHSHITALION: smiley. XDDDDD /off-topic |
Yus, I finally posted it.
Now all we need is an awesome face smiley...:OHSHITALION: |
I'm having a problem with this script, it's not showing up and telling me I have an error on line 113, which is the following;
$template = file_get_contents($file); It's saying it can't find the file? |
Well this script is incompatible with Mys v1.2.x, you will have to make slight modifications for it to work. Simply take out the site information at the beginning and template definition at the bottom of this script file and it should work just fine.
|
I tried doing that and it looked okay, but then it kept saying I wasn't logged in every time I visited. Someone helped me edit the script a little, i'll try again.
|
Quote:
|
my inventory script looks like this right now;
Code:
<?php the page looks fine when i'm logged out though. |
I don't know much about this mod but this should work
PHP Code:
|
thank you, it worked! :D I did redo the database too, just to be on the safe side, and that may have been it... now, I shall go test an item, thank you so much!
EDIT: Darn, now I'm just having trouble with the item giver thingy. D: Every time I try to test it, it gives me an error. I'm testing on a random page; Code:
<?php It says; Parse error: syntax error, unexpected T_VARIABLE in /home/gloometh/public_html/item.php on line 12 |
This should work
PHP Code:
And you forgot an opening curly bracket after the ($isloggedin == "yes") |
well, that did work, except that the image or the name aren't showing up. The page I tested it on was blank, but blank items are showing up in my inventory. It doesn't show an image or a name, but it shows the id.
I'm sorry for all of the trouble with this... D: |
Quote:
For the images & names that aren't showing up, it's probably because a mismatch between the column name in the table and the selected column while fetching data from the database. |
Alright, I shall look into it later.
Sorry for the stupidity, my rat had a stroke this morning and ive been freaking out. EDIT: I got it all worked out, thank you very, very much for your help! |
If there is a problem with Mys 1.2.0 compatibility, please tell me. I want to make this available to all users. :D
Sorry about your rat, Gloometh. D: |
The only problem I'm having now is that the name isn't showing up for some reason. The rest seems to be working fine.
Thanks - she's not getting much better, I think it's her last few days... |
All times are GMT -5. The time now is 04:58 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.