Author Topic: Slap!  (Read 26128 times)

Offline TrueDestroyer

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

?>

« Last Edit: July 28, 2007, 03:45:27 pm by destroyed_ambition »

Offline inkstains

Re: Slap!
« Reply #1 on: August 18, 2007, 12:24:43 am »
cool item

Offline Dark_Zero

Re: Slap!
« Reply #2 on: August 19, 2007, 03:46:21 pm »
 :D nice item man this will surely pi$$ off my members ;D in a good way of course; thanks though O0 i'll probably use it

Offline breezy

Re: Slap!
« Reply #3 on: September 04, 2007, 11:06:49 am »
THIS IS THE BEST MOD EVER!!!! LOLOLOLOL  I AM STILL CRACKING UP!!!  I had no errors and it ran perfectly.  Im buying them just to see the different messages.. lol..  One suggestion.. make a link back to the shop that will allow the person who was slapped to go directly to purchase one.. lmao..
« Last Edit: September 04, 2007, 11:08:36 am by breezy »

Offline Dark_Zero

Re: Slap!
« Reply #4 on: September 06, 2007, 01:21:44 pm »
o yah breezy to make this even more fun just add a few more statements and increase the rand()% number to the number of total statements you have.. it's pretty cool :laugh: O0

Offline breezy

Re: Slap!
« Reply #5 on: September 07, 2007, 06:51:36 am »
o yah breezy to make this even more fun just add a few more statements and increase the rand()% number to the number of total statements you have.. it's pretty cool :laugh: O0

I took the same code and made a few changes here and there and also made it where you can purchase kisses.  I'm doing one tonight for lap dances. lmao

Offline Dark_Zero

Re: Slap!
« Reply #6 on: September 07, 2007, 12:57:30 pm »
haha nice O0

Offline breezy

Re: Slap!
« Reply #7 on: September 08, 2007, 12:42:22 am »
What would I need to add/change if I wanted to allow the purchaser to send a lapdance to themselves?

Offline Merch

Re: Slap!
« Reply #8 on: September 10, 2007, 04:05:01 pm »
Sounds funny but I got an error...

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')
ORDER BY mem.lngfile
LIMIT 0' at line 8
File: /home/tmuch3/public_html/forums/Sources/Subs-Post.php
Line: 771

Note: It appears that your database may require an upgrade. Your forum's files are currently at version SMF 1.1.3, while your database is at version 1.1.2. The above error might possibly go away if you execute the latest version of upgrade.php.

How would I do this upgrade!? I'm new to usin' these kind of boards and the whole php thing.

Offline breezy

Re: Slap!
« Reply #9 on: September 11, 2007, 01:28:40 am »
I received a similar error because of a syntax problem when trying to modify the code, but my  database did not need an upgrade.. I just found the line and found what was missing.

Offline doon

Re: Slap!
« Reply #10 on: September 16, 2007, 11:41:21 am »
i installed the php file in the shop item directory ... and when click on add/edit new item in cp

i got this

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/chillpar/public_html/Sources/shop/items/SlapAFoo.php on line 2

Parse error: syntax error, unexpected T_STRING in /home/chillpar/public_html/Sources/shop/items/SlapAFoo.php on line 2




plzz help

Offline ninerskickass

Re: Slap!
« Reply #11 on: September 22, 2007, 12:54:28 am »
Hey! I was wondering how I add this item to the shop? I'd like to test it out, sounds like fun!

I am clueless when it comes to coding though, so if someone could help me out I would truly appreciate it.

Thanks!

Offline Dark_Zero

Re: Slap!
« Reply #12 on: November 07, 2007, 11:39:30 am »
just save it as a php file and upload it through ftp into your shop items' directory. save it as SlapAFoo.php or whatever but dont leave the hanging .txt at the end

Offline ninerskickass

Re: Slap!
« Reply #13 on: January 14, 2008, 03:29:05 am »
just save it as a php file and upload it through ftp into your shop items' directory. save it as SlapAFoo.php or whatever but dont leave the hanging .txt at the end

thanks man!

Offline ctrlz

Re: Slap!
« Reply #14 on: January 28, 2008, 12:45:03 pm »
Is there any way to send the PM from a custom user like "Forum Bot". It gets confusing when the message is being sent by the person doing the slapping and everything is in the third person.