isPlayerInArea - 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: isPlayerInArea (
/showthread.php?tid=276627)
isPlayerInArea -
cruising - 14.08.2011
Hello!
Trying to give a player a message when enter a zone, but no message appears.
i have tried this from wiki
pawn Код:
public isPlayerInArea()
{
new Float:X, Float:Y, Float:Z;
for(new i=0; i < MAX_PLAYERS; i++)
{
GetPlayerPos(i, X, Y, Z);
if (X <= -2966.18 && X >= -910.8743 && Y <= -724.0283 && Y >= 1576.513)
{
GameTextForPlayer(i,"~r~Warning: you are entering hostile airspace!",3500,5);
}
}
return 1;
}
And i also have made the zones
pawn Код:
new ZoneThunderbirds;
ZoneThunderbirds = GangZoneCreate(-2966.18, -910.8743, -724.0283, 1576.513);
Also i want the message appears if you not are in right team for the right zone, something like this
pawn Код:
if(GetPlayerTeam(playerid) >3)
Re: isPlayerInArea -
cruising - 16.08.2011
Anyone?
Re: isPlayerInArea -
KingTurtle - 16.08.2011
I've made two versions of it. One where you need to make it like this "isPlayerInArea(float:y, float

)"
pawn Код:
public isPlayerInArea(Float:EX, Float:EY, Float:EZ)
{
new Float:X, Float:Y, Float:Z;
for(new i=0; i < MAX_PLAYERS; i++)
{
GetPlayerPos(i, X, Y, Z);
if (X <= EX && X >= EX && Y <= EY && Y >= EY)
{
if(GetPlayerTeam(playerid) > 3)
{
GameTextForPlayer(i,"~r~Warning: you are entering the Thunderbirds area",3500,5);
}
}
}
return 1;
}
And the other version. I am not sure if I put the coordinates on the right position
pawn Код:
public isPlayerInArea()
{
new Float:X, Float:Y, Float:Z;
for(new i=0; i < MAX_PLAYERS; i++)
{
GetPlayerPos(i, X, Y, Z);
if (X <= -2966.18 && X >= -724.0283 && Y <= -910.8743 && Y >= 1576.513)
{
if(GetPlayerTeam(playerid) > 3)
{
GameTextForPlayer(i,"~r~Warning: you are entering the Thunderbirds area",3500,5);
}
}
}
return 1;
}
Re: isPlayerInArea -
cruising - 16.08.2011
Quote:
Originally Posted by KingTurtle
I've made two versions of it. One where you need to make it like this "isPlayerInArea(float:y, float  )"
pawn Код:
public isPlayerInArea(Float:EX, Float:EY, Float:EZ) { new Float:X, Float:Y, Float:Z; for(new i=0; i < MAX_PLAYERS; i++) { GetPlayerPos(i, X, Y, Z); if (X <= EX && X >= EX && Y <= EY && Y >= EY) { if(GetPlayerTeam(playerid) > 3) { GameTextForPlayer(i,"~r~Warning: you are entering the Thunderbirds area",3500,5); } } } return 1; }
And the other version. I am not sure if I put the coordinates on the right position
pawn Код:
public isPlayerInArea() { new Float:X, Float:Y, Float:Z; for(new i=0; i < MAX_PLAYERS; i++) { GetPlayerPos(i, X, Y, Z); if (X <= -2966.18 && X >= -724.0283 && Y <= -910.8743 && Y >= 1576.513) { if(GetPlayerTeam(playerid) > 3) { GameTextForPlayer(i,"~r~Warning: you are entering the Thunderbirds area",3500,5); } } } return 1; }
|
On the first version, shouldnt the coordinates be in EX && X >= EX && Y <= EY && Y >= EY) ?
And i tried the second version and get a error on "playerid"
pawn Код:
if(GetPlayerTeam(playerid) > 3)
error 017: undefined symbol "playerid"
Re: isPlayerInArea -
farris - 17.08.2011
i recommend making a timer that checks for players in area every 10 seconds thats what i do on my restricted area and the police get a makrer on there location
Re: isPlayerInArea -
cruising - 19.08.2011
Quote:
Originally Posted by farris
i recommend making a timer that checks for players in area every 10 seconds thats what i do on my restricted area and the police get a makrer on there location
|
I never did get it to work prop, only team ID 0 and 1 got the message when entered the team 3 zone. The rest didnt get any message at all on the other zones, so i gave it up because that was just ridiculous