Modifications for phpBB3.
Try the Mods here and share Your own Mods
Forum rules
You dont have to use ModX or make your mod AutoMod compatible. A simple textfile is fine
But if you post Mods here You also have to give support
Post
by Stoker » 24 Jul 2013, 18:15
Heres the Dice addon for mchat.
Steve did most of it if I remember correct
Open mchat.php
Find:
Code: Select all
$sql_ary = array(
'forum_id' => 0,
Before add:
Code: Select all
$find_chars = array("//roll_dice");
$roll_dice = mt_rand(2,12);
switch ($roll_dice)
{
case $roll_dice == '1':
$roll_dice = '<img src="' . $phpbb_root_path . 'images/dice1.gif" width="32" height="32" alt="1" />';
break;
case $roll_dice == '2':
$roll_dice = '<img src="' . $phpbb_root_path . 'images/dice2.gif" width="32" height="32" alt="2" />';
break;
case $roll_dice == '3':
$roll_dice = '<img src="' . $phpbb_root_path . 'images/dice3.gif" width="32" height="32" alt="3" />';
break;
case $roll_dice == '4':
$roll_dice = '<img src="' . $phpbb_root_path . 'images/dice4.gif" width="32" height="32" alt="4" />';
break;
case $roll_dice == '5':
$roll_dice = '<img src="' . $phpbb_root_path . 'images/dice5.gif" width="32" height="32" alt="5" />';
break;
case $roll_dice == '6':
$roll_dice = '<img src="' . $phpbb_root_path . 'images/dice6.gif" width="32" height="32" alt="6" />';
break;
case $roll_dice == '7':
$roll_dice = '<img src="' . $phpbb_root_path . 'images/dice6.gif" width="32" height="32" alt="6" /> <img src="' . $phpbb_root_path . 'images/dice1.gif" width="32" height="32" alt="7" />';
break;
case $roll_dice == '8':
$roll_dice = '<img src="' . $phpbb_root_path . 'images/dice6.gif" width="32" height="32" alt="6" /> <img src="' . $phpbb_root_path . 'images/dice2.gif" width="32" height="32" alt="8" />';
break;
case $roll_dice == '9':
$roll_dice = '<img src="' . $phpbb_root_path . 'images/dice6.gif" width="32" height="32" alt="6" /> <img src="' . $phpbb_root_path . 'images/dice3.gif" width="32" height="32" alt="9" />';
break;
case $roll_dice == '10':
$roll_dice = '<img src="' . $phpbb_root_path . 'images/dice6.gif" width="32" height="32" alt="6" /> <img src="' . $phpbb_root_path . 'images/dice4.gif" width="32" height="32" alt="10" />';
break;
case $roll_dice == '11':
$roll_dice = '<img src="' . $phpbb_root_path . 'images/dice6.gif" width="32" height="32" alt="6" /> <img src="' . $phpbb_root_path . 'images/dice5.gif" width="32" height="32" alt="11" />';
break;
case $roll_dice == '12':
$roll_dice = '<img src="' . $phpbb_root_path . 'images/dice6.gif" width="32" height="32" alt="6" /> <img src="' . $phpbb_root_path . 'images/dice6.gif" width="32" height="32" alt="12" />';
break;
}
$message = str_replace($find_chars, $roll_dice, $message);
Dices.zip
You do not have the required permissions to view the files attached to this post.
Post
by martin123456 » 31 Jul 2013, 12:15
Stoker wrote: Heres the Dice addon for mchat.
Steve did most of it if I remember correct
I did some too
2 versions for showing it in chat if i remember right.
Post
by Stoker » 31 Jul 2013, 12:19
Actually Im not sure if Rich was involved too
Post
by martin123456 » 31 Jul 2013, 16:01
Il check
Post
by RMcGirr83 » 03 Aug 2013, 11:47
No I wasn't involved.
Post
by Solidjeuh » 06 Aug 2013, 00:34
How can I make it with 4 dices?
I tried to add another line in the code:
<img src="' . $phpbb_root_path . 'images/dice1.gif" width="32" height="32" alt="1" />
change the number to 4,24
And add 12 more lines into the code..
But I always get 2 times just the same dices..
Post
by Steve » 22 Aug 2013, 14:36
This version prevents cheating and rolling the dice more than once!
mchat.php find:
Code: Select all
$sql_ary = array(
'forum_id' => 0,
'post_id' => 0,
before add:
Code: Select all
//Lets play the game ...
if (preg_match("/:roll_dice:/i", $message))
{
$roll_dice = mt_rand(1, 6);
switch ($roll_dice)
{
case $roll_dice == '1':
$roll_dice = '<img src="' . $phpbb_root_path . 'images/dice1.gif" width="32" height="32" alt="1" />';
break;
case $roll_dice == '2':
$roll_dice = '<img src="' . $phpbb_root_path . 'images/dice2.gif" width="32" height="32" alt="2" />';
break;
case $roll_dice == '3':
$roll_dice = '<img src="' . $phpbb_root_path . 'images/dice3.gif" width="32" height="32" alt="3" />';
break;
case $roll_dice == '4':
$roll_dice = '<img src="' . $phpbb_root_path . 'images/dice4.gif" width="32" height="32" alt="4" />';
break;
case $roll_dice == '5':
$roll_dice = '<img src="' . $phpbb_root_path . 'images/dice5.gif" width="32" height="32" alt="5" />';
break;
case $roll_dice == '6':
$roll_dice = '<img src="' . $phpbb_root_path . 'images/dice6.gif" width="32" height="32" alt="6" />';
break;
}
$chars_array = preg_split('/[\s?:;,.]+/', $message, -1, PREG_SPLIT_NO_EMPTY);
$unique_chars_array = array_unique($chars_array);
$message = implode(' ', $unique_chars_array);
$find_chars = array("roll_dice");
$message = str_replace($find_chars, $roll_dice, $message);
}
language/en/mods/mchat_lang.php
find:
Code: Select all
// ACP
'USER_MCHAT_UPDATED' => 'Users mChat preferences were updated',
before add:
styles/prosilver/template/mchat_body.html
find:
Code: Select all
<!-- IF MCHAT_READ_ARCHIVE_BUTTON -->
<input type="button" class="button2" onclick="window.location.href = '{MCHAT_ARCHIVE_URL}';" value="{L_MCHAT_ARCHIVE}" />
<!-- ENDIF -->
Before add:
Code: Select all
<input type="button" class="button2" onclick="insert_text(' :roll_dice: ');" value="Roll Dice" />
Purge and refresh
Post
by Blackwolf » 23 Aug 2013, 11:14
thanks heaps!
Post
by Gamers Talk » 17 Sep 2013, 22:17
I did the install to my mchat.php file but when I type :dice roll: in the text area it doesn't do anything and I also uploaded the dice images to my images folder. What am I doing wrong? Also how do I add the dice button on the mchat?
Post
by Solidjeuh » 17 Sep 2013, 22:25
The code to use in mchat is this: [color=#FF0000]//roll_dice[/color]
You can chance that in whatever you want in mchat.php
$find_chars = array("[color=#FF0000]//roll_dice[/color]");
Adding a button:
Open:
styles/prosilver/template/mchat_body.html
find:
<!-- IF MCHAT_READ_ARCHIVE_BUTTON -->
<input type="button" class="button2" onclick="window.location.href = '{MCHAT_ARCHIVE_URL}';" value="{L_MCHAT_ARCHIVE}" />
<!-- ENDIF -->
Before add:
<!-- IF S_USER_LOGGED_IN and not S_IS_BOT -->
<input class="button2" type="button" value="Roll Dice" onclick="insert_text('[color=#FF0000]//roll_dice[/color]');"></input>
<!-- ENDIF -->