Params
#2

I don't know what is /color (red,green,yellow...), however maybe you mean this.. as example, using strcmp to compare the params.
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;
}
if this is not your intent, specify yourself
Reply


Messages In This Thread
Params - by wumpyc - 30.11.2011, 17:15
Re: Params - by admantis - 30.11.2011, 17:24
Re: Params - by Unte99 - 30.11.2011, 17:42
Re: Params - by MP2 - 30.11.2011, 17:45

Forum Jump:


Users browsing this thread: 1 Guest(s)