/help command.
#1

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!
Reply
#2

I would recommand using Y_Commands for this.Here
Reply
#3

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

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
Reply
#5

It worked! Thanks. +rep
Reply
#6

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.
Reply
#7

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.
Reply
#8

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.
Reply
#9

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
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)