30.11.2011, 17:24
I don't know what is /color (red,green,yellow...), however maybe you mean this.. as example, using strcmp to compare the params.
if this is not your intent, specify yourself
pawn Код:
CMD:color( playerid, params[] )
{
new s_Color[32];
if ( sscanf( params, "s[32]", s_Color ) ) return SendClientMessage( playerid, -1, "Usage: /color (green, red, yellow, blue)" );
if ( strcmp ( s_Color, "green", true ) == 0 )
{
SendClientMessage( playerid, -1, "you choosed GREEN");
}
if ( strcmp ( s_Color, "red", true ) == 0 )
{
SendClientMessage( playerid, -1, "you choosed RED");
}
if ( strcmp ( s_Color, "yellow", true ) == 0 )
{
SendClientMessage( playerid, -1, "you choosed YELLOW");
}
if ( strcmp ( s_Color, "blue", true ) == 0 )
{
SendClientMessage( playerid, -1, "you choosed BLUE");
}
else // if it's none of above
{
SendClientMessage( playerid, -1, "you didn't choose a correct color.");
}
return 1;
}