News:

Wondering if this will always be free?  See why free is better.

Main Menu

ST Shop

Started by Diego Andrés, June 13, 2009, 06:06:35 AM

Previous topic - Next topic

SA™

Steal Credits is included in this shop so thats already been updated just compare that with the one you linked to to compare the chnages i made these chanes to that item them remberd it comes with the shop :D so here it is

class item_Steal extends itemTemplate
{
function getItemDetails()
{
$this->authorName = 'Daniel15';
$this->authorWeb = 'http://www.dansoftaustralia.net/';
$this->authorEmail = '[email protected]';

$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, $smcFunc, $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(0, 100);

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

// Get stealee's (person we're stealing from) money count
$result = $result = $smcFunc['db_query']('',"
SELECT cash
FROM {db_prefix}members
WHERE member_name = {string:name}",
    array(
        'name' => $user,
    )
);

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

$row = $smcFunc['db_fetch_assoc']($result);

// Get random amount between 0 and amount of money stealee has
$steal_amount = mt_rand(0, $row['money']);
           
$final_value1 = $cash - $steal_amount;
            updateMemberData($context['stealee'], array('cash' => $final_value1));

             //...and give to stealer (robber)
            $final_value1 = $user_info['cash'] + $steal_amount;
            updateMemberData($context['user']['id'], array('cash' => $final_value1));

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!';
}
}
}

?>
http://samods.github.io/SAChatBar/

Xbox Live: smokerthecheese 360 or xbone
My Work
Piano Movers / Delivery service
QuoteMy allies are dead.
I'm 'bout to be too.
Zombies are chasing me.
F*** it, I'm screwed -___-

olivestab

Thank you very much!
amazing freaking work dude.

hcfwesker

Quote from: olivestab on September 09, 2012, 12:28:01 PMAdd to member group (admin creates item of a specific group, member becomes part of the group when purchasing item, Is not primary)

I posted the zip for the SA shop version of this on the previous page. ;)   That's all I have, though.

http://www.simplemachines.org/community/index.php?topic=317308.msg3396139#msg3396139

olivestab

Ok, Turns out I need a little help here.
I tried modifying the "Steal Credits" item by simply changing it to an "Attack User" Item.

My goal was to take the "Steal Credits" and do the following 2 changes:
1.Change the Message text from: "Choose A User to Steal From/ Steal/ Stole/ etc
And change them all to: Choose user to attack, Successful Attack.
So far there are no Code changes.

2. Simply increase the amount of possible stolen credits, (To around 1000-2000)
Decrease the amount of karma from "Attacking(or Stealing)" to 1 instead of 10. 

problems:
First off, code shows up on the shop and works just fine, (its nearly a strait copy of Steal Credits, with no change to code, just display messages and increased number amounts)
but when I use the item, it only says that My karma is decreased by 1, and shows no indication of a successful attack, even thought I set the % to 100.

Here is the code:
<?php
/**********************************************************************************
* SMFShop item *
***********************************************************************************
* SMFShop: Shop MOD for Simple Machines Forum *
* =============================================================================== *
* Software Version: SMFShop 3.0 (Build 12) *
* $Date:: 2007-08-04 11:56:24 +0200 (za, 04 aug 2007) $ *
* $Id:: Steal.php 125 2007-08-04 09:56:24Z 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 '[email protected]';

$this->name 'Attack two';
$this->desc 'Attack other members to gain their credits!';
$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] = 40;
return 
'For steal, user does NOT need to, and shouldn\'t know the probability! It\'s more fun this way :-)
Probability of successful steal: 100%'
;
}

function 
getUseInput()
{
global 
$context$scripturl$settings$txt;
return 
'Steal From:  <input type="text" name="stealfrom" size="50" />
<a href="' 
$scripturl '?action=findmember;input=username;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$context$user_info$item_info$smcFunc;

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

// 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 $smcFunc['db_query']('''
SELECT cash 
FROM {db_prefix}members 
WHERE real_name = {string:name}'

array( 
'name' => $user

);

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

$row $smcFunc['db_fetch_assoc']($result);

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

// Take this money away from stealee...
$result $smcFunc['db_query']('''
SELECT id_member
FROM {db_prefix}members
WHERE real_name = {string:name} 
ORDER BY id_member DESC
LIMIT 1'
,
array(
'name' => $user,

)
);
$row $smcFunc['db_fetch_assoc']($result);
$stealee $row['id_member'];
$smcFunc['db_free_result']($result);

$context['stealee'] = $stealee;

$result $smcFunc['db_query']('''
SELECT cash
FROM {db_prefix}members
WHERE real_name = {string:name} 
ORDER BY id_member DESC
LIMIT 1'
,
array(
'name' => $user,

)
);
$row $smcFunc['db_fetch_assoc']($result);
$cash $row['cash'];
$smcFunc['db_free_result']($result);

$context['cash'] = $cash;

$final_value1 $cash $steal_amount;
updateMemberData($context['stealee'], array('cash' => $final_value1));

//...and give to stealer (robber)
$final_value1 $user_info['cash'] + $steal_amount;
updateMemberData($context['user']['id'], array('cash' => $final_value1));


if (
$steal_amount 50)
return 
'Attack successful, although you only gained ' $steal_amount '!';
else
return 
'Successfully Gained ' $steal_amount ' from attacking ' $user '! It\'s their fault they don\'t have their dp in the bank!';
}
else
{
// If reducing Karma doesn't work, replace
// 'karma_bad = karma_bad + 10' with 'karma_good = karma_good - 10'
$smcFunc['db_query']('','UPDATE {db_prefix}members
SET 
karma_good = karma_good - 1
WHERE id_member = {string:name} '
,
array(
'name' => $context['user']['id'],
)
);
//updateMemberData($context['user']['id'], array('karma_bad' => (int) 10));

return 'Attacking will affect heroism! Your heroism is now reduced by 1!';
}
}
}

?>

I want to:
-Increase the amount of credits a person can gain to: 1000-2000
-Change the probability of attack to 100%
-Display my new attack themed messages instead of the steal themed messages.
I tried to modify it to the best of my knowledge, but It's only decreasing my heroism, and not attacking.


Also, (not a big problem cause there is a work around)
If I manually add a new php file to the item folder in sources, the "add Item" Admin menu seems to crash and display a white screen until I take it off.
The only work around Is to delete the original "steal.php", Upload the new Code i modified, but change the actual file name to any of the default item names within the database.     

olivestab

Also, If I can get this small code to work properly,
I basiclly want to duplicate it a few times, but make each new duplicate steal a greater amount of creadits,

Because I will display .gifs of guns, and bigger guns will be more expensive, and deal more damage. (steal more creadits.)
Here is a screen shot so far using the code above:
Editing details


View in store:


View in Inventory:


View when Using item: (still need to modify some text, I missed some of them)


View after use: (This is the message that displays after every attempt, even though an attack should be 100%
It seems that the only thing I did right was the change of 10 decreased karma to one! lol )

olivestab

Quote from: SA™ on September 09, 2012, 01:00:36 PM
Steal Credits is included in this shop so thats already been updated just compare that with the one you linked to to compare the chnages i made these chanes to that item them remberd it comes with the shop :D so here it is

class item_Steal extends itemTemplate
{
function getItemDetails()
{
$this->authorName = 'Daniel15';
$this->authorWeb = 'http://www.dansoftaustralia.net/';
$this->authorEmail = '[email protected]';

$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, $smcFunc, $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(0, 100);

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

// Get stealee's (person we're stealing from) money count
$result = $result = $smcFunc['db_query']('',"
SELECT cash
FROM {db_prefix}members
WHERE member_name = {string:name}",
    array(
        'name' => $user,
    )
);

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

$row = $smcFunc['db_fetch_assoc']($result);

// Get random amount between 0 and amount of money stealee has
$steal_amount = mt_rand(0, $row['money']);
           
$final_value1 = $cash - $steal_amount;
            updateMemberData($context['stealee'], array('cash' => $final_value1));

             //...and give to stealer (robber)
            $final_value1 = $user_info['cash'] + $steal_amount;
            updateMemberData($context['user']['id'], array('cash' => $final_value1));

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!';
}
}
}

?>

I decided to paste this code back In the file to restart my idea from scratch, But I decided to test it first to see how it works,
Everything works fine accept for when you try to steal from someone.
It comes out as a successful steal, but it says "although you only stole 0"
Suddenly everyone's credits on the entire forum went back down to 0!

Idk whats up but that code aparently resets everyone to 0 when you try to steal.
The modified code I changed does not reset it, but It will not execute a successful attack,
Im kinda stuck and would really appreciate any help if someone has the time.

SA™

$context['stealee'] is not defined so that could be the issue

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, $smcFunc, $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(0, 100);

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

$result = $smcFunc['db_query']('', '
                SELECT id_member
                FROM {db_prefix}members
                WHERE real_name = {string:name}
                ORDER BY id_member DESC
                LIMIT 1',
                array(
                   'name' => $user,

                )
            );
            $row = $smcFunc['db_fetch_assoc']($result);
            $stealee = $row['id_member'];
            $smcFunc['db_free_result']($result);

// Get stealee's (person we're stealing from) money count
$result = $result = $smcFunc['db_query']('',"
SELECT cash
FROM {db_prefix}members
WHERE member_name = {string:name}",
    array(
        'name' => $user,
    )
);

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

$row = $smcFunc['db_fetch_assoc']($result);

// Get random amount between 0 and amount of money stealee has
$steal_amount = mt_rand(0, $row['money']);
           
$final_value1 = $cash - $steal_amount;
            updateMemberData($stealee, array('cash' => $final_value1));

             //...and give to stealer (robber)
            $final_value1 = $user_info['cash'] + $steal_amount;
            updateMemberData($context['user']['id'], array('cash' => $final_value1));

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!';
}
}
}


untested code?
http://samods.github.io/SAChatBar/

Xbox Live: smokerthecheese 360 or xbone
My Work
Piano Movers / Delivery service
QuoteMy allies are dead.
I'm 'bout to be too.
Zombies are chasing me.
F*** it, I'm screwed -___-

xanenightwing

sorry if this question has already been asked, but is there an "email admin" item? and if not, would it be possible to make one?

Kendrall

So far I'm digging this mod!   8)  While waiting for Diego or SA to look over the lottery script that I referenced the last time I posted in this support thread, I've been asked by several of my users on how the Trade Center works.  Would I upload the items to ./Sources/shop/items as usual, set the price for each of them, and then assign them to the individual user for them to "sell"?  Or is it a different process?

hcfwesker

Quote from: Kendrall on September 28, 2012, 09:36:43 AMhow the Trade Center works.  Would I upload the items to ./Sources/shop/items as usual, set the price for each of them, and then assign them to the individual user for them to "sell"?  Or is it a different process?

Doin't use it.  Unless it's been fixed since about a year ago.  has a bug where i member can put an item in there, buy it back themself, and egt the item and double there money.

all trade center is for, is for members to sell items they dont want anymore.

Kendrall

Quote from: hcfwesker on September 28, 2012, 05:47:03 PM
Quote from: Kendrall on September 28, 2012, 09:36:43 AMhow the Trade Center works.  Would I upload the items to ./Sources/shop/items as usual, set the price for each of them, and then assign them to the individual user for them to "sell"?  Or is it a different process?

Doin't use it.  Unless it's been fixed since about a year ago.  has a bug where i member can put an item in there, buy it back themself, and egt the item and double there money.

all trade center is for, is for members to sell items they dont want anymore.

So while it sounds like I may have to settle for creating a sub-forum for a virtual marketplace, you've managed to pique my interest.  Which could be very, very good...or very, very bad.   ;)

I was digging through the various source files for the shop, and I'm pretty sure this snippet is what you were referring to?  Found it in ./Shop2/shop.php.


function Shop_trade()
{
global  $user_info, $id_member, $row, $item_info, $txt, $sourcedir, $scripturl, $context, $smcFunc;
if ($_REQUEST['sa'] == 'trade')
{
// Do we have permission to veiw?
      isAllowedTo('view_trade');
 
$context['shop_trade_items'] = array();
$alternating = 'windowbg2';
//TODO add the database stuff to shop_db.php
// Get all the items in the trade centre
$result = $smcFunc['db_query']('', '
SELECT it.name, it.description, it.image, inv.itemid, m.real_name, inv.tradecost
FROM {db_prefix}shop_property AS inv
INNER JOIN {db_prefix}shop_item AS it ON (it.itemid = inv.itemid)
INNER JOIN {db_prefix}members AS m ON (m.id_member = inv.userid)
WHERE inv.trading = 1 ', array());
// Loop through all items
while ($row = $smcFunc['db_fetch_assoc']($result))
$context['shop_trade_items'][] = array(
'id' => $row['itemid'],
'name' => $row['name'],
'desc' => $row['description'],
'image' => $row['image'],
'realName' => $row['real_name'],
'tradecost' => $row['tradecost'],
);
$smcFunc['db_free_result']($result);

// Set the page title
$context['page_title'] = $txt['shop_trade'];
// Use the trade centre sub template
$context['sub_template'] = 'userTrade';
loadTemplate('Shop');

}
// If they're buying an item from the trade centre
elseif ($_REQUEST['sa'] == 'trade_buy')
{

// Make sure item ID was numeric
$_GET['id'] = (int) $_GET['id'];
//TODO add the database stuff to shop_db.php
// Get information on the item in question
$result = $smcFunc['db_query']('', '
SELECT
it.name,
inv.tradecost, inv.trading, inv.userid,
m.real_name, m.email_address, m.cash, m.tradeHis
FROM {db_prefix}shop_property AS inv
INNER JOIN {db_prefix}shop_item AS it ON (inv.itemid = it.itemid)
INNER JOIN {db_prefix}members AS m ON (inv.userid = m.id_member)
WHERE inv.itemid = {int:id}
LIMIT 1',
array(
'id' => $_GET['id'],
));

$row = $smcFunc['db_fetch_assoc']($result);
$smcFunc['db_free_result']($result);
$userid = $context['user']['id'];
// If this item is not for trade
if ($row['trading'] != 1)
$context['shop_buy_message'] = $txt['shop_no_sale'];
// If they can't afford it
elseif (shop_Cash($userid) < $row['tradecost'])
$context['shop_buy_message'] = sprintf($txt['shop_not_enough_money'], $cost - shop_Cash($userid));
// All's well, they can get this itel
else
{
//TODO add the database stuff to shop_db.php
// Change item info (owner, amount paid, trading = not anymore)
$smcFunc['db_query']('', '
UPDATE {db_prefix}shop_property
SET userid = {int:userid}, amtpaid = {float:tradecost},
trading = 0
WHERE itemid = {int:id}
LIMIT 1',
array(
'userid' => $context['user']['id'],
'tradecost' => $row['tradecost'],
'id' => $_GET['id'],
));
// Decrease user's money
$final_value = $row['tradecost'] - $row['cash'];
        updateMemberData($context['user']['id'], array('cash' => $final_value));

   //Update the member trade count
   $final_value = $row['tradeHis'] + 1;
       updateMemberData($context['user']['id'], array('tradeHis' => $final_value));

   // Give money to old owner
   $final_value1 =  $row['tradecost'] + $row['cash'];
       updateMemberData($row['userid'], array('cash' => $final_value1));

sendpm_trade();

$context['shop_buy_message'] = sprintf($txt['shop_trade_bought_item'], $row['name'], $row['real_name']);
}

// Set the page title
$context['page_title'] = $txt['shop_trade'];
// Use the message template
$context['sub_template'] = 'message';
}
// If they're selling an item in the trade centre
elseif ($_REQUEST['sa'] == 'trade_sell')
{

// Make sure ID was numeric
$_GET['item'] = (int) $_GET['item'];
//TODO add the database stuff to shop_db.php
// Get information on the item
$result = $smcFunc['db_query']('', '
SELECT amtpaid
FROM {db_prefix}shop_property
WHERE id = {int:id}',
array(
'id' => $_GET['item'],
));
$row = $smcFunc['db_fetch_assoc']($result);
$smcFunc['db_free_result']($result);

// The amount paid for the item
$context['shop_paid'] = $row['amtpaid'];
// Set the page title
$context['page_title'] = $txt['shop_yourinv'];
// Use the trade item sub template
$context['sub_template'] = 'tradeItem';
}
// Sell an item - Part 2. Actually add the item to the trade centre
elseif ($_REQUEST['sa'] == 'trade_sell2')
{

// Make sure certain values were numeric
$_POST['id'] = (int) $_POST['id'];
$_POST['sellfor'] = (int) $_POST['sellfor'];
//TODO add the database stuff to shop_db.php
// Check the owner of the item
$result = $smcFunc['db_query']('', '
SELECT userid
FROM {db_prefix}shop_property
WHERE id = {int:id}
LIMIT 1',
array(
'id' => $_POST['id'],
));

$row = $smcFunc['db_fetch_assoc']($result);
$smcFunc['db_free_result']($result);

// Sell it for a negative amount? That very odd...
if ($_POST['sellfor'] <= 0)
$context['shop_buy_message'] = $txt['shop_trade_negative'];
// Sorry, stealing is illegal :P
elseif ($row['userid'] !== $context['user']['id'])
$context['shop_buy_message'] = $txt['shop_use_others_item'];
else {
//TODO add the database stuff to shop_db.php
// Update item's information
$result = $smcFunc['db_query']('', '
UPDATE {db_prefix}shop_property
SET trading = 1,
tradecost = {float:tradecost}
WHERE id = {int:id}
LIMIT 1',
array(
'tradecost' => $_POST['sellfor'],
'id' => $_POST['id'],
));
$context['shop_buy_message'] = $txt['shop_trade_success'];
}
// Set the page title
$context['page_title'] = $txt['shop_yourinv'];
// Use the message template
$context['sub_template'] = 'message';

}
// Stop trading an item
elseif ($_REQUEST['sa'] == "trade_stop")
{

// Make sure ID was numeric
$_GET['item'] = (int) $_GET['item'];
//TODO add the database stuff to shop_db.php
// Get the ownerID of the item
$result = $smcFunc['db_query']('', '
SELECT userid
FROM {db_prefix}shop_property
WHERE id = {int:id}
LIMIT 1',
array(
'id' => $_GET['item'],
));

$row = $smcFunc['db_fetch_assoc']($result);
$smcFunc['db_free_result']($result);

// Sorry, stealing isn't allowed here!
if ($row['userid'] !== $context['user']['id'])
$context['shop_buy_message'] = $txt['shop_use_others_item'];
else {
//TODO add the database stuff to shop_db.php
// Cancel the trade centre stuff
$result = $smcFunc['db_query']('', '
UPDATE {db_prefix}shop_property
SET trading = 0, tradecost = 0
WHERE id = {int:id}
LIMIT 1',
array(
'id' => $_GET['item'],
));
// Tell the user what we did
$context['shop_buy_message'] = $txt['shop_trade_cancelled'];
}

// Set the page title
$context['page_title'] = $txt['shop_yourinv'];
// Use the message template
$context['sub_template'] = 'message';
}  

// Add it to the linktree
$context['linktree'][] = array(
'url' => $scripturl . '?action=shop;sa=trade',
'name' => $txt['shop_tab_trade'],


If I've referenced the correct script, which part(s) need to be corrected in order to keep someone from buying back his or her own item from the trade center?

FireDitto

Hi!

I have members receiving 1% interest on their banked funds. However, I would like to edit it slightly so:

Member HAS logged in that day: Receives 1% interest on banked funds
Member has NOT logged in that day: Receives 1% tax on banked funds.

Is anyone able to help me with this?

Thanks =)
Second Pass Weyr<br />An AU Pernse RPG<br /><br />SMF 2.0.6 with SP 2.3.5

FireDitto

Additionally, I'd like to make it so that the reward for characters/words only kicks in after a determined number has been reached.

Eg, after 500 words, you get 1 point for every additional word or something similar, rather than getting a reward for the first 500 words and cutting off there after.

Would this be possible?
Second Pass Weyr<br />An AU Pernse RPG<br /><br />SMF 2.0.6 with SP 2.3.5

elf_fu

#393
This installed perfectly on a new board of mine! I was given no errors what-so-ever. However, I am unable to deposit credits into the bank, and I cannot purchase items despite having credits on hand.

Currently I have 2454 credits on hand, and am unable to make any monetary deposit into the bank. I also cannot purchase any items from the shop. I double-checked permissions for all other groups other than admin (as admin immediately has all permissions and I am an admin) and all have permission to purchase and use.

So I am stumped as to how to go about trying to fix this. Any ideas? Thanks!

I am using SMF 2.0.2, with the Bluez theme, with these mods installed: Tags, Simple Portal, Simple Audio Video Embedder, SMF Gallery Lite, Bookmarks, PM to New Members, Event Reminder Mod for SMF2, SMF Packs shoutbox, Seperate the Sticky topics, and add social media icons to profiles.

GR

xanenightwing

Quote from: xanenightwing on September 24, 2012, 04:11:38 PM
sorry if this question has already been asked, but is there an "email admin" item? and if not, would it be possible to make one?

Bumping my question >.>

FireDitto

Is it possible to have items in the store be a once only use, but not get deleted from the inventory once used?

Maybe sorted into "used" and "usable" but not actually removed?

Thanks!
Second Pass Weyr<br />An AU Pernse RPG<br /><br />SMF 2.0.6 with SP 2.3.5

N i g h t m a r e

Is there anyway i can change the name of "Credits" to "Paypal Dollars"
and take away the ability to get credits
but have the user upload real money through paypal and order products?

Diego Andrés

Quote from: -♦-Zeum-♦- on October 13, 2012, 02:42:56 PM
Is there anyway i can change the name of "Credits" to "Paypal Dollars"
and take away the ability to get credits
but have the user upload real money through paypal and order products?

Don't try to find things that really this mod can't do
Try using this board http://www.simplemachines.org/community/index.php?board=79.0

SMF Tricks - Free & Premium Responsive Themes for SMF.

Mr E S Stranger

Hi, thanks for the mod. I've been trying out this one and the SMFShop mod. I like that this one has a game room already attached. Everything seems to be working very well.

The only issue, thus far, that I have found is none of the images are visible.

I'm running 2.0.2.

Any ideas?

Thanks a bunch!

Kendrall

Quote from: Mr E S Stranger on December 06, 2012, 10:33:10 AM
Hi, thanks for the mod. I've been trying out this one and the SMFShop mod. I like that this one has a game room already attached. Everything seems to be working very well.

The only issue, thus far, that I have found is none of the images are visible.

I'm running 2.0.2.

Any ideas?

Thanks a bunch!

Where do you have your images stored on your server (full file path)?  Also, do you have the proper permissions set?

Advertisement: