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.


Topics - inkstains

Pages: [1]
1
Items / Change Balances
« on: October 12, 2007, 09:45:06 am »
just an item to change the balances of Bank and Pocket either individually or together. saves going through mysql, which can be a little daunting for some.


save as ChangeBal.php and place inside your SMFShop's items folder and install as you would an ordinary item just making sure to set stock to zero so no one can purchase it. and then just give yourself the item through admin.


ChangeBal.php

Code: [Select]
<?php
if (!defined('SMF'))
die('Hacking attempt...');

class 
item_ChangeBal extends itemTemplate {
    function 
getItemDetails() {
    
    $this->authorName 'inkstains';
$this->authorWeb 'http://www.daniel15.com/forum/index.php';
$this->authorEmail '';
    
        
$this->name "Change Balance";
        
$this->desc "Change the balances of Bank and Pocket";
        
$this->price 10;
        
$this->require_input true;
$this->can_use_item true;
    }

function getUseInput() {

global $context$scripturl$settings$txt;
return '<br />Change Money Bank: &nbsp;&nbsp;<select name="resetB" size="1" id="resetB">
        <option value="0">No</option>
<option value="1">Yes</option>
  </select>
   Change Money Bank Value: &nbsp;&nbsp;<input type="text" name="info1" value="40" /><br />
<br />Change Money Pocket: <select name="resetP" size="1" id="resetP">
        <option value="0">No</option>
<option value="1">Yes</option>
  </select>
   Change Money Pocket Value: <input type="text" name="info2" value="40" /><br />
  '
;

    }


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

       
if ($_POST['resetB'] && $_POST['resetP'] == 1
{
db_query("UPDATE {$db_prefix}members
  SET moneyBank = 
{$_POST['info1']}
  "
__FILE____LINE__);
  
db_query("UPDATE {$db_prefix}members
  SET money = 
{$_POST['info2']}
  "
__FILE____LINE__);
  
        return 
"Money Bank and Money Pocket has been set to {$_POST['info1']} and {$_POST['info2']} respectively";
        
        die(
"dead");
}

elseif ($_POST['resetB'] == && $_POST['resetP'] == 0
{
db_query("UPDATE {$db_prefix}members
  SET moneyBank = 
{$_POST['info1']}"__FILE____LINE__);
        return 
"Money Bank has been reset {$_POST['info1']}";
        
        die(
"dead");
}

elseif ($_POST['resetB'] == && $_POST['resetP'] == 1
{
db_query("UPDATE {$db_prefix}members
  SET money = 
{$_POST['info2']}"__FILE____LINE__);
        return 
"Money Pocket has been reset {$_POST['info2']}";
        
        die(
"dead");
}

else
{

return "Please make sure you fill in all options";

}

    }

}

?>

2
Modifications / SMFShop Stats Modification
« on: September 25, 2007, 04:52:27 pm »
THIS HAS ONLY BEEN TESTED ON A CLEAN INSTALL OF SMF 1.1.3  AND SMFShop 3.0

WARNING IF YOU INSTALL THIS MOD AND EVER GO TO REMOVE/UPGRADE YOUR INSTALL OF SMFShop YOU MAY ENCOUNTER ERRORS IF THIS MOD IS NOT UNINSTALLED FIRST. YOU'VE BEEN WARNED

This mod will add a few more stats to the SMFShop home section (Top Purchasers and Top Traders) as well as a persistent Recently Purchased section which if you mouseover the images will display a tooltip with the items description

enjoy  :)

SMFShop Home




PACKAGE UPDATED 28/09/07

3
Modifications / SMFShop Inventory Post Modification
« on: September 10, 2007, 03:37:10 pm »
THIS HAS ONLY BEEN TESTED ON A CLEAN INSTALL OF SMF 1.1.3 AND SMFShop 3.0

WARNING IF YOU INSTALL THIS MOD AND EVER GO TO REMOVE/UPGRADE YOUR INSTALL OF SMFShop YOU MAY ENCOUNTER ERRORS IF THIS MOD IS NOT UNINSTALLED FIRST. YOU'VE BEEN WARNED


IF YOU ARE USING AN EARLIER VERSION PLEASE UNINSTALL AND INSTALL THIS NEW VERSION

Updated and rolled into one package, from admin you can now select whether to enable/disable the IPM (on disable all original postbit settings will be restored) select where you would like the IPM displayed, Signature or Postbit, as well as selecting how many items you would like displayed.

Because this is a work in progress and as much a learning process for myself as modification project I'm going to just keep updating as it develops. but if you do decide to use this on a forum please be sure to check back for any updates, as i'm sure as time goes on i will realise things could have been done differently and better.

Goals for the next build

Introduce an inventory display sorting system to allow for a wider range of conditions (price, category etc)

Finally add the split and display trade items as well and expand on the current tooltips

Expand the admin section

And possibly something to do with members profile page depends




Special Note: Thank you to feeble for helping with the while loop i feel stupid now haha Daniel for telling me about seperating operations and visual output and Basil Beard for giving me a kick in the right direction when i thought **** this **** **** *** of a mod. cheers fellas. now that emmy esque speech is over with onto the pics


Signature


Postbit


Admin





 >:D

4
Coding / Display name CSS item - never mind
« on: July 11, 2007, 11:41:51 pm »
i've done a search on the board but can't find this answered

how do i get the css item to not show name colours anywhere but in actual threads? i'd rather not have all the colours over the boards etc.

cheers for any help

EDIT: got this all sorted just had to remove the edits from Boardindex.php and MessageIndex.php

5
Coding / [SOLVED] may be a simple question
« on: March 25, 2007, 12:15:18 am »
just wondering where you get all the smf references from ummm like say to access the time logged on is there a listing of where those things are in the smf database? i've had a quick squizz on the smf board but couldn't find anything.

6
Items / Prediction - Guessing Item
« on: March 24, 2007, 02:52:10 pm »
Basically a user picks what they think they will roll with a six sided dice (giving them a 1 in 6 chance so i'd keep the price low but your choice) and if they are correct they receive a random amount of credits (which you can set when you do item setup) below is the code just save it as Prediction.php


New dice roll animations

Example:


Link:
http://www.nurcharecords.com/scrawl/Dice_Roll_Animations_01.zip


Code: [Select]
<?php


class item_Prediction extends itemTemplate {

    function 
getItemDetails() {
        
$this->authorName 'Inkstains';
        
$this->authorWeb '';
        
$this->authorEmail 'inkstains@nurcharecords.com';
        
        
$this->name "Prediction";
        
$this->desc "Predict what you will roll with the dice";
        
$this->price 10;

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

    function 
getAddInput()
{
global $item_info$db_prefix;
return '<br><b>You must assign a value</b><br>
                        Minimum amount of credits to give: <input type="text" name="info1" value="' 
$item_info[1] . '" /><br />
                        Maximum amount of credits to give: <input type="text" name="info2" value="' 
$item_info[2] . '" /><br />';
                }

    function 
getUseInput() {

        return 
'Select which number you think you will roll: <select name="dieside_" size="1" id="number">
        <option value="1">1</option>
<option value="2">2</option>
        <option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
  </select>'
;

    }



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

$failedTextArray = array(
"You rolled a %s <br/><br/>The force is weak in this one",
"You rolled a %s <br/><br/>I don't think you'll be opening a psychic hotline any time soon :p");

srand(time());
$value rand(16);

if($value == $_REQUEST["dieside_"]){
$value1 rand($item_info[1], $item_info[2]);
db_query("UPDATE {$db_prefix}members SET money = money + {$value1} WHERE ID_MEMBER = {$ID_MEMBER}"__FILE____LINE__);
return "<img src='".$boardurl."/Sources/shop/item_images/Roll".$value.".gif' align='texttop'/><br><br>Congratulations your prediction was right you rolled a ".$value." and got ".formatMoney($value1)."";
}else
return sprintf($failedTextArray[array_rand($failedTextArray)], $value);
}



}



?>


enjoy

updated Oct 08 2007

thanks to feeble for the condensed code.

7
Coding / a couple of questions
« on: March 23, 2007, 02:18:05 pm »
hi couple of questions

how can you use more than four "function getAddInput()" ? and why does the limitation exist?

also is therer a way to delay a return? say a user uses an item the item displays something and then when a designated amount of time has happened or an event has occured display another message


cheers for any help

8
Items / Cards - Random Item
« on: March 23, 2007, 12:33:20 am »
code updated 28-09-07

This is based on a idea by GhostWriter http://www.daniel15.com/forum/index.php/topic,703.0.html


I've tested as best i can but if you have any problems let me know also if any of the code can be done in a better way (especially the image stuff) please tell me as i'm still learning php also i think i would need some error catching on the remove credits code in case the user has no credits but i'm not sure how i would do that any recommendations would be appreciated.

save this file as Cards.php and upload to you shops item directory

Code: [Select]
<?php

if (!defined('SMF'))
die('Hacking attempt...');

class 
item_Cards extends itemTemplate
{
function getItemDetails()
{
$this->authorName 'Inkstains';
$this->authorWeb '';
$this->authorEmail 'inkstains@nurcharecords.com';

$this->name 'Cards';
$this->desc 'Try your luck and win. Karma, Credits and more up for grabs, but dont cry if you get burnt.';
$this->price 100;

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


function 
getAddInput()
{
global $item_info$db_prefix;
return '<br><b>You must assign a value to each card</b><br>
                        Ace/Joker Maximum amount to increase/decrease post count by:  <input type="text" name="info1" value="' 
$item_info[1] . '" /><br />
                        King/Joker Maximum amount to increase/decrease credits by:     <input type="text" name="info2" value="' 
$item_info[2] . '" /><br />
                        Queen/Joker Maximum amount to increase/decrease karma by:       <input type="text" name="info3" value="' 
$item_info[3] . '" /><br />
                        Jack/Joker Maximum amount to increase/decrease time online by: <input type="text" name="info4" value="' 
$item_info[4] . '" /><br />';
                }

function onUse()
{
global $db_prefix$ID_MEMBER$item_info$settings$context$boardurl$txt$scripturl;

                
$value mt_rand(18);

                if (
$value == 1) {

if ($item_info[1] ==  0)
                          {return 
"All cards must be assigned a value please edit item settings";
                                  die();}
                          else{          
$value1 mt_rand(0$item_info[1]);
                                       
$result db_query("UPDATE {$db_prefix}members SET posts = posts + {$value1} WHERE ID_MEMBER = {$ID_MEMBER}"__FILE____LINE__);
return "<img src='".$boardurl."/Sources/shop/item_images/Cards_ace_d.gif' align='texttop'/><br><br>You got an Ace and increased your post count by ". ($value1) ."";
}}
        elseif (
$value == 2) {
if ($item_info[2] ==  0)
                          {return 
"All cards must be assigned a value please edit item settings";
                                  die();}
                          else{          
$value1 mt_rand(0$item_info[2]);
                                       
$result db_query("UPDATE {$db_prefix}members SET money = money + {$value1} WHERE ID_MEMBER = {$ID_MEMBER}"__FILE____LINE__);
return "<img src='".$boardurl."/Sources/shop/item_images/Cards_king_d.gif' align='texttop'/><br><br>You got a King and gained "formatMoney($value1) ."";
}}
elseif ($value == 3) {
if ($item_info[3] ==  0)
                          {return 
"All cards must be assigned a value please edit item settings";
                                  die();}
                          else{          
$value1 mt_rand(0$item_info[3]);
                                       
$result db_query("UPDATE {$db_prefix}members SET karmaGood = karmaGood + {$value1} WHERE ID_MEMBER = {$ID_MEMBER}"__FILE____LINE__);
return "<img src='".$boardurl."/Sources/shop/item_images/Cards_queen_d.gif' align='texttop'/><br><br>You got a Queen and increased you karma by ". ($value1) ."";
}}
elseif ($value == 4) {
if ($item_info[4] ==  0)
                          {return 
"All cards must be assigned a value please edit item settings";
                                  die();}
                          else{          
$value1 mt_rand(0$item_info[4]);
                                       
$result db_query("UPDATE {$db_prefix}members SET totalTimeLoggedIn = totalTimeLoggedIn + {$value1} WHERE ID_MEMBER = {$ID_MEMBER}"__FILE____LINE__);
return "<img src='".$boardurl."/Sources/shop/item_images/Cards_jack_d.gif' align='texttop'/><br><br>You got a Jack and increased your time online by ". ($value1) ."";
}}
elseif ($value == 5) {
if ($item_info[1] ==  0)
                          {return 
"All cards must be assigned a value please edit item settings";
                                  die();}
                          else{   
$value1 mt_rand(0$item_info[1]);
                                       
$result db_query("UPDATE {$db_prefix}members SET posts = posts - {$value1} WHERE ID_MEMBER = {$ID_MEMBER}"__FILE____LINE__);
return "<img src='".$boardurl."/Sources/shop/item_images/Cards_joker_d.gif' align='texttop'/><br><br>You got a Joker!! and decreased your post count by ". ($value1) ."";
}}
        elseif (
$value == 6) {
        if (
$item_info[2] ==  0)
                          {return 
"All cards must be assigned a value please edit item settings";
                                  die();}
                          else{          
$value1 mt_rand(0$item_info[2]);
                                       
$result db_query("UPDATE {$db_prefix}members SET money = money - {$value1} WHERE ID_MEMBER = {$ID_MEMBER}"__FILE____LINE__);
return "<img src='".$boardurl."/Sources/shop/item_images/Cards_joker_d.gif' align='texttop'/><br><br>You got a Joker!! and lost "formatMoney($value1) ."";
}}
elseif ($value == 7) {
               if ($item_info[3] ==  0)
                          {return 
"All cards must be assigned a value please edit item settings";
                                  die();}
                          else{
         $value1 mt_rand(0$item_info[3]);
                                       
$result db_query("UPDATE {$db_prefix}members SET karmaBad = karmaBad + {$value1} WHERE ID_MEMBER = {$ID_MEMBER}"__FILE____LINE__);
return "<img src='".$boardurl."/Sources/shop/item_images/Cards_joker_d.gif' align='texttop'/><br><br>You got a Joker!! and decreased your karma by ". ($value1) ."";
}}
elseif ($value == 8) {
if ($item_info[4] ==  0)
                          {return 
"All cards must be assigned a value please edit item settings";
                                  die();}
                          else{          
$value1 mt_rand(0$item_info[4]);
                                       
$result db_query("UPDATE {$db_prefix}members SET totalTimeLoggedIn = totalTimeLoggedIn - {$value1} WHERE ID_MEMBER = {$ID_MEMBER}"__FILE____LINE__);
return "<img src='".$boardurl."/Sources/shop/item_images/Cards_joker_d.gif' align='texttop'/><br><br>You got a Joker!! and decreased your time online by ". ($value1) ."";
}}
        }
}
?>


I've included the images for this item as a zip just extract and upload them to your shops item_images folder all images have transparent backgrounds so they should be cool on any theme

http://www.nurcharecords.com/scrawl/Cards_images.zip


It would be cool to be able to do an interface for this where it shows the back of the card on getUseInput and when the user clicks on it it flips to reveal what they got. i don't know if that would be possible and is probably a little to advanced for me but does anyone know if it's possible?

9
Coding / [SOLVED] item image in return statement
« on: March 22, 2007, 02:32:26 pm »
Hi probably a stupid question but...

I have an item that when a user uses it it gives them a result with no user interaction what i want is to place an image when they get the return message can anyone provide me with some knowledge on how to do it? i've tried everything i can think of but can't get it to work.


cheers

Pages: [1]