

Instructions: save the following code as slap.class.php into src/commands. Don't forget to rehash your chatroom
the class:
- Code: Select all
<?php
require_once(dirname(__FILE__)."/../pfccommand.class.php");
class pfcCommand_slap extends pfcCommand
{
var $usage = "/slap {nick}";
function run(&$xml_reponse, $p)
{
$clientid = $p["clientid"];
$param = $p["param"];
$sender = $p["sender"];
$recipient = $p["recipient"];
$recipientid = $p["recipientid"];
$c =& pfcGlobalConfig::Instance();
$u =& pfcUserConfig::Instance();
if (trim($param) == "")
{
// error
$cmdp = $p;
$cmdp["param"] = _pfc("Missing parameter");
$cmdp["param"] .= " (".$this->usage.")";
$cmd =& pfcCommand::Factory("error");
$cmd->run($xml_reponse, $cmdp);
return;
}
$container =& pfcContainer::Instance();
$msg = phpFreeChat::PreFilterMsg($param);
// concatenated the * in front of the nick 'cause i can't seem to find where in the code that it adds that, like the /me command
$container->write($recipient, "*me*", $this->name, "* ".$u->nick." slaps ".$msg." around a bit with a large trout");
if ($c->debug) pxlog("/slap ".$msg, "chat", $c->getId());
}
}
?>
add this to the css style sheet of your theme (of course, feel free to change color, style and other funky features you want to have on your page)
- Code: Select all
.pfc_cmd_slap{
font-style: italic;
color: black;
}