Maybe there's a way to store the reference to the player? I don't know exactly how it is done on graal, but something amongst the lines...
PHP Code:
function onPlayerEnters(eventPlayer) {
testFunc(eventPlayer);
}
function testFunc(player) {
for (temp.i=1;temp.i<4;temp.i++){
player.sendrpgmessage(temp.i);
sleep(1);
}
}