Whisper command
#1

I want my whisper command to send clientmessage to all players around by 15 steps,but it only sends it to the player and creates the chat bubble string.

pawn Код:
COMMAND:w(playerid,params[])
{
    new string[128];
    if(sscanf(params,"s[250]",string)) return SendClientMessage(playerid,RED,"USAGE:/w [message]");
    SetPlayerChatBubble(playerid,string,YELLOW,35,10000);
    new Float:x,Float:y,Float:z;
    GetPlayerPos(playerid,x,y,z);
    new pName[24];
    GetPlayerName(playerid,pName,sizeof(pName));
    new string2[128];
    format(string2,sizeof(string2),"%s(%d): %s",pName,playerid,string);
    for(new i=0;i<=MAX_PLAYERS;i++)
    {
        if(IsPlayerInRangeOfPoint(i,15.0,x,y,z)) return SendClientMessage(playerid,YELLOW,string2);
    }
    return 1;
}
Reply
#2

Try this:

pawn Код:
COMMAND:w(playerid,params[])
{
    new ID
    if(sscanf(params, "ui", ID)) return SendClientMessage(playerid,RED,"USAGE:/w [message]");
    SetPlayerChatBubble(playerid,string,YELLOW,35,10000);
    new Float:x,Float:y,Float:z;
    GetPlayerPos(playerid,x,y,z);
    new pName[24];
    GetPlayerName(playerid,pName,sizeof(pName));
    new string[128];
    format(string,sizeof(string),"%s(%d) whispers: %s",ID,playerid,string);
    for(new i=0;i<=MAX_PLAYERS;i++)
    {
        if(IsPlayerInRangeOfPoint(i,15.0,x,y,z)) return SendClientMessage(ID,YELLOW,string2);
    }
    return 1;
}
Reply
#3

Quote:
Originally Posted by Tamer T
Посмотреть сообщение
I want my whisper command to send clientmessage to all players around by 15 steps,but it only sends it to the player and creates the chat bubble string.

pawn Код:
COMMAND:w(playerid,params[])
{
    new string[128];
    if(sscanf(params,"s[250]",string)) return SendClientMessage(playerid,RED,"USAGE:/w [message]");
    SetPlayerChatBubble(playerid,string,YELLOW,35,10000);
    new Float:x,Float:y,Float:z;
    GetPlayerPos(playerid,x,y,z);
    new pName[24];
    GetPlayerName(playerid,pName,sizeof(pName));
    new string2[128];
    format(string2,sizeof(string2),"%s(%d): %s",pName,playerid,string);
    for(new i=0;i<=MAX_PLAYERS;i++)
    {
        if(IsPlayerInRangeOfPoint(i,15.0,x,y,z)) return SendClientMessage(playerid,YELLOW,string2);
    }
    return 1;
}
Why are you giving string a cell length of 128 and then 250 within the sscanf?
pawn Код:
COMMAND:w(playerid,params[])
{
    new string[2][128];
    if(sscanf(params,"s[128]",string[0])) return SendClientMessage(playerid,RED,"USAGE:/w [message]");
    SetPlayerChatBubble(playerid,string[0],YELLOW,35,10000);
    new Float:pos[3];
    GetPlayerPos(playerid,pos[0],pos[1],pos[2]);
    new pName[24];
    GetPlayerName(playerid,pName, 24);
    format(string[1],128,"%s(%d): %s",pName,playerid,string[0]);
    for(new i=0;i<=MAX_PLAYERS;i++)
    {
        if(IsPlayerInRangeOfPoint(i,15.0,pos[0],pos[1],pos[2])) return SendClientMessage(playerid,YELLOW,string[1]);
    }
    return 1;
}
Reply
#4

Try now
pawn Код:
COMMAND:w(playerid,params[])
{
    new string[128];
    if(sscanf(params,"s[128]",string)) return SendClientMessage(playerid,RED,"USAGE:/w [message]");
    SetPlayerChatBubble(playerid,string,YELLOW,35,10000);
    new Float:x,Float:y,Float:z;
    GetPlayerPos(playerid,x,y,z);
    new pName[24];
    GetPlayerName(playerid,pName,sizeof(pName));
    new string2[128];
    format(string2,sizeof(string2),"%s(%d): %s",pName,playerid,string);
    for(new i=0;i<=MAX_PLAYERS;i++)
    {
        if(IsPlayerInRangeOfPoint(i,15.0,x,y,z)) return SendClientMessage(i,YELLOW,string2);
    }
    return 1;
}
Reply
#5

can i get the whisper cmd in strcmd ? like this :
Quote:

if (strcmp("/w", cmdtext, true, 10) == 0)

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)