"Sub Commands" in ZCMD
#4

Код:
CMD:house(playerid, params[]) {
    new param[20], modi[20], modi2[20], modi3[20];
    if (sscanf(params, "szzz", param, modi))
    {
        if (!IsPlayerAdmin(playerid)) return SCM(playerid, COLOR_RED, "USAGE: /(h)ouse [buy | sell]");
        else return SCM(playerid, COLOR_RED, "USAGE: /(h)ouse [create | setowner | delowner | delete | buy | sell]");
    }
    if (strcmp(param, "create", true) == 0)
    {
        if(strlen(modi) == 0 || strlen(modi2) == 0 || strlen(modi3) == 0) return SCM(playerid, 0xFFFFFFFF, "You have to enter X Y Z coordinates in the "create" parameter.
        if (PlayerInfo[playerid][pInHouse] == -1) return SCM(playerid, COLOR_RED, "You have to be inside an house.");
        // sscanf for other params NOT needed anymore.
    }
    return 1;
}
You have to use the "z" value here as you only want posx, posy, posz on several commands and not on "delete" for example.
You then have to use "szzz" and ask inside your "create" part:

Код:
if(strlen(modi) == 0 || strlen(modi2) == 0 || strlen(modi3) == 0) return SCM(playerid, 0xFFFFFFFF, "You have to enter X Y Z coordinates in the "create" parameter.
I guess that's what you mean. if you use "s" instead of "z", it will force you to type "delete x y z" too.
Reply


Messages In This Thread
"Sub Commands" in ZCMD - by Verbal - 16.05.2012, 17:31
Re: "Sub Commands" in ZCMD - by iRage - 16.05.2012, 17:39
Re: "Sub Commands" in ZCMD - by Verbal - 16.05.2012, 17:40
AW: "Sub Commands" in ZCMD - by EthanR - 16.05.2012, 17:43
Re: "Sub Commands" in ZCMD - by iRage - 16.05.2012, 17:43
Re: "Sub Commands" in ZCMD - by mprofitt - 16.05.2012, 17:46
Re: "Sub Commands" in ZCMD - by Verbal - 16.05.2012, 19:17

Forum Jump:


Users browsing this thread: 1 Guest(s)