Simple Machines Community Forum

SMF Support => Español (Spanish) => Language Specific Support => Modificaciones (Mods) => Aiheen aloitti: BBXtreme - tammikuu 30, 2011, 08:10:33 AP

Otsikko: [Ayuda] Objeto para SMF Shop
Kirjoitti: BBXtreme - tammikuu 30, 2011, 08:10:33 AP
Hola usuarios!

Tras muuuucho tiempo buscando el objeto lo he entrado!
pero no funciona como yo quiero, es decir falta ''retocarlo''.

    <?php
    
/**********************************************************************************
    * SMFShop item - Takes additional fields when adding to admin panel               *
    ***********************************************************************************
    * SMFShop: Shop MOD for Simple Machines Forum                                     *
    * =============================================================================== *
    * Software Version:           SMFShop 3.0 (Build 12)                              *
    * $Date:: 2007-01-18 19:26:55 +1100 (Thu, 18 Jan 2007)                          $ *
    * $Id:: AddToPostCount.php 79 2007-01-18 08:26:55Z daniel15                     $ *
    * Software by:                DanSoft Australia (http://www.dansoftaustralia.net/)*
    * Copyright 2005-2007 by:     DanSoft Australia (http://www.dansoftaustralia.net/)*
    * Support, News, Updates at:  http://www.dansoftaustralia.net/                    *
    *                                                                                 *
    * Forum software by:          Simple Machines (http://www.simplemachines.org)     *
    * Copyright 2006-2007 by:     Simple Machines LLC (http://www.simplemachines.org) *
    *           2001-2006 by:     Lewis Media (http://www.lewismedia.com)             *
    ***********************************************************************************
    * This program is free software; you may redistribute it and/or modify it under   *
    * the terms of the provided license as published by Simple Machines LLC.          *
    *                                                                                 *
    * This program is distributed in the hope that it is and will be useful, but      *
    * WITHOUT ANY WARRANTIES; without even any implied warranty of MERCHANTABILITY    *
    * or FITNESS FOR A PARTICULAR PURPOSE.                                            *
    *                                                                                 *
    * See the "license.txt" file for details of the Simple Machines license.          *
    * The latest version of the license can always be found at                        *
    * http://www.simplemachines.org.                                                  *
    **********************************************************************************/
    
if (!defined('SMF'))

    


    die(
'Hacking attempt...');

    class 
item_Ruleta extends itemTemplate
    
{

    


    function 
getItemDetails()

    


    {

    


    


    
$this->authorName 'HavitoX';

    


    


    
$this->authorWeb 'http://www.solotrades.com/';

    


    


    
$this->authorEmail '[email protected]';

    


    


    
$this->name 'Ruleta';

    


    


    
$this->desc '¡Gana 1 de casi todos los furnis que hay en el catálogo al azar!';

    


    


    
$this->price 100;

    


    


    
$this->require_input false;

    


    


    
$this->can_use_item true;

    


    


    
$this->addInput_editable true;

    


    }

    


    
// The additional parameters (see 'getAddInput' above) are in the $item_info array.

    


    
// Make sure to make it global (like shown here) otherwise you won't be able to access

    


    
// its contents. THE ARRAY IS 1-BASED (1 IS THE FIRST ITEM) NOT 0-BASED!

    



    


    
// The additional parameters (see 'getAddInput' above) are in the $item_info array.

    


    
// Make sure to make it global (like shown here) otherwise you won't be able to access

    


    
// its contents. THE ARRAY IS 1-BASED (1 IS THE FIRST ITEM) NOT 0-BASED!

    


    function 
onUse()

    


    {

    


    


    global 
$db_prefix$ID_MEMBER$item_info;

    


    



    


    


    
$query mysql_query("SELECT * FROM smf_shop_items ORDER BY RAND() LIMIT 1");

    


    


    
$datos mysql_fetch_array($query);

    


    


    
$furni $datos['name'];

    


    



    


    


    
db_query("INSERT INTO smf_shop_inventory (id,ownerid,itemid,amtpaid,trading,tradecost) VALUES ('NULL','".$ID_MEMBER."','".$datos['id']."','0.00','0','0.00')");
    return 
"<center><font color='#FF0000'><b>¡Felicidades!</font><br>Has ganado un:<br><img src='".$boardurl."/Sources/shop/item_images/".$datos['image']."' align='texttop'/><br>".$datos['name']."</b></center>";

    


    }

    }

    
?>


Ese es el código, ese objeto lo que hace es que te toca 1 objeto de la shop al azar.
Lo que yo quiero hacer es que toquen unos objetos que yo he seleccionado.
por ejemplo: Yo en la tienda tengo un avion, un camión y una tarta. y cuando un usuario compra 'este objeto' le toca uno de los 3 al azar
lo que yo quiero hacer: Yo en la tienda tengo un avion, un camión y una tarta. y cuando un usuario compra 'este objeto' que le toque unos que yo he subido previamente que serían, mando, tele, telefono (yo quiero que toquen mando, tele y telefono y no avión, camión ni tarta)