29.11.2014, 05:19
(
Последний раз редактировалось iiNzTicTx; 29.11.2014 в 07:12.
)
Okay, are you using sscanf?
...then to use it:
Sorry, I'm a bit tired.
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.
}
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;
}