detecting player X, Y is not WORKING help!
#1

I have a timer that runs every 1 second to check if a player is in a area.. I have made gang zones that represent the area, but when I enter in the area defitively NOTHING HAPPENS. I have made 4 posts about this, but none helped.

pawn Код:
forward IsPlayerInArea()
public IsPlayerInArea()
{
    for(new i=0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            new Float:x, Float:y, Float:z;
            GetPlayerPos(i, x, y, z);
            //if (x < xmin && x > xmax && y < ymin && y > ymax)
            if (x < -864.1628 && x > -4087.256 && y < 4063.901 && y > 2989.536)
            {
                SendClientMessage(i,COLOR_WHITE,"Your in the area lol");
            }
            if (x < -2977.858 && x > 2627.522 && y < 2837.724 && y > 2977.858)
            {
                SendClientMessage(i,COLOR_WHITE,"Your in the area lol");
            }
            if (x < -2989.536 && x > -3316.517 && y < -2662.556 && y > 2989.536)
            {
                SendClientMessage(i,COLOR_WHITE,"Your in the area lol");
            }
            if (x < -2966.18 && x > -3012.892 && y < 3082.959 && y > 58.38938)
            {
                SendClientMessage(i,COLOR_WHITE,"Your in the area lol");
            }
            if (x < -2989.536 && x > -3188.06 && y < -1996.917 && y > 934.23)
            {
                SendClientMessage(i,COLOR_WHITE,"Your in the area lol");
            }
        }
    }
}
Reply
#2

Should work if the coords are ok

Did you SetTimer("IsPlayerInArea", 500, true); <-- true?

Otherwise, it will only run once

Btw to make it faster, use continue; after each if clause or use else if / else
Reply
#3

I use this to check if someone is in area
Код:
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
if( Pos[0] >= 2265.508 && Pos[0] <= 3024.57 && Pos[1] >= -3024.57 && Pos[1] <= -2861.08 ) return 1;
Maybe that helps you
Reply
#4

Sorry forlate response, armyoftwo, how i should replace these values, and how I do it with multiple areas? You can set up that script according to my first post?

any help is INMENSELY appreciated.
Reply
#5

Quote:
Originally Posted by admantis
Посмотреть сообщение
and how I do it with multiple areas?
if.... else if..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)