You may also be interested in making this a bit more flexible using arrays.
PHP Code:
//#CLIENTSIDE
function onCreated() {
// Create an array with a value for each message desired
this.messages = {
"message one!",
"message two!",
"message three!",
"message four!"
};
// Initiate the timeout loop
onTimeout();
}
function onTimeout() {
// Loop through each item in this.messages array
// for (var : array) will loop through 'array' and execute the code for each value
for (temp.i : this.messages) {
player.chat = temp.i;
sleep(3);
}
// Restart the loop
setTimer(3);
}
With such an approach all you'd have to do is add more messages to the array to create a larger loop.