2 commands in one
#1

I have a basic shout command for my RP server..
Код:
CMD:shout(playerid,params[])
{
	new string[128], message[128];
	if (sscanf(params, "s[128]", message)) return SendClientMessage(playerid,-1,"{AA3333}USAGE:{FFFFFF} /s(hout) (message)");
	format (string,128,"%s shouts: %s",RemoveUnderScore(playerid),message);
	ProxDetector(50,playerid,string,CHATFADE_1,CHATFADE_2,CHATFADE_3,CHATFADE_4,CHATFADE_5);
	{
	    SetPlayerChatBubble(playerid,string,CHATFADE_1,50,6000);
	}
	return 1;
}
It works perfectly but how would I make /s execute the exact same command without duping the command but with CMD?

Thanks in advance.
Reply
#2

It's simple, you just return it:

pawn Код:
CMD:s(playerid, params[]) return cmd_shout(playerid, params);
Reply
#3

zCMD

It's written in the zCMD thread however..

How to make two different commands doing the same thing

For example, you have /something cmd:

pawn Код:
COMMAND:something(playerid, params[])
{
  // some stuff here
  return 1;
}
and you want to create another one such as /another that does what /something does. The simpliest way of doing that is:

pawn Код:
COMMAND:another(playerid, params[])
{
  return cmd_something(playerid, params);
}
Reply
#4

Thanks I did this for /shout and /low, both work perfect
Reply
#5

BTW how do I know what params I use?
eg what..

"ui" "i" "ii"?
Reply
#6

Quote:
Originally Posted by jackx3rx
Посмотреть сообщение
BTW how do I know what params I use?
eg what..

"ui" "i" "ii"?
Код:
Specifier(s)			Name				Example values
	i, d			Integer				1, 42, -10
	c			Character			a, o, *
	l			Logical				true, false
	b			Binary				01001, 0b1100
	h, x			Hex				1A, 0x23
	o			Octal				045 12
	n			Number				42, 0b010, 0xAC, 045
	f			Float				0.7, -99.5
	g			IEEE Float			0.7, -99.5, INFINITY, -INFINITY, NAN, NAN_E
	u			User name/id (bots and players)	******, 0
	q			Bot name/id			ShopBot, 27
	r			Player name/id			******, 42
Source: https://sampforum.blast.hk/showthread.php?tid=300397
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)