25.11.2012, 16:22
hi
can any one show me an example of a command like this /craft [option1/option2]
can any one show me an example of a command like this /craft [option1/option2]
CMD:yourcmd(playerid, params[])
{
new choice[32];
if(sscanf(params, "s[32]", choice))
{
SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /yourcmd [name]");
SendClientMessageEx(playerid, COLOR_GREY, "Available names: optinon1, option2");
return 1;
}
if(strcmp(choice, "option1", true) == 0)
{
// Your code
return 1;
}
else if(strcmp(choice, "option2", true) == 0)
{
// Your code
return 1;
}
return 1;
}
if(strcmp(cmd, "/craft", true) == 0) |
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmd, "/yourcommand", true) == 0)
{
new choice[32];
if(sscanf(params, "s[32]", choice))
{
SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /yourcmd [name]");
SendClientMessageEx(playerid, COLOR_GREY, "Available names: optinon1, option2");
return 1;
}
if(strcmp(choice, "option1", true) == 0)
{
// Your code
return 1;
}
else if(strcmp(choice, "option2", true) == 0)
{
// Your code
return 1;
}
return 1;
}
return 0;
}
Yes,
pawn Код:
|