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

Pages: 1 2 [3] 4 5
31
Items / Re: Other item ideas I'm working on
« on: October 22, 2006, 07:35:09 am »
I was going to write a shield.  Wouldn't be hard, but you'd have to modify the negative effects items as well to account for a user potentially having a shield.

32
Items / Re: Item: Egg your victims avatar
« on: October 22, 2006, 06:23:52 am »
ok, I created egged in the avatars directory but when I tried egging someone all it did was remove the person's avatar.

33
General SMFShop Discussion / Re: SMFShop 2.3 now out!
« on: October 22, 2006, 12:57:51 am »
You should add the ability for admins to be able to "disconnect" from the shop.  They should be able to buy items for free and give away credits to anyone at any time.  They should also be able to NOT be listed in the Top Credits on hand and bank listings...   Just things I have to manually do to my shop after the update.

34
Items / Ask the Goofball
« on: October 22, 2006, 12:07:54 am »
I created a forum on my site called ASK THE GOOFBALL (you could use anything for this... ) In my forum it's so people can ask silly questions and get silly responses.  The thing os, only USERS can post a question (not even global moderators) and only the Forum moderator (nobody else, except the ADMIN) can respond to questions.  This creates an "ASK" forum.  You have to be using LOCAL PERMISSIONS for the goofball forum so you can turn replies for regular users.  Also so you can restrict the moderator's permissions in that forum so they're not a REAL forum moderator, the only permission they have that everyone else doesn't is the ability to REPLY to any topic.

So someone comes in, asks a question and only the moderator of that forum can respond.

This creates a GOOFBALL seat. ;)  Now, the fun... I created a shop item allowing anyone to put anyone else in the goofball seat. 

My item uses my Shop Log modification so you'll want to comment that out if you don't have a SHOP HISTORY forum in which you want major shop transactions recorded.  Though I recommend one, even if you set it to Admin only to read posts in there, at least you'll know wtf is going on when someone tries robbing the bank.  (you had to add the shop history code to that item yourself).

Code: [Select]
<?php
/**********************************************\
| SMFSHOP (Shop MOD for Simple Machines Forum) |
|         (c) 2005 DanSoft Australia           |
|      http://www.dansoftaustralia.com/        |
\**********************************************/

//File: AskTheGoofball.php
//      Item

//VERSION: 1.0 (Build 1)
//DATE: Oct 21, 2006
//Author Chad
//Helped by Karmaboost mod

class item_AskTheGoofball extends itemTemplate {
    function 
getItemDetails() {
    
$this->authorName "Chad";

$this->authorWeb "http://www.aviary.info/";

$this->authorEmail "generalchad@gmail.com";

        
$this->name "New Goofball";
        
$this->desc "Sets someone in the GOOFBALL seat in the Ask the Goofball forum!";
        
$this->price 250;

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

    function 
getUseInput() {
        global 
$context$scripturl$settings$txt;
        return 
"Who's the Goofball: <input type='text' name='goofball' size='50'>
         <a href='
{$scripturl}?action=findmember;input=goofball;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>";
    }

    function 
onUse() {
        global 
$db_prefix$ID_MEMBER$item_info$user$sourcedir;
require_once($sourcedir '/Subs-Post.php');
$goofballforumID 99//Set this to your Goofball forum ID
$shophistoryID=98;//Set this to 0 if you don't have a shop history forum

//Begin Shop history
if ($shophistoryID) {
$topicOptions['board'] = $shophistoryID//SHOP history forum
$topicOptions['id']=0//NEW topic
$msgOptions['subject'] = "I just put ".$_POST['goofball']." into the Goofball seat!"//Subject
$msgOptions['body'] = "I just put ".$_POST['goofball']." into the Goofball seat!"
$posterOptions['id']=$ID_MEMBER//Current user's ID
createPost(&$msgOptions, &$topicOptions, &$posterOptions); //create the post using the SMF posting function
}
//End Shop history
//Begin Goofball forum post - this is useful to let everyone know you have a new goofball
$topicOptions['board'] = $goofballforumID//Goofball forum - so everyone knows the tides have turned //change this to your goofball forum number
$topicOptions['id']=0//NEW topic
$msgOptions['subject'] = "I just put ".$_POST['goofball']." into the Goofball seat!"//Subject
$msgOptions['body'] = "I just put ".$_POST['goofball']." into the Goofball seat!"
$posterOptions['id']=$ID_MEMBER//Current user's ID
createPost(&$msgOptions, &$topicOptions, &$posterOptions); //create the post using the SMF posting function

            
$result db_query("SELECT ID_MEMBER

                                FROM 
{$db_prefix}members

                                WHERE memberName = '
{$_POST['goofball']}'"__FILE____LINE__);

            
$row mysql_fetch_array($resultMYSQL_ASSOC);

            
$goofball_ID $row['ID_MEMBER'];
            
        
$result db_query("DELETE FROM {$db_prefix}moderators
                               WHERE ID_BOARD = 
{$goofballforumID}",__FILE____LINE__);
        
$result db_query("INSERT INTO {$db_prefix}moderators (ID_BOARD, ID_MEMBER) 
          VALUES (
{$goofballforumID}{$goofball_ID})" //EDIT the 99 to the forum number that you use for the goofball posts
                               
,__FILE____LINE__);

        return 
"{$_POST['goofball']} is the new goofball!!";
    }
}
?>

35
Coding / Modify your "EXTREME" items to log actions in a forum
« on: October 21, 2006, 11:13:04 am »
I created a forum for my Shop History so everyone can now see who's tried to do what and they can reply and carry on in that area.  They can't create NEW topics though (using advanced permissions that you can turn on in SMF).

Anyway, add this code to whatever item you want to post a message for in the  onuse function :

Make sure these are part of that function's GLOBAL declaration:
$ID_MEMBER, $sourcedir
This example is from the KARMA BOOST item:

Code: [Select]
require_once($sourcedir . '/Subs-Post.php');
$topicOptions['board'] = 98; //SHOP history forum  Mine is #98  You need to create this then use it's ID number
$topicOptions['id']=0; //NEW topic
$msgOptions['subject'] = "I just boosted ".$_POST['bashwho']; //Subject
$msgOptions['body'] = "I just boosted ".$_POST['bashwho']; //Message area
$posterOptions['id']=$ID_MEMBER; //Current user's ID
createPost(&$msgOptions, &$topicOptions, &$posterOptions); //create the post using the SMF posting function

36
General SMFShop Discussion / Re: How to add points elsewhere?
« on: October 14, 2006, 12:18:42 am »
Dan, I'm wondering why you use {$db_prefix} instead of .$db_prefix. like this:
Code: [Select]
      $sql = "INSERT INTO " . $db_prefix . "sbox_content (ID_MEMBER, content, time) VALUES ('" . $context['user']['id'] . "', '" . $content . "', '$date')";
      db_query($sql, __FILE__, __LINE__);
From the Shoutbox.  Should I be concerned with that type of code being vulnerable to sql injection?  He does slashes before he runs the sql but I'm not sure which method is proper?

37
General SMFShop Discussion / Re: SMF-RPG-Shop-II_1-0
« on: October 13, 2006, 11:24:56 pm »
I'm stealing that :)

38
Coding / Re: Is the Shop integratable?
« on: October 11, 2006, 11:39:57 am »
I think phpbb has some shops already?

39
Installation Problems / Re: Shop installed, now can't view posts!
« on: October 09, 2006, 09:17:13 am »
dang I was going to respond "You have to have 100 credits to read posts" lol

40
Items / Re: Rob The Bank - new item
« on: October 09, 2006, 09:16:40 am »
Now we'll see how excited your members are when the ROB the bank.. muahhahaha Mine haven't even tried since I changed the negative side effects of failure.

41
Items / Re: Rob The Bank - new item
« on: October 08, 2006, 05:54:11 am »
Albadon: make sure you save the file as:
RobTheBank.php

42
Items / Re: Rob The Bank - new item
« on: October 06, 2006, 10:04:39 pm »
Ok, I editted the main post.  I hadn't done that before because this is technically a different version than the original. :P  Oh well though, too bad because now they're the same.

43
Items / Re: Rob The Bank - new item
« on: October 04, 2006, 11:33:21 am »
hahaha yah tonight someone succeeded in robbing the bank.  He bought 5 of them and used them trying.  I had it set to 10%.  but, becuse he robbed it, I changed the code a bit.  If you fail, it will now take all your money and then some, give you 100 neg karma and take away all your items.  This will prevent people from stockpiling ROB THE BANK items and trying all night long, even though it's HELLA expensive to buy one.  Here's my updated code (still the PM isn't quite right):
Code: [Select]
<?php
/**********************************************\
| SMFSHOP (Shop MOD for Simple Machines Forum) |
|         (c) 2005 DanSoft Australia           |
|      http://www.dansoftaustralia.com/        |
\**********************************************/

//File: RobTheBank.php
//      % chance to steal from all members in the bank
// on success, awards robber between 20 and 80% of the sum of all bank accounts
// and reduces bank accounts accordingly and gives 10 negative karma.
// On failure, gives -100 karma and sets money and bank money to 0 for robber.

//VERSION: 1.0 (Build 1)
//DATE: Sep 26th, 2006
// $Id: RobTheBank.php chadk $

class item_RobTheBank extends itemTemplate {
    function 
getItemDetails() {
        
$this->name "Rob the bank!";
        
$this->desc "You can try to ROB THE BANK!  This gives you a CHANCE to steal a portion of the money from EVERYONES bank account!  Note: Karma is NOT BLIND!  Even if you rob the bank, there may be consequences!";
        
$this->price 1000;
        
        
$this->require_input false;
        
$this->can_use_item true;
    }

    
//see AddToPostCount.php for more infos
    
function getAddInput() {
        return 
"Probability of successful robbery: <input type='text' name='info1' value='10'>%";
    }

    function 
onUse() {
        global 
$db_prefix$ID_MEMBER$item_info$user;
        
        
$pmfrom = array(
            
'id' => 1,
            
'name' => 'Chad',
            
'username' => 'Chad'
        
);
        
        
$pmto = array(
            
'to' => array(1),
            
'bcc' => array()
        );

        
//get a random number between 0 and 100
        
$try mt_rand(0100);

        
//if successfull
        
if ($try $item_info[1]) {

            
//get stealee's money count
            
$result db_query("SELECT sum(moneyBank) as vault
                                FROM 
{$db_prefix}members"__FILE____LINE__);
            
$row mysql_fetch_array($resultMYSQL_ASSOC);

            
//get random amount between 0 and amount of money stealee has
            
$steal_amount 1-(mt_rand(10,60)/100);

            
//take this money away from stealee...
            
$result db_query("UPDATE {$db_prefix}members
                                SET moneyBank = moneyBank * 
{$steal_amount}"__FILE____LINE__);
            
//...and give to stealer (robber)

$steal_amount = ($steal_amount-1) * -$row['vault'];

            
$result db_query("UPDATE {$db_prefix}members
                                SET money = money + 
{$steal_amount}, karmaBad = karmaBad + 10
                                WHERE ID_MEMBER = 
{$ID_MEMBER}
                                LIMIT 1"
__FILE____LINE__);

sendpm($pmto'Bank Robbed!'"{$user} Robbed the bank for {$steal_amount}"0$pmfrom);
                return 
"You ROBBED THE BANK for $steal_amount!  Thief! Your Karma is STILL reduced by 10! (Karma isn't blind!)";


        } 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 + 100, 
money = -100, moneyBank = -500
WHERE ID_MEMBER = 
{$ID_MEMBER}",
__FILE____LINE__);
$result db_query("DELETE FROM {$db_prefix}shop_inventory
WHERE ownerid = 
{$ID_MEMBER}",
__FILE____LINE__);

sendpm($pmto'Bank Robbery Foiled!'"{$user} was BUSTED!"0$pmfrom);
return "Steal <b>unsuccessful!</b> You Karma is now reduced by 100!";
        }
    }
}

?>


44
Items / Re: Rob The Bank - new item
« on: October 03, 2006, 05:55:40 am »
Yep, I'll grab it out of that one.  I'm waiting to see how compatible my shop will be (if at all) with the Shop/RPG mod being done.

45
General SMFShop Discussion / Re: SMF-RPG-Shop-II_1-0
« on: October 03, 2006, 05:54:35 am »
This is going to be fun stuff.  Wait until the parrot website I run gets a load of this! lol

Pages: 1 2 [3] 4 5