PDA

View Full Version : Chat Integration Mod



JordanD
12-26-2011, 07:31 PM
I already posted this on the official ezrpg forums, but I decided to post it here as well so that more people have access to it. It's not a real mod written from ground up, but basically a tutorial on how to integrate the phpFreeChat script into your ezrpg game.

Step 1: Download phpFreeChat from their website: http://www.phpfreechat.net

Step 2: Upload it to your host. My script assumes that you uploaded it to the folder at /phpfreechat-1.3/ so if you have it in a folder called something else or have it inside a few folders, then you will have to change the "require_once" line of code.

Step 3: Go to your modules folder and create a new folder in it called Chat and inside it create a php file called index.php. Then copy and paste the following code into that file:



<?php
defined('IN_EZRPG') or exit;

class Module_Chat extends Base_Module
{
public function start()
{
requireLogin();

require_once ($_SERVER['DOCUMENT_ROOT']). "/phpfreechat-1.3/src/phpfreechat.class.php";
$params = array();
$params["title"] = "Chat";
$params["nick"] = $this->player->username;
$params['firstisadmin'] = false;
$params["serverid"] = md5(__FILE__);
$params["debug"] = false;
$chat = new phpFreeChat( $params );

$this->tpl->display('header.tpl');
$chat->printChat();
$this->tpl->display('footer.tpl');

}
}
?>


Step 4: Customize the script and add parameters as you see fit. I recommend adding the line $params["frozen_nick"] = true; after the last $params line so that your players can't change their chat nickname to something other than their username in the game. There are lot of other parameters, features, and ways to customize it so check out the phpFreeChat site for more info on this.

Step 5: Put a link somewhere in your header.tpl file or anywhere else that links to index.php?mod=Chat

If anyone has any questions or comments, please post them and I'll try to answer them. Enjoy!

boots
01-11-2012, 11:56 AM
cant even find a modules folder ??

JordanD
01-13-2012, 06:28 AM
Are you using the ezrpg engine? If so, there should be a modules folder if you have installed it correctly.

djpredator69
08-09-2012, 09:57 PM
i have a problem
i see on my site only loading nothing more

if i use iframe it works why?