18.08.2013, 00:44
It isn't complicated, they just used a flag to see if the gate is opened or closed and executed the right code
pawn Код:
if(strcmp(cmdtext, "/gate", true) == 0) {
static // local static variables hold their value after the function finished
bool: gateOpened = false
;
if(gateOpened) {
// if its opened execute the closing code
gateOpened = false;
} else {
// if it isn't opend execute the opening code
gateOpened = true;
}
}