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 - Basil Beard

Pages: 1 [2] 3 4 ... 16
16
General SMFShop Discussion / Re: Where can I get SMFSHOP for my forums?
« on: September 26, 2007, 11:17:19 am »
Yes. SMFSHOP works with the latest release of Smf. It is located here: http://www.dansoftaustralia.net/

Ask daniel why you can't download it from this website.  :buck2:

17
Items / Re: Steal Credits question
« on: September 24, 2007, 07:32:09 am »
It would be very possible.  You just need to select the memberGroup (I think thats what its called) and return before steeling if the target is part of the elementary member group. =)

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] = 40;

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.php. 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
, memberGroup //NOTE THE CHANGE
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);

                        
//NOTE THE CHANGE
                        
if ($row['memberGroup'] == XXNOSTEELGROUPXX) {
                               return 
"Don't steel from the little kids. It isn't nice";
                        }


// 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

{

// If reducing Karma doesn't work, replace

// 'karmaBad = karmaBad + 10' with 'karmaGood = karmaGood - 10'

$result db_query("

UPDATE 
{$db_prefix}members

SET karmaBad = karmaBad + 10

WHERE ID_MEMBER = 
{$ID_MEMBER}"__FILE____LINE__);

   return 'Steal <b>unsuccessful!</b> You Karma is now reduced by 10!';

}

}

}



?>



18
Modifications / Re: SMFPets Version 0.2
« on: September 20, 2007, 10:48:19 am »
If you want a skill to do something, like with items, feel free to ask here and maybe one of us can code up teh skill for you.  O0

19
Modifications / Re: SMFPets Version 0.2
« on: September 17, 2007, 11:51:25 pm »
I am not abandoning the project, I just realize I havn't touched it in a couple of months, realize that I likely won't touch it for a while longer, and wanted to give anyone who wanted to a green light to do more stuff with it. Someone had pmed me to ask if they could upgrade the code, so thats why I was clearing that up here.  O0

20
Modifications / Re: SMFPets Version 0.2
« on: September 17, 2007, 07:31:41 am »
To clear up a question someone asked me, I have no problems if someone wants to pick up this project and add improvements and what not, as long as common sense is used I am properly credited for what I did and you don't actually sell my code.

Quote
OK.. when creating new pets, do I change  the following code lines to something different?  I would think you would have different ones per pet.  And if so which file corresponds with the pet breed?   We tried this on a site and changed the two lines thinking that it should correspond with the type of pet and it errored out.
Code: [Select]
<?php

if (!class_exists('pet_Bunny')) { //Make sure name matches php file

class pet_Bunny extends petTemplate //Make sure name matches php file

function load_breed()

Saw you wanted a pet called "Bunny". Then you would use

Code: [Select]
<?php

if (!class_exists('pet_Bunny')) { //Make sure name matches php file

class pet_Bunny extends petTemplate //Make sure name matches php file

function load_breed()

and call the pet file Bunny.php

If you wanted a pet "Ninja" you would change the above code to
Code: [Select]
<?php

if (!class_exists('pet_Ninja')) { //Make sure name matches php file

class pet_Ninja extends petTemplate //Make sure name matches php file

function load_breed()

and call in Ninja.php.

Basically, it works the same way as it does for items =)

21
Modifications / Re: SMFPets Version 0.2
« on: September 04, 2007, 09:19:36 am »
Use PHP Myadmin or something like that to manually remove the quote from the description or name.

22
Modifications / Re: SMFPets Version 0.2
« on: September 04, 2007, 04:51:04 am »
It has to do with having a single quote in your pets name. That breaks query. Its a bug that I keep meaning to fix/thing I fixed by never actually fixing.

23
Modifications / Re: SMFPets Version 0.2
« on: August 20, 2007, 12:46:25 pm »
Something strange musta been happening. Because they shouldn't age per page view any more than once a day. Has anyone else been having this problem?

24
Modifications / Re: SMFPets Version 0.2
« on: August 14, 2007, 10:23:22 pm »
Sorry I havn't done much here in awhile guys. I have been working on other coding projects. I'll try to find some time to clean up the code and deal with any questions people have sometime soon. Maybe even start doing some more actual work on it, who knows.

Quote
I love this mod.  The younger kids on my site do as well.

I noticed something today though that has me baffled.  The pets should be no more than 20 days old, and sometime between Sunday evening and now, they all miraculously aged to  389 - 391 days.   

Does anyone have any ideas on this?

IIRC, the pets age via a script that calculates the difference between the current date and the last time pets aged. I might have made an error with my date function, or some fluke might have hapened with the php code. I donno. Did they all get really hungry?


25
Requested additions / Re: SMF Store
« on: July 08, 2007, 12:46:43 pm »
I doubt it. SMFShop really isn't designed for actual ecommerence--and even if it was, I doubt it would remain free to use.

26
The hard part would be determining the outcome of what is being betted on. How would you plan on doing this? Would you manually input the results of the bet each time? Seems to me it would be just as easy to do by hand.

27
Items / Re: Free Money Idea
« on: June 24, 2007, 10:04:27 am »
How long has there been an updateMemberData function and why didn't I know about it?

It sure beats those massive database queries XD

28
General SMFShop Discussion / Re: Suggestion
« on: June 24, 2007, 10:03:27 am »
You could add a "disable shop on all boards in this category" button. :-). That would make disabling and enabling alot easier.

29
Items / Re: Item Request: add a word/phrase to the board censor...
« on: June 06, 2007, 01:06:30 am »
Bumping this will not get anyone to accomplish it any faster.

But yeah, coding such an item is possible. I believe SMF simply has a database table of words and their censored versions, so all this item would take would be an insertion into that table. If I had more time, Id do it for you, but I don't. Sorry. 

30
Requested additions / Re: Item Purchase Logs?
« on: June 06, 2007, 01:02:56 am »
Creating a log is pretty easy. Printing it is a little harder, but to create a log just create a db table called

{whatever your db_prefix is}, probably smf_, shop_logs

(so if it is smf_ it would be smf_shop_logs)

the table should have log_id(an int) user_id(an int) item_id(an int) and date(an int)

then find this part of code

Code: [Select]
else

{

mysql_free_result($result);



// Put item in user's inventory

db_query("

INSERT INTO {$db_prefix}shop_inventory

(ownerid, itemid, amtpaid)

VALUES (

{$ID_MEMBER},

{$_GET['id']},

{$row['price']})", __FILE__, __LINE__);



// Decrease user's money

db_query("

UPDATE {$db_prefix}members

SET money = money - {$row['price']}

WHERE ID_MEMBER = {$ID_MEMBER}

LIMIT 1",

__FILE__, __LINE__);



// Decrease stock by 1

db_query("

UPDATE {$db_prefix}shop_items

SET stock = stock - 1

WHERE id = {$_GET['id']}

LIMIT 1", __FILE__, __LINE__);



and add
Code: [Select]
                $date = date('mdHi');
db_query("
INSERT INTO {$db_prefix}shop_logs
     (owner_id, item_id, date)
                        VALUES
                             ({$ID_MEMBER}, {$_GET['id']}, {$date})
", __FILE__, __LINE__);

that should work. You can then access logs through phpmyadmin or write code to accomplish it for you,

Pages: 1 [2] 3 4 ... 16