1
Coding / Re: Send automated PM?
« on: October 14, 2006, 04:43:01 am »
So if I had an item that displays a random quote or something and have it return( after the item has been used, I can also make it send that same message to myself and the person who used the item?
After the function onUse() part is the array that holds the random "quotes" and then it returns it to them in the next box.
What would I add to make it send a PM to me and the person who used the item with the same message from the array?
Code: [Select]
<?php
/**********************************************\
| SMFSHOP (Shop MOD for Simple Machines Forum) |
| (c) 2005 DanSoft Australia |
| http://www.dansoftaustralia.com/ |
\**********************************************/
//File: FireScroll.php
// Test Item (requires NO input)
//VERSION: 1.0 (Build 1)
//DATE: 12h October 2006
// $Id: FireScroll.php 3 2006-10-12 10:01:21Z eckostylez $
//your class should always be called item_filename, eg. if your file is
//myCoolItem.php then the class should be called 'item_myCoolItem'. This
//class should always extend itemTemplate.
class item_FireScroll extends itemTemplate {
//when this function is called, you should set all the item's
//variables (see inside this example)
function getItemDetails() {
//VALUES CHANGABLE FROM WITHIN ADMIN PANEL:
//the name of the item
$this->name = "Firebending Scroll";
//the item's description
$this->desc = "Learn a new attack! Or an old one...!";
//the item's price
$this->price = 500;
//UNCHANGABLE VALUES:
//whether the item requires input or not. In this case, we don't need
//any input
$this->require_input = false;
//set this to 'false' if the item is unusable. This is good for display
//items.
$this->can_use_item = true;
}
//since this item requires no input, we don't need to have a getUseInput function
//here (see the testitem2.php file if you want to make an item that needs input.
//the is where all the fun begins. This function is called when
//the user actually uses the item. Return stuff, DON'T ECHO!
function onUse() {
$quotes = array('You learned Fire Kick - 3 DMG', 'You learned Flaming Punch - 2 DMG', 'You learned Lightning Strike - 5 DMG');
return ($quotes[rand(0, count($quotes) -1)]);
}
}
?>
After the function onUse() part is the array that holds the random "quotes" and then it returns it to them in the next box.
What would I add to make it send a PM to me and the person who used the item with the same message from the array?