SA-MP Forums Archive
detecting player X, Y is not WORKING help! - 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: detecting player X, Y is not WORKING help! (/showthread.php?tid=186963)



detecting player X, Y is not WORKING help! - admantis - 31.10.2010

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");
            }
        }
    }
}



AW: detecting player X, Y is not WORKING help! - Arrows73 - 31.10.2010

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


Re: detecting player X, Y is not WORKING help! - armyoftwo - 31.10.2010

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


Re: detecting player X, Y is not WORKING help! - admantis - 31.10.2010

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.


Re: detecting player X, Y is not WORKING help! - rbN. - 31.10.2010

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