SA-MP Forums Archive
Help with ZCMD and sscanf - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help with ZCMD and sscanf (/showthread.php?tid=472625)



Help with ZCMD and sscanf - KlooP - 29.10.2013

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 )


Re: Help with ZCMD and sscanf - DStreet - 29.10.2013

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


Re: Help with ZCMD and sscanf - Konstantinos - 29.10.2013

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;
}



Re: Help with ZCMD and sscanf - Keyhead - 29.10.2013

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;
}



Re: Help with ZCMD and sscanf - KlooP - 29.10.2013

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