Added 18 minutes later
Oh, I solved the problem by replacing "if" with "elseif." When I was looking for a solution to the first error, I fixed it, but I forgot to revert the change! Now, the question is still related to the topic – there are no more errors, everything loads, but when the conditions are met, nothing happens...