pausegame on/off

If I have a button to pause/unpause the game and I pause it, i can“t unpause it.
How does it works?

How does it works?

switch(ispaused){
case 0:
ispaused=1;
animpos=1;
CreateTimer("Event Actor", "1", 50);
break;
case 1:
PauseGameOff();
ispaused=0;
animpos=0;
break;
}
PauseGameOn();