gangzones
#1

ok i created a gangzone. It's for police. I want if a player who is not TEAM_COP enters the zone, to decrease health until he leaves (trespassing). There is no function or callback where i do this. How would i check
Reply
#2

You could use IsPlayerInCube to see if there in the zone and if they are get there health then decrease it.
pawn Код:
public IsPlayerInCube(playerid, xmin, ymin, zmin, xmax, ymax, zmax)
{
 new Float:x, Float:y, Float:z;
 GetPlayerPos(playerid, x, y, z);
 if( x > xmin && y > ymin && z > zmin && x < xmax && y < ymax && z < zmax) return 1;
 return 0;
}
Reply
#3

Код:
public IsPlayerInCube(playerid, xmin, ymin, zmin, xmax, ymax, zmax)
{
  new Float:x, Float:y, Float:z;
  GetPlayerPos(playerid, x, y, z);
  if( x > -1699.399 && y > 649.2913 && z > zmin && x < -1575.793 && y < 743.9704 && z < zmax)
  {

	GameTextForPlayer(playerid,"YOU ARE TRESSPASSING",5000,5);
  }

  return 1;
}
i get nothing. nothing happens.
Reply
#4

Quote:
Originally Posted by cj101
Код:
public IsPlayerInCube(playerid, xmin, ymin, zmin, xmax, ymax, zmax)
{
 new Float:x, Float:y, Float:z;
 GetPlayerPos(playerid, x, y, z);
 if( x > -1699.399 && y > 649.2913 && z > zmin && x < -1575.793 && y < 743.9704 && z < zmax)
 {

	GameTextForPlayer(playerid,"YOU ARE TRESSPASSING",5000,5);
 }

 return 1;
}
i get nothing. nothing happens.
No dude.. You don't edit the function. You run a timer with an if statement using if(IsPlayerInCube
Reply
#5

Just something like this.

pawn Код:
public IsInZone()
{
    for(new i; i<PLAYERS_MAX; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(IsPlayerInCube(playerid, xmin, ymin, zmin, xmax, ymax, zmax)//Replace with your own coords
            {
                //he is so do something here
            }
        }
    }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)