You don't need an if statement, just use a timeout.
PHP Code:
function onCreated() {
onTimeout();
}
function onTimeout() {
this.chat = "Message1";
sleep(3);
this.chat = "Message2";
setTimer(3);
}
I'm pretty sure you've been told this before but use 2 equal signs instead of one when you're comparing values. I.e.
if (this.variable == 1) { // stuff