[SOLVED] Commmands donґt work (/help)
#1

Hello again,

I have a little problem with my commands. I createt some help commands to help the players in my server. So I have:

/help
/help commands
/help teams
/help money

But the problem is that when I type in: /help commands it shows me the text from /help not from /help commands.
How can I set it that when I type /help commands it shows my the text from this?

Код:
	if(strcmp(cmd, "/help", true) == 0)
	{
	  SendClientMessage(playerid, YELLOW,"General Help");

		return true;
	}

	if(strcmp(cmd, "/help commands", true) == 0)
	{
	  SendClientMessage(playerid, YELLOW,"Commands Help");

		return true;
	}
Reply
#2

Use strtok.
Reply
#3

Let me show you alittle trick. instead of doing
Код:
	if(strcmp(cmd, "/help", true) == 0)
do it like this
Код:
if(!strcmp(cmdtext,"/help",true)) {
and to fix your codes.
Код:
if(!strcmp(cmdtxt,"/help",true)) {
	  SendClientMessage(playerid, YELLOW,"General Help");
		return 1;}
	if(!strcmp(cmdtxt,"/commands",true)) {
	  SendClientMessage(playerid, YELLOW,"Commands Help");
      return 1;}
To use your commands type "/help" and "/commands"
Reply
#4

@ _Ч§hмf†ҐЧ™_ :

Do you command than looks like that: /help command or like that: /help, /command ?

Cause I already have a /command. I wanna a /help command
Reply
#5

pawn Код:
if(strcmp(cmd, "/help", true) == 0)
{
SendClientMessage(playerid, YELLOW,"General Help");
}
else if(strcmp(cmd, "commands", true) == 0)
 {
SendClientMessage(playerid, YELLOW,"Commands Help");
return 1;
}
This should work. It automatically generates as a SPACE
Reply
#6

You cut just delete the space in "commands help" as well.
Reply
#7

Well, I have some overlap with some gamemodes so I just changed the help topics to /helpcmds, /helpteams and /helpmoney.

This for sure works.

But anyways, thanks for your help
Reply
#8

Change cmd to cmdtext in your strcmp line.
Reply
#9

But,you can just do:
pawn Код:
if (strcmp("/help commands", cmdtext, true, 14) == 0)//14 Is number of characters including space and /.
    {
        SendClientMessage(playerid, YELLOW,"General Help");
        return true;
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)