[PROBLEM] Making a person die when he enters an area
#3

Add this function first:
Код:
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
  if(IsPlayerConnected(playerid))
	{
		new Float:oldposx, Float:oldposy, Float:oldposz;
		new Float:tempposx, Float:tempposy, Float:tempposz;
		GetPlayerPos(playerid, oldposx, oldposy, oldposz);
		tempposx = (oldposx -x);
		tempposy = (oldposy -y);
		tempposz = (oldposz -z);
		//printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
		if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
		{
			return 1;
		}
	}
	return 0;
}
Then change a little your code:
Код:
public isPlayerInArea()
  {
    new Float:X, Float:Y, Float:Z;
    for(new i=0; i < MAX_PLAYERS; i++)
    {
      if (PlayerToPoint(25.0(for example its the cover distance), i, x(the x coord), y(the x coord), z(the z coord)){
        SetPlayerHealth(i, 0);
      }
    }
  }
Reply


Messages In This Thread
[PROBLEM] Making a person die when he enters an area - by S1nn3r - 27.01.2010, 13:14
Re: [PROBLEM] Making a person die when he enters an area - by Norck - 27.01.2010, 13:21
Re: [PROBLEM] Making a person die when he enters an area - by pierhs - 27.01.2010, 13:24

Forum Jump:


Users browsing this thread: 2 Guest(s)