This is going to be quick response. :Unot OP, but this is interesting. might do something similar on Venith (a site i am going to make)
Basically, in your database, you're going to need to have a field that identifies the type of chat post being made:
<span style="font-weight:bold">
Field info:
name: post_type
fielset: varchar(10)
default: regular
</span>
When inserting the "/warn" post in the database, naturally set the field "post_type" to "warn".
Then, when outputting data from the database, you simply use PHP to check what type of post it is, and then use Regular Expressions (or in this case, just the "explode()" function) to do what Hull does in the chatrooms here:
<span style="font-weight:bold">
switch($post_type){
//$chat_post is equal to "/warn [Username] [Message]"
case "warn":
$exp = (substr_count($chat_post, " ") == 2) ? explode(" ", $chat_post, 2) : explode(" ", $chat_post, 1);
$user = $exp[1];
if(substr_count($chat_post, " ") == 2){
$warn_msg = "- " . $exp[2];
}
//In the quotation marks above is a space character
echo <<<WARN
<div class="chat_post warn_post">!- WARNING $user $warn_msg -!</div>
WARN;
break;
}
</span>
Something like that should work, though I'm too busy to type a more concise example. :U