Jump to content

Help with finishing a code


Daisuke_aurora

Recommended Posts

Ok. I run a forun where members can RP using a stat system (the custom profile field mod). Basically, members have a set atk power, def power, etc, displayed by the CP field mod. I recently took the Add to post count item and tweaked it to add to the CP fields, and got this:

 

<?php

/**********************************************************************************

* SMFShop item                                                                    *

***********************************************************************************

* SMFShop: Shop MOD for Simple Machines Forum                                    *

* =============================================================================== *

* Software Version:          SMFShop 3.0 (Build 12)                              *

* $Date:: 2008-08-18 14:30:00 +1100 (Mon, 18 Aug 2008)                          $ *

* $Id:: IncreaseHP.php 79 2008-08-18 12:30:00Z Daisuke_aurora                  $ *

* Software by:                Daisuke (http://www.daisukesdojo.heliohost.org/)    *

* Copyright 2005-2007 by:    Daisuke (http://www.daisukesdojo.heliohost.org/)    *

* Support, News, Updates at:  http://www.daisukesdojop.heliohost.org/            *

*                                                                                *

* 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_IncreaseHP extends itemTemplate

{

function getItemDetails()

{

$this->authorName = 'Daisuke';

$this->authorWeb = 'http://www.daisukesdojo.heliohost.org/';

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

 

$this->name = 'Increase HP by xxx';

$this->desc = 'Increase your HP by xxx';

$this->price = 1000;

 

$this->require_input = false;

$this->can_use_item = true;

$this->addInput_editable = true;

}

 

// See 'AddToPostCount.php' for info on how this works

function getAddInput()

{

global $user_info;

if ($item_info[1] == 0) $item_info[1] = 10;

return 'Amount to increase HP by: <input type="text" name="info1" value="' . $item_info[1] . '" />';

}

 

function onUse()

{

global $db_prefix, $ID_MEMBER, $item_info;

 

db_query("

UPDATE {$db_prefix}themes

SET value = value + {$item_info[1]}

WHERE ID_MEMBER = {$ID_MEMBER}", __FILE__, __LINE__);

return 'Successfully increased your HP by ' . $item_info[1] . '!';

}

 

}

 

?>

 

However, there is one problem: The item cannot tell the difference between the 8 CP fields, so it increases ALL of them by 10, not just one. Can anyone tell me how to make it target only one of these fields?

Link to comment
https://forums.phpfreaks.com/topic/120248-help-with-finishing-a-code/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.