2 commands in one - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: 2 commands in one (
/showthread.php?tid=528213)
2 commands in one -
jackx3rx - 26.07.2014
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.
Re: 2 commands in one -
Blast3r - 26.07.2014
It's simple, you just return it:
pawn Код:
CMD:s(playerid, params[]) return cmd_shout(playerid, params);
Re: 2 commands in one -
Beckett - 26.07.2014
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);
}
AW: 2 commands in one -
jackx3rx - 26.07.2014
Thanks I did this for /shout and /low, both work perfect
AW: 2 commands in one -
jackx3rx - 26.07.2014
BTW how do I know what params I use?
eg what..
"ui" "i" "ii"?
Re: AW: 2 commands in one -
King Ace - 26.07.2014
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