20.10.2018, 08:31
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.
When player will be streamed, it will show the checkpoint or disable if not. The callback when enter one is
Streamer provides an extra id and can be used to skip loops if you set an offset.
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.
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);
pawn Code:
public OnPlayerEnterDynamicCP(playerid, checkpointid)
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);
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;
}