Well what you need to do is limit the angle the object the camera is attached to can rotate.
You will need to add something like:
if object angle x(2) >90 then xRotate Object 2,90
if object angle x(2) <-90 then xRotate Object 2,-90
In the moveplayer() function
so the first few commands of the function will be:
yrotate object 2,object angle y(2)+mousemovex()/3.0
xrotate object 2,object angle x(2)+mousemovey()/3.0
if object angle x(2) >90 then xRotate Object 2,90
if object angle x(2) <-90 then xRotate Object 2,-90
oldx# = object position x(2)
oldy# = object position y(2)
oldz# = object position z(2)
See what I mean?
Nothing to see here, move along please.