Well, it looks like you want a guard to follow waypoints until he/she sees the plr and then the game ends.
in your state=0, line two... you need to remove the letter i from your rotatey=180 command.
If your guard is following the waypoints but wont stop when the player is in sight, it may be because you don't tell it to.
you may need a line like this:
:plrcanbeseen=50:state=2
**Also, to have the game quit like this would make someone think your game crashed. I strongly suggest you add an image to tell the player they've been spotted by a guard and the game is over. You can do this very easily by using a command like this:
:state=2:video="image directory here",quitgame
I hope this info helps, good luck!