You should use
PHP Code:
function onKeyPressed(temp.code, temp.key, temp.scan) {
if (keydown(1)) {
player.chat = "Left!";
} else if (keydown(3)) {
player.chat = "Right!";
}
}
It's possible to check the key's code instead, but using
keydown allows you to use the player's defined arrow keys.
There's a list of key numbers for
keydown here.