Send 2 Messages?
#1

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");
}
Reply
#2

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");
Reply
#3

Yes Conroy is correct, notice the ',' between the messages.
Reply
#4

Код:
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.
Reply
#5

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;
}
Reply
#6

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
Reply
#7

I do not get what you mean by two messages... a message for every command parameter?
Reply
#8

[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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)