try something like
PHP Code:
function onCreated(){
this.prefix = "what chat should start with";
}
function onPlayerChats(){
if(player.chat.starts(this.prefix)){
switch(player.chat.substring(this.prefix.length())){
case "test": break;
case default : break;
}
}
}