How can I do a command with params using YCMD?
#5

Quote:
Originally Posted by CalvinC
Посмотреть сообщение
No need to use sscanf if you just have 1 string parameter, you can just use strcmp.
pawn Код:
YCMD:meslek(playerid, params[], help)
{
    if(isnull(params)) return SendClientMessage(playerid, -1, "<KULLANIM> /meslek [olustur/duzenle/sil/git]");
    if(!strcmp(params, "olustur", true))
    {
        // Code
    }
    else if(!strcmp(params, "duzenle", true))
    {
        // Code
    }
    else if(!strcmp(params, "sil", true))
    {
        // Code
    }
    else if(!strcmp(params, "gil", true))
    {
        // Code
    }
    return 1;
}
Params is the text you write after the cmd, like "/meslek [params]".
So strcmp just compares the "params" with the other text we provide, like "gil", and check if it's the same.
So if "params" is "gil", then it will activate the code below that.

But if you want to have several parameters, like "/meslek [params] [more params]", then you need to use sscanf.
Thank you very much. Rep added.
Reply


Messages In This Thread
How can I do a command with params using YCMD? - by WhoIsYourDaddy - 28.02.2015, 10:17
Re: How can I do a command with params using YCMD? - by AroseKhanNiazi - 28.02.2015, 10:51
Re: How can I do a command with params using YCMD? - by WhoIsYourDaddy - 28.02.2015, 11:16
Re: How can I do a command with params using YCMD? - by CalvinC - 28.02.2015, 11:22
Re: How can I do a command with params using YCMD? - by WhoIsYourDaddy - 28.02.2015, 11:23

Forum Jump:


Users browsing this thread: 1 Guest(s)