Requesting help regarding simple gate
#1

I am looking for assistance on how to script a gate (I am an somewhat unfamiliar with scripting but trying to learn) which opens and closes with the same command - for example - /gate to open AND /gate to close. I have managed to learn enough to get gates to work with an open and close command but I have seen gate toggles with only one command on servers and I want to learn the method.

If anyone is willing to assist me I would appreciate it a lot. Thanks.
Reply
#2

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;
    }
}
Reply
#3

Thank you Nero_3D.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)