Use if/then like this
if a = 0 then a = 2
or
if a = 0
a = 2
endif
In your code you have an if/then with notheing after the then
if msg$ = "menu 2" and mouseclick()=1 then
I think what you want to do is this
rem kolizja srodek
sav:
if sprite hit(1,3)then msg$ = "menu 2"
if msg$ = "menu 2" and mouseclick()=1
IF file exist("Savegame.sav") = 1 THEN DELETE FILE "Savegame.sav"
OPEN TO WRITE 1,"Savegame.sav"
WRITE long 1,X#
WRITE long 1,Y#
WRITE long 1,Z#
WRITE long 1,g#
WRITE long 1,s#
WRITE long 1,a#
WRITE long 1,dist#
WRITE long 1,height#
WRITE long 1,smooth
close file 1
endif
you ain't the cops