SMF Shop

SMFShop => Items => Topic started by: Production on May 13, 2008, 08:26:49 am

Title: [New Item] Steal Bank (Spanish)
Post by: Production on May 13, 2008, 08:26:49 am
Basado en el Steal.php aquí tienen el Roba bancos creado por mi, pero sin el error que tiene el Steal en varios foros.

El archivo lo deben llamar RobaBanco.php para que les funcione.

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:: Steal.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_RobaBanco extends itemTemplate
{
function getItemDetails()
{
$this->authorName 'Hermalon';
$this->authorWeb 'http://www.solotrades.com/';
$this->authorEmail 'hermalon@hotmail.com';

$this->name 'Roba Banco';
$this->desc 'Trata de robar cr&eacute;ditos del banco a un usuario!';
$this->price 100;

$this->require_input true;
$this->can_use_item true;
}

function getAddInput()
{
global $item_info;
if ($item_info[1] == 0$item_info[1] = 40;
return 'Para un buen robo, el usuario <b>NO necesita y NO debe</b> saber las probabilidades de este! Esa es la forma mas divertidad :-)<br />Probabilidad de un  robo éxitoso: <input type="text" name="info1" value="' $item_info[1]  . '" />%';
}

function getUseInput()
{
global $context$scripturl$settings$txt;
return 'Robar cr&eacute;ditos de: <input type="text" name="stealfrom" size="50" />
<a href="' 
$scripturl '?action=findmember;input=stealfrom;quote=0;sesc=' $context['session_id'] . '" onclick="return reqWin(this.href, 350, 400);"><img src="' $settings['images_url'] . '/icons/assist.gif" border="0" alt="' $txt['find_members'] . '" /> Buscar usuario</a><br />';
}

function onUse()
{
global $db_prefix$ID_MEMBER$item_info;

// Check some inputs
if (!isset($_POST['stealfrom']) || $_POST['stealfrom'] == '') die('ERROR: Por favor entre el nombre al que desea robarle!');

// This code from PersonalMessage.php5. It trims the " characters off the membername posted, 
// and then puts all names into an array
$_POST['stealfrom'] = strtr($_POST['stealfrom'], array('\\"' => '"'));
preg_match_all('~"([^"]+)"~'$_POST['stealfrom'], $matches);
$userArray array_unique(array_merge($matches[1], explode(','preg_replace('~"([^"]+)"~'''$_POST['stealfrom']))));

// We only want the first memberName found
$user $userArray[0];

// Get a random number between 0 and 100
$try mt_rand(1100);

// If successful
if ($try $item_info[1])
{

// Get stealee's (person we're stealing from) money count
$result db_query("
SELECT moneyBank
FROM 
{$db_prefix}members
WHERE memberName = '
{$user}'"__FILE____LINE__);

// If user doesn't exist
if (mysql_num_rows($result) == 0)
die('ERROR: El usuario especificado no existe!');

$row mysql_fetch_assoc($result);

// Get random amount between 0 and amount of money stealee has
$steal_amount mt_rand(1$row['moneyBank']);

// Take this money away from stealee...
$result db_query("
UPDATE 
{$db_prefix}members
SET moneyBank = moneyBank - 
{$steal_amount}
WHERE memberName = '
{$user}'
LIMIT 1"
__FILE____LINE__);
//...and give to stealer (robber)
$result db_query("
UPDATE 
{$db_prefix}members
SET money = money + 
{$steal_amount}
WHERE ID_MEMBER = 
{$ID_MEMBER}
LIMIT 1"
__FILE____LINE__);

if ($steal_amount 50)
return 'usted le ha robado exisotansamente al usuario ' $user ', pero le falta un poco mas de practica, ya que solo robo ' $steal_amount ' creditos.!';
else
return 'Usted le acaba de robar ' $steal_amount ' cr&eacute;ditos al usuario ' $user '<br>¡Usted es un profesional robando bancos!';
}
else
{
// If reducing Karma doesn't work, replace
// 'karmaBad = karmaBad + 10' with 'karmaGood = karmaGood - 10'
$result db_query("
UPDATE 
{$db_prefix}members
SET karmaBad = karmaBad + 4
WHERE ID_MEMBER = 
{$ID_MEMBER}"__FILE____LINE__);
   return 'Usted <b>fracas&oacute;</b> en su intento de robo al banco. Ahora sus calificaciones positivas seran reducidas hasta que Hermalon las borre generalmente.';
}
}
}

?>


Se aceptan +

 Fuente Solotrades  (http://mix.solotrades.com/?ref=344)

Saludos.