25.04.2013, 23:55
(
Последний раз редактировалось Pottus; 26.04.2013 в 01:03.
)
@ijumbo But that isn't a very nice way how about this
Try this you can decrease MAX_LOADER_OBJECTS if your not going to ever get near 1000 you could also change CreateObject() and DeleteObject() to streamer counterparts cheers.
To remove all objects on a timer
Try this you can decrease MAX_LOADER_OBJECTS if your not going to ever get near 1000 you could also change CreateObject() and DeleteObject() to streamer counterparts cheers.
pawn Код:
#define MAX_LOADER_OBJECTS 1000
new ObjectList[MAX_LOADER_OBJECTS] = { INVALID_OBJECT_ID, ... };
stock AddObject(objectid, Float:ox, Float:oy, Float:oz, Float:rx, Float:ry, Float:rz)
{
for(new i = 0; i < MAX_LOADER_OBJECTS; i++)
{
if(ObjectList[i] == INVALID_OBJECT_ID) ObjectList[i] = CreateObject(objectid, ox, oy, oz, rx, ry, rz);
return ObjectList[i];
}
return INVALID_OBJECT_ID;
}
stock RemoveObject(indexid)
{
if(ObjectList[indexid] != INVALID_OBJECT_ID)
{
DestroyObject(ObjectList[indexid]);
ObjectList[indexid] = INVALID_OBJECT_ID;
return 1;
}
return 0;
}
forward RemoveAllObjects();
public RemoveAllObjects()
{
new RemovedObjects;
for(new i = 0; i < MAX_LOADER_OBJECTS; i++)
{
if(ObjectList[i] != INVALID_OBJECT_ID)
{
DestroyObject(ObjectList[i]);
ObjectList[i] = INVALID_OBJECT_ID;
RemovedObjects++;
}
}
return RemovedObjects;
}
pawn Код:
SetTimer("RemoveAllObjects", 300000, false);