gangzones - 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: gangzones (
/showthread.php?tid=68792)
gangzones -
CJ101 - 13.03.2009
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
Re: gangzones -
On_Top_Non_Stop - 13.03.2009
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;
}
Re: gangzones -
CJ101 - 13.03.2009
Код:
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.
Re: gangzones -
Norn - 13.03.2009
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
Re: gangzones -
On_Top_Non_Stop - 13.03.2009
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
}
}
}
}