SA-MP Forums Archive
sendclientmessagetoall with the input text? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: sendclientmessagetoall with the input text? (/showthread.php?tid=267841)



sendclientmessagetoall with the input text? - Jack_Leslie - 10.07.2011

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."


Re: sendclientmessagetoall with the input text? - Calgon - 10.07.2011

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.


Re: sendclientmessagetoall with the input text? - Jack_Leslie - 10.07.2011

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.


Re: sendclientmessagetoall with the input text? - Kush - 10.07.2011

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;
}



Re: sendclientmessagetoall with the input text? - Gertin - 10.07.2011

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;
}



Re: sendclientmessagetoall with the input text? - Calgon - 10.07.2011

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


Re: sendclientmessagetoall with the input text? - jameskmonger - 10.07.2011

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

He asked for it to send the params.