04.05.2013, 17:35
Pretty bad way to do it actually, it's better if you make a function AddRobPoint() for instance and this is very simple example...
That is just a basic set up you'll need more stuff in the enum such as recentlyrobbed, timetorob, playerrobid etc whatever you need goes into there then you just need to to update AddRobPoint() with additional parameters such as CP size etc in fact pretty much any dynamic system your write is going to follow this template design. I've written dozens of them so I can tell you the setup is almost always the same when designing dynamic systems.
pawn Код:
#define INVALID_ROB_POINT (0xFFFF)
#define MAX_ROB_POINTS 100
enum ROBDATA {
RobID,
bool:beingrobbed
}
new RobPoints[MAX_ROB_POINTS][ROBDATA];
public OnGameModeInit()
{
for(new i = 0; i < MAX_ROB_POINTS; i++) { RobPoints[i][RobID] = INVALID_ROB_POINT; }
}
stock AddRobPoint(Float:robx, Float:roby, Float:robz)
{
for(new i = 0; i < MAX_ROB_POINTS; i++)
{
if(RobPoints[i][RobID] == INVALID_ROB_POINT)
{
RobPoints[i][RobID] = CreateDynamicCP(robx, roby, robz, 2.0);
return i;
}
}
return INVALID_ROB_POINT;
}

