IsPlayerInRangeOfPoint
#6

I fixed the link on the github wiki.

You create the dynamic checkpoints once, when you load the houses. Add a variable to store the checkpoint id in your `HouseData` array.
pawn Code:
// loading data of each house
HouseData[i][houseCP] = CreateDynamicCP(HouseData[i][houseX], HouseData[i][houseY], HouseData[i][houseZ], size_of_checkpoint, .streamdistance = 2.0);
When player will be streamed, it will show the checkpoint or disable if not. The callback when enter one is
pawn Code:
public OnPlayerEnterDynamicCP(playerid, checkpointid)
Streamer provides an extra id and can be used to skip loops if you set an offset.
pawn Code:
#define HOUSES_OFFSET 50000
pawn Code:
// loading data of each house
HouseData[i][houseCP] = CreateDynamicCP(HouseData[i][houseX], HouseData[i][houseY], HouseData[i][houseZ], size_of_checkpoint, .streamdistance = 2.0);
Streamer_SetIntData(STREAMER_TYPE_CP, HouseData[i][houseCP], E_STREAMER_EXTRA_ID, HOUSES_OFFSET + i);
When a player enters a dynamic checkpoint, you subtract the offset and expect it to be in a certain range. If none was set, it is by default 0 so the result would be a negative number.
pawn Code:
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
    new house_id = Streamer_GetIntData(STREAMER_TYPE_CP, HouseData[i][houseCP], E_STREAMER_EXTRA_ID) - HOUSES_OFFSET;

    if (house_id >= 0)
    {
        // player entered checkpoint at position:
        //HouseData[house_id][houseX], HouseData[house_id][houseY], HouseData[house_id][houseZ]
    }
    return 1;
}
Reply


Messages In This Thread
IsPlayerInRangeOfPoint - by AlfaSufaIndo - 20.10.2018, 07:17
Re: IsPlayerInRangeOfPoint - by Calisthenics - 20.10.2018, 07:48
Re: IsPlayerInRangeOfPoint - by AlfaSufaIndo - 20.10.2018, 08:03
Re: IsPlayerInRangeOfPoint - by Calisthenics - 20.10.2018, 08:08
Re: IsPlayerInRangeOfPoint - by AlfaSufaIndo - 20.10.2018, 08:10
Re: IsPlayerInRangeOfPoint - by Calisthenics - 20.10.2018, 08:31
Re: IsPlayerInRangeOfPoint - by Kane - 20.10.2018, 08:43
Re: IsPlayerInRangeOfPoint - by AlfaSufaIndo - 20.10.2018, 12:49

Forum Jump:


Users browsing this thread: 1 Guest(s)