Basically, in your database, you're going to need to have a field that identifies the type of chat post being made:
Field info:
name: post_type
fielset: varchar(10)
default: regular
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:
switch($post_type){
//$chat_post is equal to "/warn [Username] [Message]"
Well uh all you really gotta do is check if / is the first character then get rid of the /warn(space) and then use explode to separate the name and reason which is like that but explaining it more