[Help] Foreach
#1

hello,

ProxDetectorS don't work , player can look message everywhere. How to fix that?

Код:
Chat(random, color, string[])
{
	foreach(Player, i)
	{
	   if(GetPVarInt(i, "IDT") == random)
	   {
	         new Float:X, Float:Y, Float:Z;
	         new playerid,giveplyerid;
	         GetPlayerPos(playerid, X, Y, Z);
	         GetPlayerPos(giveplayerid, X, Y, Z);
		 if (ProxDetectorS(3.0, playerid, giveplayerid))
	         {
                     SendClientMessage(i, color, string);
	         }
	         else SendClientMessage(playerid,COLOR_VBl,"Error");
	   }
	}
}
Reply
#2

Could you eventually explain what's wrong?
Reply
#3

player has to see the message only if is in radius,but he see message everywhere
Reply
#4

Please post your ProxDetectorS code between pawn tags. The code you posted seems to do what it should.
Reply
#5

Код:
ProxDetectorS(Float:radi, playerid, targetid)
{
    if(IsPlayerConnected(playerid)&&IsPlayerConnected(targetid))
	{
	    if(GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(targetid))
		{
			new Float:posx,
			    Float:posy,
				Float:posz,
			    Float:oldposx,
				Float:oldposy,
				Float:oldposz,
			    Float:tempposx,
				Float:tempposy,
				Float:tempposz;

			GetPlayerPos(playerid, oldposx, oldposy, oldposz);

			GetPlayerPos(targetid, posx, posy, posz);
			tempposx = (oldposx -posx);
			tempposy = (oldposy -posy);
			tempposz = (oldposz -posz);

			if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
			{
				return 1;
			}
		}
	}
	return 0;
}
Reply
#6

RooK1e
type
Код:
[pawn ]
your code
[/pawn ]
Edit : sorry i dont know much about proxdetect
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)