18.03.2013, 18:12
Checkpoint / Area Sub-Streamer
These includes help organize your checkpoints and areas into macro functions which avoids the hassle of having a lot of code in OnPlayerEnterDynamicCP(), OnPlayerLeaveDynamicCP(), OnPlayerEnterDynamicArea() and OnPlayerLeaveDynamicArea(). There is a trade off with this you will lose a bit of efficiency since the sub-streamer needs to search through the array to look up which CP/Area has been triggered.
Usage:
Areas
Checkpoints
Example Areas
Example Checkpoints
Additional Notes
areaid = Area ID in the streamer
areaindex = Area index in the sub-streamer
cpid = Checkpoint ID in the streamer
cpindex = Checkpoint Index in the substreamer
You can use multiple macro references to call a single macro.
Download: http://www.mediafire.com/?luan2tbehkxwnpe
These includes help organize your checkpoints and areas into macro functions which avoids the hassle of having a lot of code in OnPlayerEnterDynamicCP(), OnPlayerLeaveDynamicCP(), OnPlayerEnterDynamicArea() and OnPlayerLeaveDynamicArea(). There is a trade off with this you will lose a bit of efficiency since the sub-streamer needs to search through the array to look up which CP/Area has been triggered.
Usage:
Areas
Code:
stock AddDynamicSphereArea(Float:x, Float:y, Float:z, Float:size, AName[], worldid = -1, interiorid = -1, playerid = -1) stock AddDynamicCubeArea(Float:minx, Float:miny, Float:minz, Float:maxx, Float:maxy, Float:maxz, AName[], worldid = -1, interiorid = -1, playerid = -1) stock RemoveDynamicArea(areaindex)
Code:
stock AddDynamicCP(Float:x, Float:y, Float:z, Float:size, CName[], worldid = -1, interiorid = -1, playerid = -1, Float:streamdistance = 100.0) stock RemoveDynamicCheckPoint(cpindex)
Code:
#include <dynamicarea>
public OnGameModeInit()
{
AddDynamicSphereArea(1000.0, 1000.0, 1000.0, 4.0, "TestArea");
}
OnArea:TestArea(playerid, areaid, areaindex)
{
SendClientMessage(playerid, "You entered the TestArea");
return 1;
}
ExitArea:TestArea(playerid, areaid, areaindex)
{
SendClientMessage(playerid, "You left the TestArea");
return 1;
}
Code:
#include <dynamiccp>
public OnGameModeInit()
{
AddDynamicCP(1000.0, 1000.0, 1000.0, 2.0, "TestCP")
}
OnCheckPoint:TestCP(playerid, cpid, cpindex)
{
SendClientMessage(playerid, "You entered the TestCP");
return 1;
}
ExitCheckPoint:TestCP(playerid, cpid, cpindex)
{
SendClientMessage(playerid, "You left the TestCP");
return 1;
}
areaid = Area ID in the streamer
areaindex = Area index in the sub-streamer
cpid = Checkpoint ID in the streamer
cpindex = Checkpoint Index in the substreamer
You can use multiple macro references to call a single macro.
Code:
AddDynamicSphereArea(2000.0, 1000.0, 1000.0, 4.0, "TestArea");
AddDynamicSphereArea(3000.0, 1000.0, 1000.0, 4.0, "TestArea");
AddDynamicSphereArea(4000.0, 1000.0, 1000.0, 4.0, "TestArea");



It would require some checking however in case a dynamic area/cp was created independently. Another issue is how large to index the array 1000, 10000? I'm guessing that would be up to the end user but there is still the risk of OOB errors possibly if too many areas are created which I doubt would happen anyways.