SA-MP Forums Archive
A problem about help command with params - 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: A problem about help command with params (/showthread.php?tid=590852)



A problem about help command with params - thefirestate - 04.10.2015

SOLVED!

Okay, so, I am trying to make a /help [section] but I want to make so if you do /help faction it wouldn't show you the available section, only the faction commands. However I cannot get it in mind with my current code it shows the faction commands but it still shows them the section. So, I am asking how can I remove that. Note: THat's just a part of the command but the first lines are what I need help with.

Code:

Код:
CMD:help(playerid, params[])
{
        SCM(playerid, COLOR_GRAY, "/help [Section]");
	SCM(playerid, COLOR_GRAY, "Sections: faction, general, admin, helper, chats, houses, cars");
	if(!strcmp(params, "faction", true))
	{
		if(PlayerInfo[playerid][pFac] == 0) return SCM(playerid, -1, "{CC0000}You are not in a faction.");
		if(PlayerInfo[playerid][pFactionRank] == 10)
		{
			SCM(playerid, -1, "{FFCC33}Faction Leader Commands:");
			SCM(playerid, -1, "{66CCCC}/hire /fire /promote /demote /setfrank");
		}
		if(PlayerInfo[playerid][pFac] == 1)
		{
		    SCM(playerid, -1, "{FFCC33}Faction Commands:");
		    SCM(playerid, -1, "{66CCCC}/cuff /uncuff /m /d /r /issuelicense /revokelicense /mdc /jail /siren");
		    SCM(playerid, -1, "{66CCCC}/ticket /pticket /taser(More to be added soon)");
		}
		if(PlayerInfo[playerid][pFac] == 2)
		{
		    SCM(playerid, -1, "{FFCC33}Faction Commands:");
		    SCM(playerid, -1, "{66CCCC}To be added");
		    SCM(playerid, -1, "{66CCCC}Soon!");
		}
         }
}



Re: A problem about help command with params - d1git - 04.10.2015

PHP код:
CMD:help(playeridparams[])
{
    
SCM(playeridCOLOR_GRAY"/help [Section]");
    
    if(!
strcmp(params"faction"true))
    {
        if(
PlayerInfo[playerid][pFac] == 0) return SCM(playerid, -1"{CC0000}You are not in a faction.");
        if(
PlayerInfo[playerid][pFactionRank] == 10)
        {
            
SCM(playerid, -1"{FFCC33}Faction Leader Commands:");
            
SCM(playerid, -1"{66CCCC}/hire /fire /promote /demote /setfrank");
        }
        if(
PlayerInfo[playerid][pFac] == 1)
        {
            
SCM(playerid, -1"{FFCC33}Faction Commands:");
            
SCM(playerid, -1"{66CCCC}/cuff /uncuff /m /d /r /issuelicense /revokelicense /mdc /jail /siren");
            
SCM(playerid, -1"{66CCCC}/ticket /pticket /taser(More to be added soon)");
        }
        if(
PlayerInfo[playerid][pFac] == 2)
        {
            
SCM(playerid, -1"{FFCC33}Faction Commands:");
            
SCM(playerid, -1"{66CCCC}To be added");
            
SCM(playerid, -1"{66CCCC}Soon!");
        }
    }
    else if(!
strcmp(params"general"true))
    {
        
// Bla bla bla
    
}   
    else return 
SCM(playeridCOLOR_GRAY"Sections: faction, general, admin, helper, chats, houses, cars");




Re: A problem about help command with params - ATGOggy - 04.10.2015

PHP код:
CMD:help(playeridparams[])
{
    if(
isnull(params)
    {
        
SCM(playeridCOLOR_GRAY"/help [Section]");
    
SCM(playeridCOLOR_GRAY"Sections: faction, general, admin, helper, chats, houses, cars");
        return 
1;
    }
    if(!
strcmp(params"faction"true))
    {
        if(
PlayerInfo[playerid][pFac] == 0) return SCM(playerid, -1"{CC0000}You are not in a faction.");
        if(
PlayerInfo[playerid][pFactionRank] == 10)
        {
            
SCM(playerid, -1"{FFCC33}Faction Leader Commands:");
            
SCM(playerid, -1"{66CCCC}/hire /fire /promote /demote /setfrank");
        }
        if(
PlayerInfo[playerid][pFac] == 1)
        {
            
SCM(playerid, -1"{FFCC33}Faction Commands:");
            
SCM(playerid, -1"{66CCCC}/cuff /uncuff /m /d /r /issuelicense /revokelicense /mdc /jail /siren");
            
SCM(playerid, -1"{66CCCC}/ticket /pticket /taser(More to be added soon)");
        }
        if(
PlayerInfo[playerid][pFac] == 2)
        {
            
SCM(playerid, -1"{FFCC33}Faction Commands:");
            
SCM(playerid, -1"{66CCCC}To be added");
            
SCM(playerid, -1"{66CCCC}Soon!");
        }
                else
                {
                     
SCM(playeridCOLOR_GRAY"/help [Section]");
                 
SCM(playeridCOLOR_GRAY"Sections: faction, general, admin, helper, chats, houses, cars");
                     return 
1;
               }
         } 
If you don't have isnull(), get it from ******


Re: A problem about help command with params - thefirestate - 04.10.2015

Yes, ATGOggy, the isnull was what I needed but couldn't get on my mind, finally works . Repped you both althought the other user's command was something I already tried to thank him for his time in at least trying.

Edit: I don't actually have it defined, maybe it is defined in the sscanf2 include but it still works.