else if(strcmp(params, "setname", true, 7))
{
new teamid = strval(params[8]);
// now from here how would i add another param which will be used as a string to set the team name?
dcmd_team(playerid, params[])
{
new option[24], extra[64]
if (sscanf(params, "sz", option, extra)) SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /team [option] [params]");
else if (!strcmp(option, "setname", true))
{
teamname = extra;
}
else if (...
dcmd_team(playerid, params[])
{
new option[24],option2[24], extra[64]
if (sscanf(params, "sz", option,option2, extra)) SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /team [option] [option2] [params]");
else if (!strcmp(option, "setname", true))
{
teamname = extra;
}
else if (...
dcmd_yourcommand(playerid,params)
{
new variablea, variableb, variablec;
if(sscanf(params, "sss"/*or whatever */, variablea, variableb, variablec)) SendClientMessage(playerid, COLOR_WHITE, "Usage:whatever");
if(strcmp(variablea, // insert here a string, true) == 0)
{
// code to compare variableb and variablec
}
if(strcmp(variablea, // insert here a string, true) == 0)
{
// code to compare variableb and variablec
}
return 1;
}
else if(strcmp(params, "setname", true, 7))
{
//first of all we need to check if two params exists
new idx = strfind(params, " ", true, 8);
if(idx == -1 || params[idx + 1] == EOS)
return SendClientMessage(playerid, 0xFFFFFFAA, "Right Usage: /team setname [teamid] [name]");
params[idx] = EOS, idx++;
new teamid = strval(params[8]);
// now we got all what we need, example usage
new string[128];
format(string, sizeof string, "You typed /team setname %d %s", teamid, params[idx]);
return SendClientMessage(playerid, 0xFFFFFFAA, string);
}
Originally Posted by Outbreak
Without using sscanf....
I'm not a great fan of it. |