sendclientmessagetoall with the input text?
#1

Hi,
I'm using CMD: style commands. I don't know how I'd make a command say like,

Код:
CMD:sayhi(playerid, params[])
{

}
And so if you type "/sayhi please help me." it would send a message saying "please help me."
Reply
#2

pawn Код:
CMD:sayhi(playerid, params[]) {
    SendClientMessage(playerid, 0, params); // You ought to be more specific if this wasn't what you wanted.
    return 1;
}
There are hundreds of tutorials on the forum, they are not hard to follow.
Reply
#3

Quote:
Originally Posted by Calg00ne
Посмотреть сообщение
pawn Код:
CMD:sayhi(playerid, params[]) {
    SendClientMessage(playerid, 0, params); // You ought to be more specific if this wasn't what you wanted.
    return 1;
}
There are hundreds of tutorials on the forum, they are not hard to follow.
Thankyou.
Reply
#4

Your using ZCMD, not 'CMD: style commands'.

Alright, so if I understand you clearly, you'd like a command, in which the text you input would then Send a Message to everyone connected on the server. I'll be doing it in ZCMD and sscanf.

pawn Код:
CMD:sayhi(playerid, params[])
{
        new Str[128];
        if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /sayhi [message]");
        format(Str, sizeof(Str), "%s", params);
        SendClientMessageToAll(COLOR_WHITE, Str);
    }
    return 1;
}
Reply
#5

pawn Код:
CMD:sayhi(playerid, params[])
{
    new Str[128],pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));
    if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /sayhi [message]");
    format(Str, sizeof(Str), "/ %s / send a message saying / %s /", pName,params);
    SendClientMessageToAll(0x33FF33AA, Str);
    return 1;
}
Reply
#6

When someone replies with a working solution, you're not supposed to reply with coder a LOT messier...
Reply
#7

Gertin, he did not ask for:
"/ name / send a message saying / message /"

He asked for it to send the params.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)