SA-MP Forums Archive
whisper problem - 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: whisper problem (/showthread.php?tid=582091)



whisper problem - Driver546465 - 17.07.2015

i got the whisper cmd but when i use it its appear on my head i want it in the main chat and just who near me can read it help !!!
COMMAND:w(playerid,params[])
{
new string[250];
if(sscanf(params,"s",string)) return SendClientMessage(playerid,COLOR_RED,"USAGE:/w [message]");
SetPlayerChatBubble(playerid,string,COLOR_YELLOW,3 5,10000);
new Float,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
new pName4[24];
GetPlayerName(playerid,pName4,sizeof(pName4));
new string2[250];
format(string2,sizeof(string2),"%s(%d):%s",pName4, playerid,string);
for(new i=0;i<=MAX_PLAYERS;i++)
{
if(IsPlayerInRangeOfPoint(i,15.0,x,y,z)) return SendClientMessage(playerid,COLOR_YELLOW,string2);
}
return 1;


Re: whisper problem - Driver546465 - 17.07.2015

help


Re: whisper problem - SickAttack - 17.07.2015

I would recommend this include to process messages: ---> https://sampforum.blast.hk/showthread.php?tid=520734 <---. It allows you to send long messages.

pawn Код:
SendWhisperMessage(Float:range, playerid, color, message[], length);
pawn Код:
CMD:whisper(playerid, params[])
{
    new string[256], message[128];
    if(sscanf(params, "s[128]", message)) return SendMessage(playerid, 0xFFFF00FF, "Usage: /whisper (message).");
   
    format(string, sizeof(string), "[WHISPER]: (%d) %s: %s.", playerid, PlayerName(playerid), message);
    SendWhisperMessage(10.0, playerid, 0x00FFFFFF, string);
    return 1;
}
Either way, do what you want:
pawn Код:
#include <foreach>

#define isnull(%1) ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))

COMMAND:w(playerid, params[])
{
    if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /w [message].");

    new string[256], name[MAX_PLAYER_NAME], Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    GetPlayerName(playerid, name, MAX_PLAYER_NAME);

    format(string, sizeof(string), "%s (%d): %s", name, playerid, params);
    SetPlayerChatBubble(playerid, string, COLOR_YELLOW, 35, 10000);

    foreach(new i: Player)
    {
        if(IsPlayerInRangeOfPoint(i, 15.0, x, y, z))
        {
            SendClientMessage(i, COLOR_YELLOW, string2);
        }
    }
    return 1;
}



Re: whisper problem - Driver546465 - 17.07.2015

thanks