Is there a callback like..
#4

Just make a timer, for example 1 seconds, which loops through all players, and check if their position is in range of the point.
Edit: added non-tested code for base
pawn Code:
#define COORD 0.0, 0.0, 10.0
#define RANGE 10.5
#deinfe CHECK_INTERVAL 1000 // ms

new bool:isplayerinrange[MAX_PLAYERS] = {false,...};

forward RangeTimer();
forward OnPlayerEnterIRP(playerid);
forward OnPlayerLeaveIRP(playerid);

public RangeTimer()
{
    foreach(Player, i)
    {
        if (IsPlayerInRangeOfPoint(i, RANGE, COORD))
        {
            if (isplayerinrange[i]) continue;
            isplayerinrange[i] = true;
            CallRemoteFunction("OnPlayerEnterIRP", "i", playerid);
        }
        else
        {
            if (!isplayerinrange[i]) continue;
            isplayerinrange[i] = false;
            CallRemoteFunction("OnPlayerLeaveIRP", "i", playerid);
        }
    }
}

public OnFilterScriptInit()
{
    SetTimer("RangeTimer", CHECK_INTERVAL, 1);
    return 1;
}

public OnPlayerConnect(playerid)
{
    isplayerinrange[playerid] = false;
}
Reply


Messages In This Thread
Is there a callback like.. - by wouter0100 - 01.09.2011, 13:47
Re: Is there a callback like.. - by =WoR=Varth - 01.09.2011, 13:53
Re: Is there a callback like.. - by wouter0100 - 01.09.2011, 13:57
Re: Is there a callback like.. - by KoczkaHUN - 01.09.2011, 13:58
Re: Is there a callback like.. - by =WoR=Varth - 01.09.2011, 13:59
Re: Is there a callback like.. - by KoczkaHUN - 01.09.2011, 14:00
Re: Is there a callback like.. - by wouter0100 - 01.09.2011, 14:54
Re: Is there a callback like.. - by Kar - 01.09.2011, 14:57
Re: Is there a callback like.. - by KoczkaHUN - 01.09.2011, 14:59

Forum Jump:


Users browsing this thread: 1 Guest(s)