ZCMD question... [newbie]
#1

Hey guys, I just started working with ZCMD and SSCANF, I dont get one thing. How do I for example do this inside the ZCMD.

Код:
if(strcmp(cmd, "/door", true) == 0)

if(strcmp(x_nr,"open",true) == 0)
I want to learn how to do the x_nr part inside the ZCMD, or is it possible to use same method?
Reply
#2

The params[] in zcmd isn't there for show, it's the value that represents the string a player typed in.
pawn Код:
CMD:door(playerid, params[])
{
    if(!strcmp(params, "open", true)) {
        // code if they typed open
        return 1;
    }

    else if (!strcmp(params, "close", true)) {
        // code if they typed close
        return 1;
    }

    else {
        SendClientMessage(playerid, -1, "USAGE: /door [open or close]");
    }
    return 1;
}
ofc, you can optimize it with isnull(), but I just wanted to get the point across
Reply
#3

Ah thanks mate I'll test it out
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)