SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 23/07/2011, 07:34 PM   #1
iGetty
High-roller
 
iGetty's Avatar
 
Join Date: Sep 2010
Location: Falkirk, Scotland
Posts: 1,753
Reputation: 224
Default /Help command.

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.
iGetty is offline  
Old 23/07/2011, 07:56 PM   #2
iPLEOMAX
High-roller
 
iPLEOMAX's Avatar
 
Join Date: Mar 2011
Location: AE
Posts: 1,251
Reputation: 744
Default Re: /Help command.

ZCMD Example:

pawn Code:
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;
}
__________________
Goodbye SA-MP.
iPLEOMAX is offline  
Old 23/07/2011, 08:11 PM   #3
-CaRRoT
High-roller
 
-CaRRoT's Avatar
 
Join Date: Jul 2011
Location: CA, Los Angeles.
Posts: 1,279
Reputation: 344
Default Re: /Help command.

Another Ex :


Code:
	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;
-CaRRoT is offline  
Old 23/07/2011, 08:13 PM   #4
TheArcher
High-roller
 
TheArcher's Avatar
 
Join Date: Dec 2009
Location: Home
Posts: 2,338
Reputation: 251
Default Re: /Help command.

I suggest to use iPLEOMAX exemple, its much much faster than strcmp + strok.
__________________
TheArcher is offline  
Old 23/07/2011, 08:22 PM   #5
MoroDan
Huge Clucker
 
MoroDan's Avatar
 
Join Date: Jun 2011
Posts: 278
Reputation: 13
Default Re: /Help command.

Yes, but not so fast as ZCMD & sscanf2 .
__________________
MoroDan is offline  
Old 23/07/2011, 08:28 PM   #6
TheArcher
High-roller
 
TheArcher's Avatar
 
Join Date: Dec 2009
Location: Home
Posts: 2,338
Reputation: 251
Default Re: /Help command.

Quote:
Originally Posted by MoroDan View Post
Yes, but not so fast as ZCMD & sscanf2 .
Is not YCMD much faster than ZCMD command proccesor?
__________________
TheArcher is offline  
Old 23/07/2011, 08:32 PM   #7
iPLEOMAX
High-roller
 
iPLEOMAX's Avatar
 
Join Date: Mar 2011
Location: AE
Posts: 1,251
Reputation: 744
Default Re: /Help command.

Quote:
Originally Posted by Anthony_prince View Post
Is not YCMD much faster than ZCMD command proccesor?
Yes, YCMD is fastest at present.
__________________
Goodbye SA-MP.
iPLEOMAX is offline  
Old 23/07/2011, 09:38 PM   #8
iGetty
High-roller
 
iGetty's Avatar
 
Join Date: Sep 2010
Location: Falkirk, Scotland
Posts: 1,753
Reputation: 224
Default Re: /Help command.

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
iGetty is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Command Bugged] Each time i use /respawnallcars it says Unknown Command Rand_Omar Scripting Help 11 30/09/2012 12:35 AM
SAMP Command Returns Unkown Command Shockey HD Help Archive 3 19/07/2011 07:24 AM
Command returns SERVER: Unknown command admantis Help Archive 7 09/12/2010 06:52 AM
SERVER: Unknown Command when using a scripted command and it does execute! Moustafa Help Archive 6 11/06/2010 01:34 PM
Command that returns SERVER: Unknown Command. pagie1111 Help Archive 11 11/04/2010 09:55 AM


All times are GMT. The time now is 07:23 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.