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

Pages: [1]
1
Items / Re: Slap!
« on: October 04, 2008, 02:18:40 pm »
Wow... didn't really think anyone had taken this up. Cool though. Yeah, the images are dead because of a forum move. I don't think I have them anymore, they were all just random images I pulled from searching "owned" on Google. I'm sure you're all capable of this.

As per the errors and suggestions, if I get a chance, I'll take a look at making a new version.

2
Items / Slap!
« on: July 28, 2007, 03:36:24 pm »
Alright, I'm trying to make an item that sends a taunt, an image, and a message to a user, along with lowering their Karma. It's called 'Slap A Foo', I thought it would just be something fun that members could do. Anyway, I think I have it working. Anyone want to try it out? Opinions and comments very welcome. There's probably a bug in there somewhere, this is my first custom item.
Code: [Select]
<?php
//Author: TrueDestroyer
//File: SlapAFoo.php
//Copyright 2007

// VERSION: 1.0
// Date: 2007-07-38

global $sourcedir;
require_once(
$sourcedir.'/Subs-Post.php');
class 
item_SlapAFoo extends itemTemplate {
    
  function 
getItemDetails() {
    
//My info
$this->authorName "TrueDestroyer";
    
$this->authorWeb "http://forum.briskfire.net";
    
$this->authorEmail "dkrieg@briskfire.net";
    
//Item info
    
$this->name "Slap A Foo";
    
$this->desc 'Show that fool the disrespect they deserve! Slap'.
      
' them and knock their Karma down a little.';
    
$this->price 500;
    
$this->require_input true;
    
$this->can_use_item true;
  }
 
  function 
getAddInput() {
    
//Get the amount of Karma to knock off of the user.
    
return "Karma to knock out : <input type='text' name='info1' value='5'>'";
  }  

  function 
getUseInput() {
    global 
$context$scripturl$settings$txt;
    return 
"<table><tr><td>Slap : </td><td><input type='text' name='slapwho' size='50'>
        <a href='
{$scripturl}?action=findmember;input=slapwho;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></td></tr>
        <tr><td valign='top'>Talk smack : </td><td><textarea name='talksmack' cols='50' rows='2'></textarea></td></tr></table>"
;
  }
    
  function 
onUse() {
    global 
$db_prefix$ID_MEMBER$user$item_info;
    
//Get the current user's display name
    
$result db_query("SELECT realName, memberName
                  FROM 
{$db_prefix}members
                  WHERE ID_MEMBER = 
{$ID_MEMBER}"__FILE____LINE__);
    
$row mysql_fetch_array($resultMYSQL_ASSOC);
    
$user $row["realName"];
    
//Set up the pm
    
$pmfrom = array(
        
'id' => $ID_MEMBER,
        
'name' => $row['realName'],
        
'username' => $row['memberName']
        );
        
    
$pmto = array(
        
'to' => array($_POST['slapwho']),
        
'bcc' => array()
        );

    if (
$user == $_POST['slapwho']) {
      return 
"You can't slap yourself!";
      die();
    }else{
      
$amount $item_info[1];
      
$result db_query("UPDATE {$db_prefix}members
                  SET karmaBad = karmaBad + 
{$amount}
                  WHERE realName = '
{$_POST['slapwho']}'"
                  
__FILE____LINE__);
                  
      
//Pick random taunt.
      
$message rand()%5;
      
$mess_ar = array(
              
"[b]{$user}[/b] has just slapped you back to the stone age.\n",
              
"[b]{$user}[/b] has just shamed you with a slap across the face.\n",
              
"[b]{$user}[/b] has just slapped you hard enough to make your grandmother feel it.\n",
              
"[b]{$user}[/b] just smacked you with a fish.\n",
              
"[b]{$user}[/b] just delivered some ownage on your face.\n"
              
);
      
//Pick random image.
      
$image rand()%5;
      
$img_ar = array(
              
"[img]http://images.briskfire.net/forum/tangs.jpg[/img]\n",
              
"[img]http://images.briskfire.net/forum/biff.jpg[/img]\n",
              
"[img]http://images.briskfire.net/forum/face.jpg[/img]\n",
              
"[img]http://images.briskfire.net/forum/ninjacat.jpg[/img]\n",
              
"[img]http://images.briskfire.net/forum/kid_smack.gif[/img]\n"
              
);

      
$talk_smack '';
      if(isset(
$_POST['talksmack'])&&$_POST['talksmack']!='')
        
$talk_smack 'And to add insult to injury, they said :
'
.$_POST['talksmack']; 
      
      
sendpm($pmto'You Have Just Been Slapped!'
          
$mess_ar[$message].$img_ar[$image].$talk_smack
          
0$pmfrom); ;
      return 
"You've slapped {$_POST['slapwho']}!!!";
    }
  }
}

?>


Pages: [1]