[CMD:say(playerid,params[])// /say command
{
new string[128], say[100];// Store the intial action
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if(sscanf(params, "s[100]",say)) return SendClientMessage(playerid,COLOR_WHITE,"Usage: /s [Action]");//Error handling
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerInRangeOfPoint(i, 25.0, x, y, z))
{
format(string,sizeof(string),"*%s says\58 \34%s\34",GetName(playerid),say);//Formats the /shout cmd output
SendClientMessage(i,COLOR_LIGHTBLUE,string);
}
else SendClientMessage(playerid, COLOR_SILVER, "You spoke but nobody heard you...");
}
return 1;
}
[CMD:say(playerid,params[])// /say command
{
new string[128], say[100];// Store the intial action
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if(sscanf(params, "s[100]",say)) return SendClientMessage(playerid,COLOR_WHITE,"Usage: /s [Action]");//Error handling
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerInRangeOfPoint(i, 25.0, x, y, z))
{
format(string,sizeof(string),"*%s says\58 \34%s\34",GetName(playerid),say);//Formats the /shout cmd output
SendClientMessage(i,COLOR_LIGHTBLUE,string);
}
else SendClientMessage(playerid, COLOR_SILVER, "You spoke but nobody heard you...");
break;
}
return 1;
}
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 (!IsPlayerConnected(i)) continue; if (IsPlayerInRangeOfPoint(i, 25.0, x, y, z)) { SendClientMessage(i, COLOR_LIGHTBLUE, string); count++; } } if (!count) SendClientMessage(playerid, COLOR_SILVER, "You spoke but nobody heard you..."); return 1; }
Hi. Thanks to you both for taking the time to help me out. I don't get spammed anymore, however even if no one is close to me it will display the message that has been sent and no "You spoke but nobody heard..."
Any more ideas? |
if (i == playerid) continue;
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;
}
if (i == playerid) continue;