[HELP] Problem with a small Command
#1

Код:
	if (strcmp(cmd, "/advert", true) ==0 || strcmp(cmd, "/ad", true) ==0)
	{
	  if(PlayerToPoint(15.0,playerid,1788.4279,-1297.8048,13.3750))
	  {
		  new name1[256];
		  GetPlayerName(playerid,name1,sizeof(name1));
		  if ((strlen(cmdtext) >= 3)&&(strlen(cmdtext) <= 7))
			{
			SendClientMessage(playerid,0xC0C0C0FF, "	USAGE: /ad(vert) [text]"); return 1;
			}
			format(string,sizeof(string),"Advertisement: %s, contact %s.",cmdtext[3],name1);
			SendClientMessageToAll(0x00FF00FF,string);
			return 1;
		}
	}
It would be great if you could help me with "else" so it send a warning message if I'm in wrong position.

Thanks
Reply
#2

You mean this?

Код:
	if (strcmp(cmd, "/advert", true) ==0 || strcmp(cmd, "/ad", true) ==0)
	{
	  if(PlayerToPoint(15.0,playerid,1788.4279,-1297.8048,13.3750))
	  {
		  new name1[256];
		  GetPlayerName(playerid,name1,sizeof(name1));
		  if ((strlen(cmdtext) >= 3)&&(strlen(cmdtext) <= 7))
			{
			SendClientMessage(playerid,0xC0C0C0FF, "	USAGE: /ad(vert) [text]"); return 1;
			}
			format(string,sizeof(string),"Advertisement: %s, contact %s.",cmdtext[3],name1);
			SendClientMessageToAll(0x00FF00FF,string);
			return 1;
		}
		else
		{
			SendClientMessage(playerid,0xC0C0C0FF, "	You aren't in the advert place!"); 
			return 1;
		}
	}
Reply
#3

Quote:
Originally Posted by Zamaroht
You mean this?

Код:
	if (strcmp(cmd, "/advert", true) ==0 || strcmp(cmd, "/ad", true) ==0)
	{
	  if(PlayerToPoint(15.0,playerid,1788.4279,-1297.8048,13.3750))
	  {
		  new name1[256];
		  GetPlayerName(playerid,name1,sizeof(name1));
		  if ((strlen(cmdtext) >= 3)&&(strlen(cmdtext) <= 7))
			{
			SendClientMessage(playerid,0xC0C0C0FF, "	USAGE: /ad(vert) [text]"); return 1;
			}
			format(string,sizeof(string),"Advertisement: %s, contact %s.",cmdtext[3],name1);
			SendClientMessageToAll(0x00FF00FF,string);
			return 1;
		}
		else
		{
			SendClientMessage(playerid,0xC0C0C0FF, "	You aren't in the advert place!"); 
			return 1;
		}
	}
Yepp, that is what I was looking for but, when I try it out it just tells me Unknown Command...

Here is how the command looks like:

Код:
	if (strcmp(cmd, "/advert", true) ==0 || strcmp(cmd, "/ad", true) ==0)
	{
	  if(PlayerToPoint(15.0,playerid,1788.4279,-1297.8048,13.3750))
	  {
		  new name1[256];
		  GetPlayerName(playerid,name1,sizeof(name1));
		  if ((strlen(cmdtext) >= 3)&&(strlen(cmdtext) <= 7))
			{
			SendClientMessage(playerid,0xC0C0C0FF, "	USAGE: /ad(vert) [text]"); return 1;
			}
			format(string,sizeof(string),"Advertisement: %s, contact %s.",cmdtext[3],name1);
			SendClientMessageToAll(0x00FF00FF,string);
			return 1;
		}
	}
	else
	{
	  SendClientMessage(playerid,0xFFFFFFFF, "You are not at the San Andreas News building.");
	  SendClientMessage(playerid,0x00FF00FF, "	HINT: A marker has been placed on your map.");
	  return 1;
	}
}
Reply
#4

I'm guessing that's inside OnPlayerCommandText right? Could you show me the full callback?
Reply
#5

Quote:
Originally Posted by Zamaroht
I'm guessing that's inside OnPlayerCommandText right? Could you show me the full callback?
Never mind, thanks, I forgot to delete a bracket, now it works

Thanks
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)