News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

SMF Shoutbox

Started by Deep, March 15, 2006, 08:09:52 AM

Previous topic - Next topic

Penelope

#160
in Arcade.php find:


Function Arcade_submit_normal($warning,$hop)

and
Function Arcade_comment()



And copy & paste this between the 2 lines: ( Overwrite what is between it now :) )


{
global $boardurl, $txt, $scripturl, $db_prefix, $boarddir;
global $ID_MEMBER, $sourcedir,$language,$user_profile;
global $context, $user_info, $db_prefix, $modSettings;

$days = array($txt['sbox_Sunday'],$txt['sbox_Monday'],$txt['sbox_Tuesday'],$txt['sbox_Wednesday'],$txt['sbox_Thursday'],$txt['sbox_Friday'],$txt['sbox_Saturday']);
$day=$days[date("w")]; // weekday
$date=$day." | ". date("G:i"); // time
$time = time();

$duration = $time - $_SESSION['arcade']['start_time'];

if(!isset($_SESSION['arcade']['submit']) || $_SESSION['arcade']['submit']['score'] != $_POST['score'])
{

$query = "INSERT INTO `{$db_prefix}games_high` (`game`, `member`, `score`, `stime`,`warning`,`duration`,`ip`) VALUES ('{$_REQUEST['game']}', '{$ID_MEMBER}', '{$_POST['score']}', '{$time}','{$warning}','{$duration}','-')";
$results = db_query($query, __FILE__, __LINE__);

$per_sivu = $modSettings['arcade_highscores_per_page'];

$game = Get_Game_Info($_POST['game']);

$b = (get_position($_REQUEST['game'],$_REQUEST['score'],$game['type'],0));

$_GET['start'] = $b;

$_SESSION['arcade']['submit'] = array
(
'game' => $_POST['game'],
'score' => $_POST['score'],
'time' => $time,
'duration' => $duration,
'start' => $b,
'warning' => $warning,
'comment' => 0,
);

update_champ($_POST['game']);


/*
* scores inserted
* now if this player subbmit a number one score
* give him credits for the shop :)
*/
$query = "SELECT `member`, `score`, `stime` FROM `{$db_prefix}games_high` WHERE `game` = '{$_REQUEST['game']}' ORDER BY `score` DESC";
$result = db_query($query, __FILE__, __LINE__);
$content = mysql_fetch_array($result);
if( $content['stime'] == $time &&
$content['member'] == $ID_MEMBER &&
$content['score'] == $_POST['score']
  ){
// first score!!!
// give player 10 points in his bank ;)
$query = "UPDATE `{$db_prefix}members` SET `moneyBank` = `moneyBank` + '10.00' WHERE `ID_MEMBER` ='{$ID_MEMBER}'";
$results = db_query($query, __FILE__, __LINE__);
}

/*
* scores inserted
* now if this player subbmit a number one score
* give him credits for the shop :)
*/
$query = "SELECT `member`, `score`, `stime` FROM `{$db_prefix}games_high` WHERE `game` = '{$_REQUEST['game']}' ORDER BY `score` DESC";
$result = db_query($query, __FILE__, __LINE__);
$content = mysql_fetch_array($result);
if( $content['stime'] == $time &&
$content['member'] == $ID_MEMBER &&
$content['score'] == $_POST['score']
  ){
// first score!!!
// give player 10 points in his bank ;)
$query = "UPDATE `{$db_prefix}members` SET `moneyBank` = `moneyBank` + '10.00' WHERE `ID_MEMBER` ='{$ID_MEMBER}'";
$results = db_query($query, __FILE__, __LINE__);

// -- SETUP EDITS ---

$db_prefix = 'smf_'; //edit this to your your database prefix - usually smf_
$no = 10; //number of top players to show

// --LANGUAGE EDITS --
$txtplay = "The Top Players"; // change "The Top Players" to your language
$txtwin = "Number Of Wins :";// change "Number Of Wins :" to your language
$txtlate = "Latest High Score by ";// change "Latest High Score set by" to your language
$txtwit = "with ";// change "with" to your language
$txton = "on ";// change "on" to your language

require('./Settings.php');


$link = mysql_connect($db_server, $db_user, $db_passwd);
mysql_select_db($db_name, $link);

// --START BLOCK CODE --
$content = "";  //set blank for a start

//Get newest champ or die
$sql = "SELECT m.ID_MEMBER,m.realName,g.id, g.game, g.name,g.champion_score "
. "FROM {$db_prefix}members m , {$db_prefix}games g "
. "WHERE g.champion_score > 0 AND m.ID_MEMBER=g.champion_member "
. "ORDER BY g.champion_time DESC LIMIT 0,1";

if(!($result = mysql_query($sql,$link)))
{
die("Could not get the newest champ");
}
$row = mysql_fetch_assoc($result);
mysql_free_result($result);

//newest champ details
$playerid = $row['ID_MEMBER'];
$player = $row['realName'];
$game_id = $row['id'];
$game_name = $row['name'];
$score = $row['champion_score'];

//now get the pic for the game
$ext = array('gif','GIF','png','PNG','jpg','JPG',);
$game_pic = ""; // No thumbnail for default
foreach($ext as $ex)
{
if(file_exists($boarddir. "/Games/".$row['game'].".".$ex))
{
$game_pic = $boardurl."/Games/".$row['game'].".".$ex;
}
}


//Get the 10 best players or die
/*$sql = "SELECT m.ID_MEMBER, m.realName, count(g.id) As cnt"
. " FROM {$db_prefix}games g, {$db_prefix}members m"
. " WHERE m.ID_MEMBER=g.champion_member"
. " GROUP BY realName "
. " ORDER BY cnt DESC LIMIT 0,{$no}";
if(!($result = db_query($sql,__FILE__,__LINE__)))
{
die("Could not get the best players");
}

$row = mysql_fetch_assoc($result);*/

$score_poss=0; //players position


// new higscore!!!
// add new highscore message in shoutbox!
$sql = "insert into ".$db_prefix."sbox_content (name,content,time) values ('".$user_info['username']."','".$content."<b>I am the new Champ of <a href=\"{$scripturl}?action=arcade;sa=play;game={$game_id}\" target=\"_blank\">{$game_name}</a> {$txtwit} a score of {$score}!</b>','$date')";
db_query($sql,__FILE__,__LINE__);

}
}
}


That's the way i have it ;) :)

onijin

Koo~

parse errors went away.

Shout box works flawlessly.

Not too sure about the creds though...  taking trophies is a little too difficult right now (high score bastards) so I can't really test it.

Penelope

#162
If your post is about the highscore code i don't get it, sry  :-[ :)

I was wondering if it is possible to have a Shoutbox Archive which stores all the shouts that is been made into the Shoubox. ( Like Ultimate Shoutbox has  :) ) Any idea's how?

littleone

how many tokens does it give for new high scores?  Or can we set that?

littleone

I also wanted to say that I am using 1.2.4b and I cant find the coding that you say your coding needs to be placed inbetween.  In neither Arcade.php or Arcade2.php

onijin

Quote from: Penelope on June 20, 2006, 10:31:01 AM
If your post is about the highscore code i don't get it, sry  :-[ :)

I was wondering if it is possible to have a Shoutbox Archive which stores all the shouts that is been made into the Shoubox. ( Like Ultimate Shoutbox has  :) ) Any idea's how?

Actually... That would be pretty cool.

I have my box set at 10k.  I wanted to keep all the shouts, but it takes a while to load.

Drea

I am trying to get this to work on safmc theme but I can't I keep tryin to add the code in different places to show on the forum but it does nothing. I know it works because when I went to default it did, and the yabb theme it also works. So its just I am unsure how to get it to work with safmc and I really want to, because this is my fave theme. Hope someone can help. Thanks in advance for whoever can.

onijin

hey penelope,
small question..

have you recieved this:
Quote8: Undefined index: looser
File: /home/for10001/public_html/forum/Themes/TP_helios_multi11_rc2/Arcade.template.php (eval?)
Line: 1104

Penelope

Hey Onijin  :)

No i haven't recieved it.

dry3210

Is it possible to get this to load up on each board too?  I edited some code but it ended up being at the very top of the page (instead of after tabs like it does on the main page) and it increase the font size of the boards

Anyone?  Thanks

littleone

Quote from: dry3210 on June 22, 2006, 12:47:00 AM
Is it possible to get this to load up on each board too?  I edited some code but it ended up being at the very top of the page (instead of after tabs like it does on the main page) and it increase the font size of the boards

Anyone?  Thanks

If you have a large forum or are limited on bandwidth(as in your pushing it each month) I personally would not recommend doing this.  Each time it refreshes or its load (or in your case, each time its loaded cause someone is viewing a new topic) its using up bandwidth and this sure can add up after a while.


dry3210

Quote from: littleone on June 22, 2006, 12:47:05 PM
If you have a large forum or are limited on bandwidth(as in your pushing it each month) I personally would not recommend doing this.  Each time it refreshes or its load (or in your case, each time its loaded cause someone is viewing a new topic) its using up bandwidth and this sure can add up after a while.

I don't want it on every topic..just the main board and the sub boards.  And I'm aware it will use more bandwidth....

Drea

I am still trying to get this to work on the safmc theme is there a way to do so

invisiblex

guyz when i click on smilies they dont work :-\

pls tell solution

i use otehr theme

carola0102

Hi all,

the shotbox mod was working very well, but today I get this error every time when a page load:

Notice: Undefined index: action in /usr/local/psa/home/vhosts/tamilflowerz.net/httpdocs/forum/Sources/sboxDB.php on line 66

how can I fix it? could anyone please help?

Kettu

#175
Quote from: Drea on June 23, 2006, 07:19:34 PM
I am still trying to get this to work on the safmc theme is there a way to do so
Did you add:
// display shoutbox
  if (function_exists('sbox')) sbox();

to your BoardIndex.template.php i.e. before
// Here's where the "Info Center" starts...?

I also have a question. It should be simple but currently the search function is deactivated so I can't find the answer. ::) I would like to have the shoutbox only shown for registered users not for guests.

Edit:
My boyfriend already found the solution for the guest problem. For all, who are also interested in it, just do following:
Replace at your BoardIndex.template.php
  // display shoutbox
  if (function_exists('sbox')) sbox();

with
  if (!$context['user']['is_guest'])
{
  // display shoutbox
  if (function_exists('sbox')) sbox();}


Edit2:
Well, first problem fixed but there is a new one. I can't collapse the shoutbox :( It only jumps to the head of the index page but nothing else. I haven't changed the code here.

Edit3:
Okay, it works in the default theme but not in the other themes. What do I have to change there?


Edit4:
Muahaha. I love to find out the solution by myself ;D So, for all the other who want to know. It only adds the code to the index.template.php of the default theme, so you have to add the code to the other themes by hand.

<search for>
echo $context['html_headers'], '
</search for>

<add after>
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
var current_header_sb = ', empty($options['collapse_header_sb']) ? 'false' : 'true', ';

function shrinkHeaderSB(mode)
{';

if ($context['user']['is_guest'])
echo '
document.cookie = "upshrinkSB=" + (mode ? 1 : 0);';
else
echo '
smf_setThemeOption("collapse_header_sb", mode ? 1 : 0, null, "', $context['session_id'], '");';

echo '
document.getElementById("upshrink_sb").src = smf_images_url + (mode ? "/expand.gif" : "/collapse.gif");

document.getElementById("upshrinkHeaderSB").style.display = mode ? "none" : "";

current_header_sb = mode;
}
// ]]></script>


But one thing I have to find fault. You shouldn't use different smiley-code for English and German. I have a bilingual board, so this causes that the other language can't see the smilies, only the code.
Main Forum: SMF 2.0.6
Co-Forum: SMF 2.0.6

carola0102

#176
Hi all, I have installed a new theme: chatbubbles
now I could make the shoutbox visible on board index. but I get the following error:

Notice: Undefined index: action in /usr/local/psa/home/vhosts/tamilflowerz.net/httpdocs/forum/Sources/sboxDB.php on line 66

Drea

thanks Kettu  that worked! except no smilies will show, they show in the classic theme but not this one :( hope you can help or someone.

Kettu

Quote from: Drea on June 24, 2006, 12:45:49 PM
thanks Kettu  that worked! except no smilies will show, they show in the classic theme but not this one :( hope you can help or someone.

You also need the changes in the Modification.english.php at the your theme => languages folder

Add before ?>
//SMF Shoutbox
$txt['sbox_ModTitle'] = 'SMF Shoutbox';
$txt['sbox_Visible'] = 'Shoutbox is visible';
$txt['sbox_GuestAllowed'] = 'Guests are allowed to shout';
$txt['sbox_MaxLines'] = 'Maximum number of displayed lines';
$txt['sbox_Height'] = 'Shoutbox height';
$txt['sbox_SmiliesVisible'] = 'Smilie window is visible';
$txt['sbox_smilie01_text'] = 'blblbl!';
$txt['sbox_smilie02_text'] = 'grinning';
$txt['sbox_smilie03_text'] = 'laughing';
$txt['sbox_smilie04_text'] = 'kissing';
$txt['sbox_smilie05_text'] = 'smiling';
$txt['sbox_smilie06_text'] = 'thats okay!';
$txt['sbox_smilie07_text'] = 'smoking';
$txt['sbox_smilie08_text'] = 'greeting';
$txt['sbox_smilie09_text'] = 'cheerio!';
$txt['sbox_smilie10_text'] = 'oops';
$txt['sbox_smilie11_text'] = 'praying';
$txt['sbox_smilie12_text'] = 'crying';
$txt['sbox_smilie13_text'] = 'angry';
$txt['sbox_smilie14_text'] = 'baaaaaad';
$txt['sbox_smilie15_text'] = 'headbanging';
$txt['sbox_smilie01_code'] = ':frech:';
$txt['sbox_smilie02_code'] = ';-)';
$txt['sbox_smilie03_code'] = ':-]';
$txt['sbox_smilie04_code'] = ':-s';
$txt['sbox_smilie05_code'] = ':-)';
$txt['sbox_smilie06_code'] = ':-!';
$txt['sbox_smilie07_code'] = ':smoking:';
$txt['sbox_smilie08_code'] = ':greeting:';
$txt['sbox_smilie09_code'] = ':cheerio:';
$txt['sbox_smilie10_code'] = ':-O';
$txt['sbox_smilie11_code'] = ':praying:';
$txt['sbox_smilie12_code'] = ':crying:';
$txt['sbox_smilie13_code'] = ':-(';
$txt['sbox_smilie14_code'] = ':bad:';
$txt['sbox_smilie15_code'] = ':bang:';
$txt['sbox_smilie01_file'] = 'sbox_funny.gif';
$txt['sbox_smilie02_file'] = 'sbox_grin.gif';
$txt['sbox_smilie03_file'] = 'sbox_laugh.gif';
$txt['sbox_smilie04_file'] = 'sbox_kiss.gif';
$txt['sbox_smilie05_file'] = 'sbox_smile.gif';
$txt['sbox_smilie06_file'] = 'sbox_yeah.gif';
$txt['sbox_smilie07_file'] = 'sbox_smoke.gif';
$txt['sbox_smilie08_file'] = 'sbox_hand.gif';
$txt['sbox_smilie09_file'] = 'sbox_cheerio.gif';
$txt['sbox_smilie10_file'] = 'sbox_oops.gif';
$txt['sbox_smilie11_file'] = 'sbox_church.gif';
$txt['sbox_smilie12_file'] = 'sbox_cry.gif';
$txt['sbox_smilie13_file'] = 'sbox_angry.gif';
$txt['sbox_smilie14_file'] = 'sbox_bad.gif';
$txt['sbox_smilie15_file'] = 'sbox_bang.gif';
$txt['sbox_Monday'] = 'Monday';
$txt['sbox_Tuesday'] = 'Tuesday';
$txt['sbox_Wednesday'] = 'Wednesday';
$txt['sbox_Thurday'] = 'Thurday';
$txt['sbox_Friday'] = 'Friday';
$txt['sbox_Saturday'] = 'Saturday';
$txt['sbox_Sunday'] = 'Sunday';
$txt['sbox_KillShout'] = 'Dou you want to kill this shout?';
$txt['sbox_TextSize1'] = '1. Font size';
$txt['sbox_TextColor1'] = '1. Font color';
$txt['sbox_TextSize2'] = '2. Font size';
$txt['sbox_TextColor2'] = '2. Font color';
$txt['sbox_RefreshTime'] = 'Refresh time';
$txt['sbox_BackgroundColor'] = 'Background color';
$txt['sbox_FontFamily1'] = '1. Font family';
$txt['sbox_FontFamily2'] = '2. Font family';
Main Forum: SMF 2.0.6
Co-Forum: SMF 2.0.6

Drea

GOT It,thanks so much for your help :D

Advertisement: