command help
#4

Quote:
Originally Posted by JawsPlus
Посмотреть сообщение
i dont understands
Okay, are you using sscanf?
pawn Код:
new string[64]; //defines a string with 64 slots.
new integer; //defines a blank variable with 1 slot.
if(sscanf(params, "is[64]", integer, string)) //params, is parameter (i.e: /command [parameter 1] [parameter 2].
                                //"is[64]", defines the slopes: integer is 'i', string is 's', with 64 slots.
                                // integer and variable, are the variables that were defined.
                                //sscanf is the function which handles it all (simple words).
{
     SendClientMessage(playerid, -1, "ERROR......[parameter 1] [parameter 2]"); //Filter out when invalid parameters don't exist.
}
...then to use it:

pawn Код:
COMMAND:command(playerid, params[])
{
    new string[64];
    new integer;
    if(sscanf(params, "is[64]", integer, string)) //sscanf function is called (called it this for simple explaining).
    {
        SendClientMessage(playerid, -1, "ERROR......[parameter 1] [parameter 2]");
    }
    if(integer == 1) //parameter 1, as it comes FIRST in the sscanf function.
    {
        SendClientMessage(playerid, -1, "You have entered an int of 1, as parameter 1!");
    }
    if(string) //parameter 2, as it comes SECOND in the sscanf function.
    {
        SendClientMessage(playerid, -1, "There is a valid string as parameter 2!");
    }
    return 1;
}
Sorry, I'm a bit tired.
Reply


Messages In This Thread
command help - by JawsPlus - 29.11.2014, 05:04
Re: command help - by iiNzTicTx - 29.11.2014, 05:09
Re: command help - by JawsPlus - 29.11.2014, 05:10
Re: command help - by iiNzTicTx - 29.11.2014, 05:19
Re: command help - by JawsPlus - 29.11.2014, 05:51
Re: command help - by iiNzTicTx - 29.11.2014, 05:59
Re: command help - by JawsPlus - 29.11.2014, 06:08
Re: command help - by Galletziz - 29.11.2014, 06:16
Re: command help - by JawsPlus - 29.11.2014, 06:28
Re: command help - by iiNzTicTx - 29.11.2014, 06:36

Forum Jump:


Users browsing this thread: 1 Guest(s)