20.07.2016, 02:09
After I tested the command a little bit more, I found that when typing /say Hi. It would display to the other person but it wouldn't display to the player whom wrote it. So I added this
But when I am around more than 1 person, it displays whatever has been said twice.
PHP код:
CMD:say(playerid, params[])
{
if (isnull(params)) return SendClientMessage(playerid,COLOR_WHITE,"Usage: /s [Action]");
new Float: x, Float: y, Float: z, string[145], count;
GetPlayerPos(playerid, x, y, z);
GetPlayerName(playerid, string, 24);
format(string, sizeof(string), "*%s says\58 \34%s\34", string, params);
for (new i, j = GetPlayerPoolSize(); i <= j; i++) // for (new i; i < MAX_PLAYERS; i++) if you don't use 0.3.7
{
if (i == playerid) continue;
if (!IsPlayerConnected(i))
continue;
if (IsPlayerInRangeOfPoint(i, 25.0, x, y, z))
{
SendClientMessage(i, COLOR_LIGHTBLUE, string);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
count++;
}
}
if (!count) SendClientMessage(playerid, COLOR_SILVER, "You spoke but nobody heard you...");
return 1;
}