07.08.2013, 09:04
How to make command with two string arguments?
Example:
--------STRING1 --- STRING2
/test1 simple_test Long long test......
Example:
--------STRING1 --- STRING2
/test1 simple_test Long long test......
command(words, playerid, params[])
{
if(IsPlayerConnected(playerid))
{
new string[128], word[2][32];
if(sscanf(params, "s[32]s[32]", word[0], word[1])) return SendClientMessage(playerid, -1, "Usage: /words <word1> <word2>");
if(!strlen(word[0]) || !strlen(word[1])) return SendClientMessage(playerid, -1, "No words typed!");
format(string, sizeof(string), "Your words are: %s and %s.", word[0], word[1]);
SendClientMessage(playerid, -1, string);
}
return 1;
}
CMD:test(playerid, params[])
{
new
str01[32],
str02[32];
if(!sscanf(params, "s[32]s[32]", str01, str02))
{
//Your code
}
else
{
SendClientMessage(playerid, -1, "Usage: /test <string1> <string2>");
}
return 1;
}