SA-MP Forums Archive
/help command. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /help command. (/showthread.php?tid=340758)



/help command. - iGetty - 08.05.2012

I've been away from scripting for some time and I've come back and realised.. I've forgot something.

I want to have /help [section]

How can I have it?

EG:

/help account

or

/help map

How can I make it with sscanf?

Thanks!


Re: /help command. - HDFord - 08.05.2012

I would recommand using Y_Commands for this.Here


Re: /help command. - iGetty - 08.05.2012

I didn't ask that.. I asked how to do it.


Re: /help command. - doreto - 08.05.2012

but tested but didnt give any error when i compile test and tell me * hope i help you
pawn Код:
CMD:help(playerid, params[])
{
    if(isnull(params))return SendClientMessage(playerid, -1, "* Type: /help [account/map/ect]");

    if(!strcmp(params, "account", true))
    {
        SendClientMessage(playerid, -1, "You're account code");
    }

    if(!strcmp(params, "map", true))
    {
        SendClientMessage(playerid, -1, "You're map code");
    }
    return true;
}
If I have helped you click on



Re: /help command. - iGetty - 08.05.2012

It worked! Thanks. +rep


Re: /help command. - Kindred - 08.05.2012

If, by any chance, you are looking for another one using sscanf, here's an example:

pawn Код:
CMD:help(playerid, params[])
{
    new option;
    if(sscanf(params, "s", option)) return SendClientMessage(playerid, -1, "Usage: /help <account/map>");
   
    if(strcmp(name,"account",false)==0)
    {
        //Account code
    }
    if(strcmp(name,"map",false)==0)
    {
        //map code
    }
    else return SendClientMessage(playerid, -1, "Invalid option!");
    return 1;
}
Simple enough, I suppose. No use explaining it, it's kinda self explanatory as long as you know the basics of scripting.


Re: /help command. - 2KY - 08.05.2012

Quote:
Originally Posted by Kindred
Посмотреть сообщение
If, by any chance, you are looking for another one using sscanf, here's an example:

pawn Код:
CMD:help(playerid, params[])
{
    new option;
    if(sscanf(params, "s", option)) return SendClientMessage(playerid, -1, "Usage: /help <account/map>");
   
    if(strcmp(name,"account",false)==0)
    {
        //Account code
    }
    if(strcmp(name,"map",false)==0)
    {
        //map code
    }
    else return SendClientMessage(playerid, -1, "Invalid option!");
    return 1;
}
Simple enough, I suppose. No use explaining it, it's kinda self explanatory as long as you know the basics of scripting.
That would not work. You didn't specify 'option' as a string, and didn't specify it in the sscanf code.

pawn Код:
new option[32];
if(sscanf(params, "s[32]", option))
Is what you should have done.


Re: /help command. - Slix_ - 08.05.2012

Quote:
Originally Posted by 2KY
Посмотреть сообщение
That would not work. You didn't specify 'option' as a string, and didn't specify it in the sscanf code.

pawn Код:
new option[32];
if(sscanf(params, "s[32]", option))
Is what you should have done.
Not really required, my script is filled of these without the [32] or [size] tags, it is not required in my opinion.


Re: /help command. - Jonny5 - 08.05.2012

Quote:
Originally Posted by Skavanovski
Посмотреть сообщение
Not really required, my script is filled of these without the [32] or [size] tags, it is not required in my opinion.
your using an old version of sscanf because it IS required in the 2.6 version


Re: /help command. - 2KY - 08.05.2012

Quote:
Originally Posted by Skavanovski
Посмотреть сообщение
Not really required, my script is filled of these without the [32] or [size] tags, it is not required in my opinion.
Try updating to 2.6 and be dazzled by the millions of errors.

Quote:
Originally Posted by Kindred
Посмотреть сообщение
Yup, sorry, forgot about that. Ain't doing much with scripting these days.

Plus, I understand the specifying it as a string, but I see no need to specify it IN the sscanf code ((the [size] part)). Never in my life have I done this and my sscanf scripts work perfectly.
If you look at most sscanf examples, the majority of us are doing it. As to the technical details on it, I have no idea.