Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Questions and Supports (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=18)
-   -   Receiving an Item on a Specific Page? (http://www.mysidiaadoptables.com/forum/showthread.php?t=4885)

Sibyl 11-12-2015 12:58 PM

Receiving an Item on a Specific Page?
 
How can I make it so that my users can receive a specific item for going onto a certain page? And, better yet, make it so they can only receive said item once? ;~;

I'd love to do an exploration type system, but I'm uncertain of how to make it rewarding without the user having to be redirected to a shop so they can buy the item themselves, or make it so that there is a promo code. The problem with promo codes is that the user must leave the page to go enter the code, and they could share the codes with the other users. ;~~~;

If anyone knows even a makeshift way, that'd be wonderful ;v; thank you all very much.

Kyttias 11-13-2015 05:44 AM

I did a write up on some stuff that might be helpful here. Which, if you can follow it, should be more than enough to help you give a user an item -- and if you combine it with the item check later down the page, you should have what you need.

This would be especially good for super important quest items - does the user have a Fancy Lamp? If so, do nothing. If not, give them one.

PHP Code:

$item "Fancy Lamp";
$hasitem $mysidia->db->select("inventory", array("quantity"), "itemname ='{$item}' and owner='{$mysidia->user->username}'")->fetchColumn();
if(
$hasitem){
    
$document->add(new Comment("You have already obtained this {$item}!"));
} else {
    
$document->add(new Comment("It looks like you could use this {$item}!"));
    
$qty 1;
    
$newitem = new StockItem($item);
    
$newitem->append($qty$mysidia->user->username);  




All times are GMT -5. The time now is 02:09 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.