29.03.2014, 22:47
Why do you use sscanf line inside the loop? If you type "/w", then it will send the usage message many times (as many as MAX_PLAYERS is defined). You don't even need sscanf for it.
pawn Код:
CMD:w(playerid, params[])
{
if (isnull(params)) return SendClientMessage(playerid, COLOR_ERROR, "USAGE: /w (Message)");
new
string[128],
Float: px,
Float: py,
Float: pz;
format(string, sizeof (string), "%s(%d) whispered : %s", GetName(playerid), playerid, params);
GetPlayerPos(playerid, px, py, pz);
for (new i; i != MAX_PLAYERS; ++i) // foreach(new i : Player)
{
if (IsPlayerInRangeOfPoint(i, 10.0, px, py, pz)) SendClientMessage(i, COLOR_PURPLE, string);
}
return 1;
}