isPlayerInArea
#1

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)
Reply
#2

Anyone?
Reply
#3

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;
}
Reply
#4

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"
Reply
#5

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
Reply
#6

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)