/me working but /whisper is not
#1

Hello everyone

Could someone tell me or give me a new code?

when I type /me [text] it work fine and send message if I type /whisper it say "Usage: /whisper [text],here's my code

I use zcmd

Код:
CMD:whisper(playerid, params[])
{
	new pname[MAX_PLAYER_NAME], str[128], Float:pPos[3];
	if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, -1, "Usage: /whisper [text]");
	GetPlayerName(playerid, pname, sizeof(pname));
	GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerInRangeOfPoint(i, 10.0, pPos[0], pPos[1], pPos[2]))
		{
			format(str, sizeof(str), "[WHISPER] %s: %s", pname, params);
			SendClientMessage(i, -1, str);
		}
	}
	return 1;
}
Код:
CMD:me(playerid, params[])
{
    if(isnull(params))return SendClientMessage(playerid, 0xFF0000FF, "Usage: /me [action]");
    new str[128];
    GetPlayerName(playerid, str, sizeof(str));
    format(str, sizeof(str), "* %s says: %s", str, params);
    SendClientMessageToAll(0xFF9900AA, str);
    return 1;
}

Thanks all!
Reply
#2

Код:
CMD:whisper(playerid, params[])
{
	new pname[MAX_PLAYER_NAME], str[128], Float:pPos[3], text;
	if(sscanf(params, "s[128]", text)) return SendClientMessage(playerid, -1, "Usage: /whisper [text]");
	GetPlayerName(playerid, pname, sizeof(pname));
	GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerInRangeOfPoint(i, 10.0, pPos[0], pPos[1], pPos[2]))
		{
			format(str, sizeof(str), "[WHISPER] %s: %s", pname, text);
			SendClientMessage(i, -1, str);
		}
	}
	return 1;
}
Reply
#3

Now,because the command you posted RedJohn my pawno say Unable to Execute compiler,I updated all pawno and includes same problem,could someone else help me?
Reply
#4

Код:
COMMAND:w(playerid,params[])
{
   new string[250];
   if(sscanf(params,"s[250]",string)) return SendClientMessage(playerid,COLOR_RED,"USAGE:/w [message]");
   SetPlayerChatBubble(playerid,string,COLOR_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[250];
   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,COLOR_YELLOW,string2);
   }
 return 1;
}
Reply
#5

PHP код:
CMD:whisper(playeridparams[])
{
    new 
pname[MAX_PLAYER_NAME], str[128], Float:pPos[3], text[128];
    if(
sscanf(params"s[128]"text)) return SendClientMessage(playerid, -1"Syntax: /whisper <text>");
    
GetPlayerName(playeridpnamesizeof(pname));
    
GetPlayerPos(playeridpPos[0], pPos[1], pPos[2]);
    for(new 
0MAX_PLAYERSi++)
    {
        if(
IsPlayerInRangeOfPoint(i10.0pPos[0], pPos[1], pPos[2]))
        {
            
format(strsizeof(str), "[Whisper] %s: %s"pnametext);
            
SendClientMessage(iGreystr);
        }
    }
    return 
1;

@Wizboy:

Maximum SA-MP text input = 128 so why did you make the string size 250?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)