04.02.2014, 13:21
I really don't know what your thinking with this system but the design is terrible it should look something more like this.
pawn Код:
#define MAX_METEORS 101
stock CreateMeteor(id,Float:X,Float:Y,Float:Z)
{
for(new i = 0; i < MAX_METEORS; i++)
{
if(!MDat_@d_@a[i][Created])
{
MDat_@d_@a[i][ID] = id;
MDat_@d_@a[i][x] = X;
MDat_@d_@a[i][y] = Y;
MDat_@d_@a[i][z] = Z;
MDat_@d_@a[i][Created] = 1;
MDat_@d_@a[i][Check] = CreateObject(1303, X, Y, Z, 0,0,0);
MDat_@d_@a[i][mBit_1] = CreateObject(18690, 0,0,-100,0,0,0);
MDat_@d_@a[i][mBit_2] = CreateObject(2780, 0,0,-100,0,0,0,500.0);
AttachObjectToObject(MDat_@d_@a[i][mBit_1], MDat_@d_@a[i][Check],0,0,0,0,0,0);
AttachObjectToObject(MDat_@d_@a[i][mBit_2], MDat_@d_@a[i][Check],0,0,0,0,0,0);
printf("METEOR CREATED - ID: %d", id);
// Return the index
return i;
}
}
printf("ERROR: Tried to create too many metors");
return 0;
}
stock DestroyMeteor(index)
{
if(MDat_@d_@a[index][Created])
{
DestroyObject(MDat_@d_@a[index][Check]);
DestroyObject(MDat_@d_@a[index][mBit_1]);
DestroyObject(MDat_@d_@a[index][mBit_2]);
MDat_@d_@a[index][Created] = 0;
return 1;
}
return 0;
}