Help with ZCMD and sscanf
#1

Hello everyone! So how you see I need some help. This is my code:

Код:
COMMAND:help(playerid,params[], gangs, race)
{
	if(sscanf(params,"s",params)) return ShowPlayerDialog(playerid , 1 , DIALOG_STYLE_MSGBOX , "Commands" , "Bla bla" , "Good" , "" );
	if(gangs) {
	new string[1024];
        strcat(string,"Here will be long text..");
	ShowPlayerDialog(playerid,2,DIALOG_STYLE_MSGBOX,"Gangs commands",string,"Good","");
	return 1;
	}
 	
	if(race)
 	{
	new string[1024];
        strcat(string,"Here will be long text..");
	ShowPlayerDialog(playerid,3,DIALOG_STYLE_MSGBOX,"Race commands",string,"Good","");
        return 1;
 	}
 	
	return 1;
}
So yes, when I write "/help", I see first dialog, when I write "/help gangs" I see gangs dialog, but when I write "/help race" I see gangs dialog too. So this is the problem. Waiting for help! Thanks )
Reply
#2

Why not write two different commands? such as /helpgangs and /helprace, and your /help command something like so
Код:
CMD:help(playerid, params[])
{
    SendClientMessage(playerid, COLOR_WHITE, "||Your Sever Help Commands||");
    SendClientMessage(playerid, COLOR_WHITE, "/helpgang /helprace");
    return 1;
}
Your choice in the end of it all
Reply
#3

pawn Код:
COMMAND:help(playerid,params[])
{
    if(isnull(params)) ShowPlayerDialog(playerid , 1 , DIALOG_STYLE_MSGBOX , "Commands" , "Bla bla" , "Good" , "" );
    else
    {
        if(!strcmp(params, "gangs", true))
        {
            new string[1024];
            strcat(string,"Here will be long text..");
            ShowPlayerDialog(playerid,2,DIALOG_STYLE_MSGBOX,"Gangs commands",string,"Good","");
        }
        else if(!strcmp(params, "race", true))
        {
            new string[1024];
            strcat(string,"Here will be long text..");
            ShowPlayerDialog(playerid,3,DIALOG_STYLE_MSGBOX,"Race commands",string,"Good","");
        }
    }
    return 1;
}
Reply
#4

I'd of personally done the 3 different commands.

pawn Код:
CMD:help(playerid, params[])
{
    ShowPlayerDialog(playerid , 1 , DIALOG_STYLE_MSGBOX , "Commands" , "/ganghelp, /racehelp" , "Good" , "" );
    return 1;
}

CMD:ganghelp(playerid, params[])
{
    ShowPlayerDialog(playerid,2,DIALOG_STYLE_MSGBOX,"Gangs commands","Gang1 - Gang2 - Gang3\nGang4 - Gang5 - Gang6","Good","");
    return 1;
}

CMD:racehelp(playerid, params[])
{
    ShowPlayerDialog(playerid,3,DIALOG_STYLE_MSGBOX,"Race commands","Race1 - Race2 - Race3\nRace4 - Race5 - Race6","Good","");
    return 1;
}
Reply
#5

Thank you Konstantinos for help.
Keyhead, Dstreet thank you for ideas, but I needed what I asked ^^
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)