Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - arcanine

Pages: [1]
1
General SMFShop Discussion / Re: Adding Items
« on: July 14, 2008, 05:36:59 am »
you should find items that pm users and check the php code it uses and
modify a copy of the test item to do the same thing

2
General SMFShop Discussion / pet system
« on: July 14, 2008, 05:34:46 am »
hi there I have a lot of items in my shop that are "monsters"

I want to have three fields in my database: defense, attack, hp

an a option for a member to attack another monster

(both monster's attack values would be inflected on each other minus
the defense value cutting finally into the hp)

when a monster loses all hp I want the item to return to the shop so that
its in stock again


unfortunely I only have a breif understanding of mysql and php
has anyone got any tips on where to start etc

3
General SMFShop Discussion / Re: Taxing Members
« on: July 14, 2008, 05:27:15 am »
hmm I haven't tried this but perhaps adding a minus number into addinterest.php

4
General SMFShop Discussion / Re: Can't Use Steal
« on: July 14, 2008, 04:57:59 am »

5
General SMFShop Discussion / Re: Steal money and Random money bugs?
« on: July 14, 2008, 04:55:04 am »
hi there regarding your first question I don't really know

however I had the same problem with the steal money item
I can't remember where I found the solution it was in the this forum
somewhere but regardless heres a copy of my steal.php
from sources/shop/item
simply open notepad copy this code
into it and save it as
steal.php and upload it to your sources/shop/item dir

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_Steal extends itemTemplate
{
function 
getItemDetails()
{
$this->authorName 'Daniel15';
$this->authorWeb 'http://www.dansoftaustralia.net/';
$this->authorEmail 'dansoft@dansoftaustralia.net';

$this->name 'Steal Credits';
$this->desc 'Try to steal credits from another member!';
$this->price 50;

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

function 
getAddInput()
{
global 
$item_info;
if (
$item_info[1] == 0$item_info[1] = 100;
return 
'For steal, user <b>does NOT need to, and shouldn\'t</b> know the probability! It\'s more fun this way :-)<br />Probability of successful steal: <input type="text" name="info1" value="' $item_info[1]  . '" />%';
}

function 
getUseInput()
{
global 
$context$scripturl$settings$txt;
return 
'Steal From: <input type="text" name="stealfrom" id="membername" size="50" />
<a href="' 
$scripturl '?action=findmember;input=membername;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'] . '" /> Find Member</a><br />';
}

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

// Check some inputs
if (!isset($_POST['stealfrom']) || $_POST['stealfrom'] == '') die('ERROR: Please enter a username to steal from!');

// 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(0100);

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

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

// If user doesn't exist
if (mysql_num_rows($result) == 0)
die(
'ERROR: The specified user doesn\'t exist!');

$row mysql_fetch_assoc($result);

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

// Take this money away from stealee...
$result db_query("
UPDATE 
{$db_prefix}members
SET money = money - 
{$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 
'Steal successful, although you only stole ' $steal_amount '!';
else
return 
'Successfully stole ' $steal_amount ' from ' $user '! It\'s their fault they don\'t have their money in the bank!';
}
else
{return 
'Steal unsuccessful please try again';}
}
}

?>



In theory that should give you a working steal item 

6
Requested additions / Re: Buying an item more than once at a time.
« on: May 19, 2008, 04:03:02 am »
Yeah I have a similar feature, can someone at least post some sort of place to get started to code this myself

7
Items / destory inventory item
« on: May 06, 2008, 04:20:29 am »
Hello there I've been running your smf shop script over at http://dinogod.com
for a while now, I have a shop full of "pokemon" which are test items which then are on display in signatures but I figured as a user how would someone get rid of the pokemon so I decided to try and make an item that would "kill" them all without admin help

Now I claim no knowledge of php at all but I tried to merge two snippets together to get what I wanted before I go ahead and test it I wanted to know
if someone could just check that I wouldn't be deleting my database by using this item or if there are any obvious security problems with this item or if it would work at all lol

thanks  :P

Code: [Select]
#
<?php
#
/**********************************************\
#
| SMFSHOP (Shop MOD for Simple Machines Forum) |
#
| (c) 2007 DanSoft Australia |
#
| http://www.dansoftaustralia.net/ |
#
\**********************************************/
#
 
#
//File: DisplayMessage.php
#
// Item - Display a message when used
#
 
#
// VERSION: Not included in SMFShop yet
#
 
#
class item_DisplayMessage extends itemTemplate {
#
function getItemDetails() {
#
$this->authorName "Daniel15";
#
$this->authorWeb "http://www.dansoftaustralia.net/";
#
$this->authorEmail "dansoft@dansoftaustralia.net";
#
 
#
$this->name "Poison";
#
$this->desc "Destories all items and pokemon";
#
$this->price 20;
#
#
$this->require_input false;
#
$this->can_use_item true;
#
}
#

#
 
#
function onUse() {
$result db_query("DELETE FROM {$db_prefix}shop_inventory
WHERE ownerid = 
{$ID_MEMBER}",
__FILE____LINE__);
return 
"Inventory destroyed";
}
#
 
#
}
#
 
#
?>

Pages: [1]