Like Silent said, your if statement is syntactically correct. Shouldn't be an issue there. What statement(s) follow your if statement? Also, where is this if statement? If I recall correctly, if statements enclosed in for-loops or switch-case structures can cause issues. Maybe it's vice versa. But anyways my experience just tells me to avoid that kind of control flow, especially if your if statement is using braces to enclose more than one expression.
And do the statements enclosed following your if statement fail to execute? Also, try adding a debug message to show you the value of the local variable "gamestate". To concatenate, just use the + operator between the string and GetLocalVarInt("gamestate"). It's one of the rare few implicit conversions we are allowed to do without the compiler throwing a fit.
By the way. What does ProgLog do? I've NEVER used it and the documentation on it is skint. I usually use Print or AddDebugMessage