Thread: Chat Modifications - VSa - ChatBox (AJAX)
View Single Post
  #2039  
Old 12-19-2011, 09:14 PM
Hippy's Avatar
Hippy Hippy is offline
 
Join Date: Dec 2001
Location: USA, New Jersey
Posts: 2,392
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by geckoz View Post
I wish there would be a chat bot with pre-defined messages getting posted every x minutes.
Somebody can do this?
there are a few out there if you use downloadII there is one ..
if you use ibproarcade
you can do this..


You need to have VSa - Chatbox & ibproarcade installed.

Now create a new bbcode called 'siteurl' with the code
<a href="{option}">{param}</a>
(This makes the game link in the chatbox open in the same window rather than a new one)
Code:
Title = siteurl
BB Code Tag Name = siteurl
Replacement = <a href="{option}">{param}</a>
Example = [siteurl=http://www.example.com]Example Web Site[/siteurl]
Decription = This open site urls in the same window rather than the default target="_blank"
Use {option} = Yes
Button Image (Optional) = Leave Blank
Remove Tag If Empty = Yes
Disable BB Code Within This BB Code = No
Disable Smilies Within This BB Code = Yes
Disable Word Wrapping Within This BB Code = Yes



Ok Now open your root arcade.php file and find
PHP Code:
                        // finally update Highscore-Table
                        
if ( ($this->arcade->user['id'] != 0) && ($player_score <> 0) )
                        {
                                                
$DB->query("UPDATE ibf_games_champs SET ".$db_string." WHERE champ_gid=".$gid);
                            
$ginfo['champ_mid'] = $this->arcade->user['id'];
                            
$ginfo['champ_name'] = $this->arcade->user['name'];
                            
$ginfo['champ_score'] = $player_score

Add after
PHP Code:
// Insert New Chatbox Message
$DB->query("SELECT c.*, g.gcat, cat.password FROM ibf_games_champs AS c, ibf_games_list AS g, ibf_games_cats AS cat WHERE c.champ_gid=g.gid AND g.gcat=cat.c_id AND g.active=1 AND trim(password)='' ORDER BY champ_date DESC LIMIT 0,1");
while( 
$row $DB->fetch_row() )
        {
            
$newchattxt .= "[color=green]".$row['champ_name']." set a new high score of ".$row['champ_score']." in [/color][siteurl=http://".$_SERVER['SERVER_NAME']."/arcade.php?do=play&gameid=".$row['champ_gid']."]".$row['champ_gtitle']."[/siteurl]";
                    
$vbulletin->db->query_write("
                        INSERT INTO "
.TABLE_PREFIX."vsa_chatbox
                            (userid, userip, message, dateline, textprop)
                        VALUES ('42', '"
.$_SERVER['REMOTE_ADDR']."', '".$newchattxt."', ".TIMENOW.", '')
                    "
);
        }
// End insert 
Then Find

PHP Code:
                    if ($player_score <> 0)     // no champ with no result ...
                    
{
                                
$DB->query("INSERT INTO ibf_games_champs (" .$db_string['FIELD_NAMES']. ") VALUES ("$db_string['FIELD_VALUES'] .")");
                        
$ginfo['champ_mid'] = $this->arcade->user['id'];
                        
$ginfo['champ_name'] = $this->arcade->user['name'];
                        
$ginfo['champ_score'] = $player_score
Add after
PHP Code:
// Insert New Chatbox Message
$DB->query("SELECT c.*, g.gcat, cat.password FROM ibf_games_champs AS c, ibf_games_list AS g, ibf_games_cats AS cat WHERE c.champ_gid=g.gid AND g.gcat=cat.c_id AND g.active=1 AND trim(password)='' ORDER BY champ_date DESC LIMIT 0,1");
while( 
$row $DB->fetch_row() )
        {
            
$newchattxt .= "[color=green]".$row['champ_name']." set a new high score of ".$row['champ_score']." in [/color][siteurl=http://".$_SERVER['SERVER_NAME']."/arcade.php?do=play&gameid=".$row['champ_gid']."]".$row['champ_gtitle']."[/siteurl]";
                    
$vbulletin->db->query_write("
                        INSERT INTO "
.TABLE_PREFIX."vsa_chatbox
                            (userid, userip, message, dateline, textprop)
                        VALUES ('42', '"
.$_SERVER['REMOTE_ADDR']."', '".$newchattxt."', ".TIMENOW.", '')
                    "
);
        }
// End insert 
example
Change BOTH INSTANCES of 42 in the above code to the value of the userid of the users name you wish to appear in the chatbox. I have a user with id 42 called spam_master who does all the arcade shouting for this addon.



this code was writen by someone here @vb.org
but it was never posted as a mod.. so it's lost ATM
I keep the code on hand .. when I seen it
I forget who wrote it ..
If I find it I will give 100% credit to him for this great addition
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01262 seconds
  • Memory Usage 1,843KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code
  • (4)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete