Jump to content
MakeWebGames

Chat Integration Mod


JordanD

Recommended Posts

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!

Link to comment
Share on other sites

  • 3 weeks later...
  • 6 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...