16.01.2012, 16:55
Hello, i have this whisper command, and works quite good but i have a little problem. It works only if all players are in that range, and i don't want that. Do you have any idea how should i fix this?
PHP код:
public SendWHISPERMessage(color,const string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) == 1)
SendClientMessage(i, COLOR_ORANGE ,string);
}
return 1;
}
CMD:w(playerid, params[])
{
new Float:x, Float:y, Float:z, i;
if(sscanf(params,"u",mystring)) return SendClientMessage(playerid,COLOR_LIGHTBLUE,"USAGE: {FFFFFF}/w [message]");
for( i = 0; i < MAX_PLAYERS; i++){
GetPlayerPos(i, x, y, z);
if(!(IsPlayerInRangeOfPoint(playerid, 10, x, y, z))) return SendClientMessage(playerid, COLOR_SILVER,"You are to far from that person.");
}
GetPlayerName(playerid, pname, sizeof(pname));
format(mystring, sizeof(mystring),"%s whispred: %s", pname, params);
SetPlayerChatBubble(playerid, params, COLOR_ORANGE, 10.0, 10000);
SendWHISPERMessage(COLOR_ORANGE, mystring);
return 1;
}