Question
#8

Quote:
Originally Posted by Improvement™
View Post
This is how I would do it.

pawn Code:
//Somewhere on top of your script
new bool:IsPlayerInLosAztTer[MAX_PLAYERS];

//Somewhere in the middle between the Callbacks (public's)
forward isPlayerInArea();
public isPlayerInArea()
{
    for(new i=0; i < MAX_PLAYERS; i++) //This line defines a name for all player, the name is "i"
    {
        new Float:Pos_X, Float:Pos_Y, Float:Pos_Z);
        GetPlayerPos(i , Pos_X, Pos_Y, Pos_Z);
        if(Pos_X <= 2725 && Pos_X >= -1662 && Pos_Y <= 2858 && Pos_Y >= -1500)
        {
            if(IsPlayerInLosAztTer[i]) return 1;
            if(!IsPlayerInLosAztTer[i])
            {
                SendClientMessage(i,orange,"You have entered the Varrios Los Aztecas Territory");
                IsPlayerInLosAztTer[i] = true;
                return 1;  
            }
        }
        else
        {
            if(!IsPlayerInLosAztTer[i]) return 1;
            if(IsPlayerInLosAztTer[i])
            {
                SendClientMessage(i, orange, "You have left the Varrios Los Aztecas Territory");
                IsPlayerInLosAztTer[i] = false;
                return 1;
            }
        }
    }
    return 1;
}
FIRST EDIT: Just editted everything into foreach, sorry didn't saw it earlier.

If you would like me to //comment everything and explain it all for you, just reply to this topic .
I hope this helps.

Kind Regards,
Improvement™
Also, if you have multiple areas instead of making a who bunch of boolean values you could have a variable store the id of the area they are in.
Reply


Messages In This Thread
Question - by Tanush123 - 21.08.2011, 19:54
Re: Question - by Darnell - 21.08.2011, 20:06
Re: Question - by Tanush123 - 21.08.2011, 20:28
Re: Question - by Darnell - 21.08.2011, 20:30
Re: Question - by dowster - 21.08.2011, 21:24
Re: Question - by Tanush123 - 21.08.2011, 22:16
Re: Question - by Improvement™ - 21.08.2011, 22:45
Re: Question - by dowster - 21.08.2011, 23:04
Re: Question - by Tanush123 - 22.08.2011, 05:07
Re: Question - by Improvement™ - 22.08.2011, 09:36

Forum Jump:


Users browsing this thread: 1 Guest(s)