/Help command.
#1

How can I make a /help command where you would type this:

/help account

And if I wanted a few different sections, how could I do it?, thanks.
Reply
#2

ZCMD Example:

pawn Код:
CMD:help(playerid, params[])
{
    new text[32];
    if(sscanf(params,"s[32]",text)) return SendClientMessage(playerid, -1, "Usage: /help [Category]");
    if (strfind("ACCOUNT", text, true) != -1)
    {
        SendClientMessage(playerid, -1, "Account Help:");
    }
    else if (strfind("GAMEPLAY", text, true) != -1)
    {
        SendClientMessage(playerid, -1, "Gameplay Help:");
    }
    else if (strfind("COMMANDS", text, true) != -1)
    {
        SendClientMessage(playerid, -1, "Commands:");
    }
    //And So on...
    return true;
}
Reply
#3

Another Ex :


Код:
	if(strcmp(cmd, "/help", true) == 0) 
 	{
		if(IsPlayerConnected(playerid))
        {
   			new x_nr[256];
         	x_nr = strtok(cmdtext, idx);
          	if(!strlen(x_nr))
           	{
                SendClientMessage(playerid, -1, ""#COL_PINK"Welcome to the help menu! "#COL_WHITE"Type '/help subject' for more info!");
                SendClientMessage(playerid, -1, ""#COL_PINK"Newbie	- "#COL_WHITE"What to do when your first get on Next Evolution Roleplay.");
                SendClientMessage(playerid, -1, ""#COL_PINK"Rules	- "#COL_WHITE"Tells you a few basic server rules.");
                SendClientMessage(playerid, -1, ""#COL_PINK"Chat	- "#COL_WHITE"Talking in person, or on the phone.");
                SendClientMessage(playerid, -1, ""#COL_PINK"Jobs	- "#COL_WHITE"Things you can do around Los Santos.");
				return 1;
    		}
			if(strcmp(x_nr,"Newbie",true) == 0)
			{
                SendClientMessage(playerid, -1, ""#COL_PINK"Are you new on NE-RP ? "#COL_WHITE"Here are some useful topics:");
				SendClientMessage(playerid, COLOR_WHITE, "Type '/help topic' (death, phone, jobs, money, rules)");
				SendClientMessage(playerid, COLOR_WHITE, "Type '/help topic' (about, getstarted, roleplay, chat)");
			    SendClientMessage(playerid, COLOR_PINK,"____________________________________________________________________");
				return 1;
			}
			else if(strcmp(x_nr,"Rules",true) == 0)
			{
                SendClientMessage(playerid, -1, ""#COL_PINK"Rules on Next Evolution RolePlay: "#COL_WHITE"What to, and not to do, if you want to stick around.");
				SendClientMessage(playerid, COLOR_WHITE, "Type ''/rules'' for more info!");
			    SendClientMessage(playerid, COLOR_PINK,"____________________________________________________________________");
				return 1;
			}
   			else if(strcmp(x_nr,"Chat",true) == 0)
			{
                SendClientMessage(playerid, -1, ""#COL_PINK"Chat: "#COL_WHITE"Talking with other players in person, on the phone, and otherwise");
				SendClientMessage(playerid, COLOR_WHITE, "Type '/help topic' (Local, Phone, FactionChat, NewbChat, Ads, Report)");
			    SendClientMessage(playerid, COLOR_PINK,"____________________________________________________________________");
				return 1;
			}
  			else if(strcmp(x_nr,"Jobs",true) == 0)
			{
                SendClientMessage(playerid, -1, ""#COL_PINK"Jobs: "#COL_WHITE"Things you can do around Los Santos. Use '/skill' to check these.");
				SendClientMessage(playerid, COLOR_WHITE, "Type '/help topic' (armsdeal, drugdeal, wheelman, merc, lawyer, fishing, dropcar)");
			    SendClientMessage(playerid, COLOR_PINK,"____________________________________________________________________");
				return 1;
Reply
#4

I suggest to use iPLEOMAX exemple, its much much faster than strcmp + strok.
Reply
#5

Yes, but not so fast as ZCMD & sscanf2 .
Reply
#6

Quote:
Originally Posted by MoroDan
Посмотреть сообщение
Yes, but not so fast as ZCMD & sscanf2 .
Is not YCMD much faster than ZCMD command proccesor?
Reply
#7

Quote:
Originally Posted by Anthony_prince
Посмотреть сообщение
Is not YCMD much faster than ZCMD command proccesor?
Yes, YCMD is fastest at present.
Reply
#8

Thank you all matey's, I've sussed it now, thanks for the ZCMD version, got me far , made 18 commands with it now :3
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)