It stops working because it hits the 'loop limit'. Your code was essentially doing:
PHP Code:
while (true) {
if (keydown(1)) stuff();
}
You would have to use a sleep in the while loop if you want there to be a chance for your keydown condition to change.
You may be right about your logic being out of whack because you probably don't even need to use the conditions that you're specifying. Try this code out:
PHP Code:
//#CLIENTSIDE
function onCreated() {
disabledefmovement();
setTimer(0.05);
}
function onTimeout() {
if (keydown(0)) player.y -= 0.1;
if (keydown(1)) player.x -= 0.1;
if (keydown(2)) player.y += 0.1;
if (keydown(3)) player.x += 0.1;
setTimer(0.05);
}