MyBB Community Forums

Full Version: /slap
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Is it possible to make the /slap message random?

(I would specify a list of slap messages in an array)
Forgive my ignorance, but what is a slap message and where do you want to display it?
Slap message is when you do
/slap

Like this:

* duyen slaps babjusi around a bit with a large trout.

I want to randomize "around a bit with a large trout." and "slaps"
Ah, I see. And where do you want to display them? At the board index of your forum for ex?
I found a solution, I'll post it in a sec.

EDIT:

$slaps = array();
$slaps[1] = "slaps";
$slaps[2] = "slap chops";
$slaps[3] = "pwns";
$slaps[4] = "rap chops";
$slapobject = array();
$slapobject[1] = "around a bit with a large trout.";
$slapobject[2] = "with Vince.";
$slapobject[3] = "with his mad DotA skills.";
$slapobject[4] = "with his nuts.";
$tempint=rand(1,2);


// Replace "me" code and slaps if we have a username
if($options['me_username'])
{
global $lang;

$message = preg_replace('#(>|^|\r|\n)/me ([^\r\n<]*)#i', "\\1<span style=\"color: red;\">* {$options['me_username']} \\2</span>", $message);

$message = preg_replace('#(>|^|\r|\n)/slap ([^\r\n<]*)#i', "\\1<span style=\"color: red;\">* {$options['me_username']} $slaps[$tempint] \\2 $slapobject[$tempint]</span>", $message);
}
can show us the result in screenshot it would nice to understand what output of this code has
thank you
What do you do with that? =/
(2009-06-21, 06:51 PM)Elegant Totality Wrote: [ -> ]What do you do with that? =/

To slap the person above your post..! Smile
* Elegant Totality slaps Ghazal around a bit with a large trout.

Toungue I knew that

I was asking where I put that code... I want to use it xD