| |
|
|
| |
|
|
| |
|
tata!! Itemshop!
02.17.02, 06:37:01
|
|
|
|
Post #1 (permalink) |
|
|
| |
|
|
Hehe. I put this little thing together. It's nothing fancy, but it does it's job.
It works together with the points hack. Your items and the cost (in points) are kept in an array inside itemshop.php. You'll have to edit the file each time you want to add a new item.I might add database support for items later and a cp interface, but right now, it's good.
First, you'll need to add another profile field.
Title: Item or whatever you want to call it
Description: up to you
Max Input: 100
Field Length: 25
Display Order: current fields +1
Required: no
Hidden: no
Editable: no
it's basically just like the points. Remember the field number and change it in the file. Default is(if you haven't added any other fields before):
points: 5
item: 6
in itemshop.php you may want to change the $loop variable. Associated images should be put in the images/itemshop/ direcotry, and have the same name you gave the item in the array.
if you don't want associated images, you must take them out in the file and in the itemshop template.
upload the file itemshop.php
make a template called itemshop, and put in the contents of the itemshop.txt file
in the postbit template:
under: <a href="moderator.php?s=$session[sessionhash]&action=points&userid=$userinfo[userid]" target=_blank>Points:</a> $post[field5]<br> (or whatever you have for your points)
put: <a href="itemshop.php">Item:</a> $post[field6]<br>
if you wish any new user to have "No Item" instead of nothing in the postbit template, run this query:
ALTER TABLE `forums`.`userfield` CHANGE `field6` `field6` CHAR(250) DEFAULT 'No Item' NOT NULL
change forums to the name of the database, and field6 to the number of your item field.
please note that it won't modify any existing users. Just users that register after you run the query.
That's about all. I'll edit this if i forgot anything.
Enjoy! |
______________________________________

Last edited by rake : 02.17.02 at 08:21:54.
|
|
|
|
|
|
Update: Added error pages if you don't have enough points and if you already have the item. Added thank you page.
The items will only be linked if you can afford them. |
|
|
|
|
|
|
Wow, you've impressed me greatly, Mewtwo. I'll look into this and test it soon.
EDIT: Can you get multiple items? |
______________________________________

From the founder of Final Fantasy Republic
Gamertag Nation
|
|
|
|
|
|
thanks. I already tested it on my localhost. (i'm running apache+php+mysql locally)
it doesn't support multiple items yet. But i might do that soon. |
|
|
|
|
|
|
Umm...uh oh. Might want to get that Itemshop fixed. Take a gander at my RP, rofl!
If $RPVar < 0 then Displaysteherrorsubroutine!
 |
|
|
|
|
|
|
| Aha, I see. I'll go talk with Vivi (the creator of the script). |
|
|
|
|
|
|
______________________________________
A E R O S O L
I AM BLACK, JEWISH, AND COMPLETELY WORTHLESS, I PROMISE
|
|
|
|
|
|
actually you should talk to crono too. He posted it for me on vbulletin. And if you don't belive me, talk to both of them.
and there shouldn't be any negative number. there's an if statement that compares your points to the the item you want to buy. If you don't have enough points you get am error message. (you actually shouldn't even see that at all, because there's no link if the item costs more than you have.
here's what i get on my test forums if i try to buy blood sword, which costs more than i have, and isn't linked:
my conclusion is that you did something wrong when editing itemshop.php |
Last edited by rake : 02.17.02 at 11:09:59.
|
|
|
|
| |