You need continuously to check the players position in a loop to see if they are within the bounds of the block. If you are looking to do it clientside...
PHP Code:
//#CLIENTSIDE
function onCreated() {
setImg("block.png");
onTimeout(); // probably better than setting a timer here as you might not want to wait a second before checking
}
function onTimeout() {
// assuming that your block's dimensions are 2x2
if (player.x in |this.x, this.x + 2| && player.y in |this.y, this.y + 2|) {
//destroy or hide the block or whatever you want to do
} else {
setTimer(.05); // or higher if it doesn't need to be so accurate
}
}
If you want to do it serverside you'll have to loop through the players array in your timeout and check if any of them are within the bounds of the block.