Send 2 Messages? -
Scenario - 04.11.2010
I am working a little more on my "Clean Script" and I wanted to change some commands around to perform a little faster and more efficiently. I have the following command:
pawn Код:
CMD:set(playerid, params[])
{
if(PlayerStats[playerid][pAdminLevel] < 3)
return SendClientMessage(playerid, COLOR_SYSTEM, ACMD_ERROR);
if(sscanf(params, "uis[15]", id, value, usage))
return SendClientMessage(playerid, COLOR_WHITE, "SYNTAX: /aset [playerid] [value] [usage]");
return 1;
}
Is there a way I could send 2 messages when a player has incorrect parameters for sscanf? Sort of like this, but doing it the way I have it above...?
pawn Код:
if(sscanf(params, "uis[15]", id, value, usage))
{
SendClientMessage(playerid, COLOR_WHITE, "SYNTAX: /aset [playerid] [value] [usage]");
SendClientMessage(playerid, COLOR_WHITE, "Usage List: skin, score, adminlevel, color");
}
Re: Send 2 Messages? -
Conroy - 04.11.2010
Unsure if it will work, but worth a go.
pawn Код:
if(sscanf(params, "uis[15]", id, value, usage))
return SendClientMessage(playerid, COLOR_WHITE, "SYNTAX: /aset [playerid] [value] [usage]"), SendClientMessage(playerid, COLOR_WHITE, "Usage List: skin, score, adminlevel, color");
Re: Send 2 Messages? - [L3th4l] - 04.11.2010
Yes Conroy is correct, notice the ',' between the messages.
Re: Send 2 Messages? -
mick88 - 05.11.2010
Код:
if(sscanf(params, "uis[15]", id, value, usage))
return (SendClientMessage(playerid, COLOR_WHITE, "SYNTAX: /aset [playerid] [value] [usage]") && SendClientMessage(playerid, COLOR_WHITE, "Usage List: skin, score, adminlevel, color"));
Thi will work.
Re: Send 2 Messages? -
Joe Staff - 05.11.2010
You pretty much had it right RealCop
pawn Код:
if(sscanf(params, "uis[15]", id, value, usage))
{
SendClientMessage(playerid, COLOR_WHITE, "SYNTAX: /aset [playerid] [value] [usage]");
SendClientMessage(playerid, COLOR_WHITE, "Usage List: skin, score, adminlevel, color");
return 1;
}
Re: Send 2 Messages? -
Scenario - 05.11.2010
Thanks guys, really appreciate it.
Quote:
Originally Posted by SilentHuntR
You pretty much had it right RealCop
pawn Код:
if(sscanf(params, "uis[15]", id, value, usage)) { SendClientMessage(playerid, COLOR_WHITE, "SYNTAX: /aset [playerid] [value] [usage]"); SendClientMessage(playerid, COLOR_WHITE, "Usage List: skin, score, adminlevel, color"); return 1; }
|
Yeah, but when I code like that it makes the whole command look like poop. lol
Re: Send 2 Messages? -
Miguel - 05.11.2010
I do not get what you mean by two messages... a message for every command parameter?
Re: Send 2 Messages? -
Scenario - 05.11.2010
[QUOTE=Miguel;898618]I do not get what you mean by two messages... a message for every command parameter?[/QUOTE
I wanted to send 2 different messages when they perform the command without the full syntax. One message shows them how to do the command and the other shows the usages they can use.