1
Items / Simple Lotery
« on: March 01, 2011, 02:16:07 am »
Ok, Primero en español:
Este Item es básicamente un sistema de "billete premiado" en que los usuarios ingresan un numero entre 1 y X, si resulta el mismo que arroja el PHP, resultan ganadores de Y creditos
X y Y Se configuran abiertamente desde Admin panel, pudiendo crear algo sencillo o algo complejo.
Ej: numero entre 1 y 3 o numero entre 1 y 100.
En caso de que el usuario coloque un numero mayor a X (en el primer ejemplo, 4) habrá desperdiciado su dinero.
Now in english
This Item is basically a system of "winning ticket"in which users enter a number between 1 and X, if it is cast by the PHP, are winners of Y credits
X and Y are configured openly from Admin panel and can create simple or complex.
Eg number between 1 and 3 or number between 1 and 100.
If the user to place a number greater than X (in the first instance, 4) have wasted their money.
(google translate LOL)
(Review the file to translate texts)
Este Item es básicamente un sistema de "billete premiado" en que los usuarios ingresan un numero entre 1 y X, si resulta el mismo que arroja el PHP, resultan ganadores de Y creditos
X y Y Se configuran abiertamente desde Admin panel, pudiendo crear algo sencillo o algo complejo.
Ej: numero entre 1 y 3 o numero entre 1 y 100.
En caso de que el usuario coloque un numero mayor a X (en el primer ejemplo, 4) habrá desperdiciado su dinero.
Now in english
This Item is basically a system of "winning ticket"in which users enter a number between 1 and X, if it is cast by the PHP, are winners of Y credits
X and Y are configured openly from Admin panel and can create simple or complex.
Eg number between 1 and 3 or number between 1 and 100.
If the user to place a number greater than X (in the first instance, 4) have wasted their money.
(google translate LOL)
Code: [Select]
<?php
/**********************************************************************************
* SMFShop item *
***********************************************************************************
* 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:: loteria.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_Loteria extends itemTemplate
{
function getItemDetails() {
$this->authorName = 'Katzujari';
$this->authorWeb = 'http://www.foro.rphentai.co.cc/';
$this->authorEmail = '';
$this->name = "Loteria";
$this->desc = "Gana xxx Creditos!";
$this->price = 10;
$this->require_input = true;
$this->can_use_item = true;
$this->addInput_editable = true;
}
function getAddInput()
{
global $item_info, $db_prefix;
if ($item_info[1] == 0) $item_info[1] = '3';
if ($item_info[2] == 0) $item_info[2] = '30';
return 'Numero Maximo para sorteo: <input type="text" name="info1" value="' . $item_info[1] . '" /><br />
Premio (cantidad si se gana): <input type="text" name="info2" value="' . $item_info[2] . '" /> ';
}
function getUseInput()
{
global $item_info, $db_prefix;
$num = "<input type='text' name='numuser' value='1'>";
return "Escribe un numero entre 1 y {$item_info[1]}: " .$num;
}
function onUse()
{
global $item_info, $db_prefix, $context;
if ($_POST['numuser'] > $item_info[1])
{
return 'El numero debia ser entre 1 y '.$item_info[1].'. Solo has desperdiciado tu dinero.';
}
else {
$sorteo = mt_rand(1, $item_info[1]);
if ($_POST['numuser'] == $sorteo)
{
$result = db_query("
UPDATE {$db_prefix}members
SET money = money + ".$item_info[2]."
WHERE ID_MEMBER = {$context[user][id]}", __FILE__, __LINE__);
return 'Felicidades! Ganaste ' .$item_info[2];
}
else
{
return 'Mala suerte, el numero correcto era ' .$sorteo;
}
}
}
}
?>
(Review the file to translate texts)