19.06.2014, 22:51
I'm making my own simple object editor but I'm not sure how to check for an open slot if an earlier created object was deleted to take its space. For example, I create 15 objects and delete object number 8, then I'll create another object and have it replace ID 8 then continue at 16 for the next object. I have a code that could be altered if it's needed. I'm not entirely sure if the method I have already works or not. Thanks in advance.
pawn Код:
CMD:createobject(playerid,params[])
{
new Float:pos[3], str[128], objectid;
GetPlayerPos(playerid,pos[0],pos[1],pos[2]);
for(new o; o < MAXOBJ; o++)
{
if(ObjInfo[o][used] == 0)
{
ObjInfo[o][objID] = CreateDynamicObject(objectid,pos[0]+2, pos[1]+3, pos[2],0,0,0);
ObjInfo[o][used] = 1;
ObjInfo[o][objX] = pos[0];
ObjInfo[o][objY] = pos[1];
ObjInfo[o][objZ] = pos[2];
ObjInfo[o][objRX] = 0;
ObjInfo[o][objRY] = 0;
ObjInfo[o][objRZ] = 0;
EditObject(playerid,o);
}
}
return 1;
}