This is quite sloppy coding style, you should use proper indentation, use brackets, and use `==`, i.e.

    if (global.mouselock == 1)
        mouseLock = false;
    else if (global.mouselock == 0)

Also, this suggests you haven't tested the code at all, because I'm pretty sure there needs to be a statement following this `else if` clause.