/W ? fails - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /W ? fails (
/showthread.php?tid=188412)
/W ? fails -
Mean - 07.11.2010
pawn Code:
CMD:w(playerid,params[])
{
new string[128], Player[MAX_PLAYER_NAME];
new Float:x, Float:y, Float:z;
GetPlayerName(playerid, Player, MAX_PLAYER_NAME);
GetPlayerPos(playerid, x, y, z);
format(string, 128, "[WHISPER] %s: %s", Player, params);
for(new i=0; i<MAX_PLAYERS; i++) if(IsPlayerInRangeOfPoint(playerid, 15.0, x, y, z)) SendClientMessage(i, COLOR_WHITE, string);
return 1;
}
Everyone can hear this, not only the player that is in range of 15
Re: /W ? fails -
DeathOnaStick - 07.11.2010
Quote:
Originally Posted by Mean
pawn Code:
CMD:w(playerid,params[]) { new string[128], Player[MAX_PLAYER_NAME]; new Float:x, Float:y, Float:z; GetPlayerName(playerid, Player, MAX_PLAYER_NAME); GetPlayerPos(playerid, x, y, z); format(string, 128, "[WHISPER] %s: %s", Player, params); for(new i=0; i<MAX_PLAYERS; i++) if(IsPlayerInRangeOfPoint(playerid, 15.0, x, y, z)) SendClientMessage(i, COLOR_WHITE, string); return 1; }
Everyone can hear this, not only the player that is in range of 15
|
In the for-loop you once mixed up 'i' and 'playerid' when checking the range.
Re: /W ? fails -
Mean - 07.11.2010
So how to fix?
EDIT:Found it
Re: /W ? fails -
willsuckformoney - 07.11.2010
pawn Code:
CMD:w(playerid,params[])
{
new string[128], Player[MAX_PLAYER_NAME];
new Float:x, Float:y, Float:z;
GetPlayerName(playerid, Player, MAX_PLAYER_NAME);
GetPlayerPos(playerid, x, y, z);
format(string, 128, "[WHISPER] %s: %s", Player, params);
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerInRangeOfPoint(i, 15.0, x, y, z)) return SendClientMessage(i, COLOR_WHITE, string);
}
return 1;
}
Re: /W ? fails -
Mean - 07.11.2010
ty will!