26.12.2011, 08:58
i'm just wondering, how to do this? I mean a command like: /trunk [store, get, show] [item] [name, amount]
new
action[6], // store is 5 characters long (and the longest word), add another to make it big enough.
item[64], //Assuming that the item parameter is going to be a string/name.
amount //Assuming a number/integer.
;
//Template: sscanf(input_string, format/specifiers, output_variables in order of appearence in specifiers);
sscanf(params, "s[6]s[64]i", action, item, amount);
if( !strcmp(action, "store") )
{
// .. They want to store
}
else if( !strcmp(action, "get") )
{
// .. They want to get
}
else if( !strcmp( action, "show") )
{
// .. They want to show
}
else
{
// .. Unknown action
}
CMD:take(playerid, params[])
{
if(!strlen(params))
{
SendClientMessage(playerid, -1,"Syntax: /take [option]");
SendClientMessage(playerid, -1,"Drugs - Crack - Pot - Money");
}
else if(strcmp(params,"drugs",true) == 0)
{
}
else if(strcmp(params,"crack",true) == 0)
{
}
else if(strcmp(params,"pot",true) == 0)
{
}
else if(strcmp(params,"money",true) == 0)
{
}
return 1;
}