You have to put the if inside the function:
PHP Code:
function onTimeout(){
onPlayerEnters();
}
function onPlayerChats() {
if (player.chat == "foo") {
//do whatever
}
}
edit: Using the newly implemented function pointers it
may be possible to override the events, no idea if this is possible though, you'd be better off sticking with the above example.
PHP Code:
this.onPlayerEnters = this.onTimeout;