ZCMD problem
#1

i am trying to make gang system like this:
/Gang [Options]

there are alot of options and i dont know how to check what a player wrote.
if a player wrote /Gang Create bla, i want to create the gang but if a player wrote
/Gang Invite [id] it makes a problem because i dont know how to check with zcmd and sscanf what the player wrote.
Please Help
Reply
#2

Dont know, if it would be usable for tooo many options.
Usable until options are of same type.

pawn Код:
CMD:gang(playerid,params[])
{
    new
        str[10],
        id;
    if (sscanf(params,"s[10]U(-1)",str,id)) return SendClientMessage(playerid,-1,"Usage : /gang [options]");
    if (strcmp("create",str,true)==0)
    {
        SendClientMessage(playerid,-1,"You used /gang create");
    }
    else if (strcmp("invite",str,true)==0)
    {
        if(id==-1) return SendClientMessage(playerid,-1,"Correct Usage : /gang invite [id]");
        new invite[50];
        format(invite,sizeof(invite),"You have been invited by ID : %d",playerid);
        SendClientMessage(id,-1,invite);
    }
    return 1;
   
}
Reply
#3

Do something like this if you wish to do something like /gang invite [id].

Requires sscanf and zcmd.

pawn Код:
CMD:gang(playerid,params[])
{
    new option[10];
    if(sscanf(params,"s[10])",option)) return SendClientMessage(playerid,-1,"Usage : /gang [options]");
    if(!strcmp(option, "create", true)==0)
    {
        SendClientMessage(playerid,-1,"You used /gang create");
    }
    else if(!strcmp(option, "invite",true)==0)
    {
        new inviteid;
        if(sscanf(params, "s[10]u", option, inviteid)) return SendClientMessage(playerid, -1, "Usage: /gang invite [id]");
        //Do something
    }
    return 1;
}
Reply
#4

Quote:
Originally Posted by Kindred
Посмотреть сообщение
Do something like this if you wish to do something like /gang invite [id].

Requires sscanf and zcmd.

pawn Код:
CMD:gang(playerid,params[])
{
    new option[10];
    if(sscanf(params,"s[10])",option)) return SendClientMessage(playerid,-1,"Usage : /gang [options]");
    if(!strcmp(option, "create", true)==0)
    {
        SendClientMessage(playerid,-1,"You used /gang create");
    }
    else if(!strcmp(option, "invite",true)==0)
    {
        new inviteid;
        if(sscanf(params, "s[10]u", option, inviteid)) return SendClientMessage(playerid, -1, "Usage: /gang invite [id]");
        //Do something
    }
    return 1;
}
yeah it worked.
thank you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)