20.04.2015, 16:29
Rule of thumb when designing dynamic systems.
- The return value for the creation function should be the INDEX in which the item was created.
- All slots full? return -1
Furthermore......
That is very silly to do and another rule of thumb never ever use == when checking floats!
What you should do is this.
Define your item types
No need for silly checks now it's nice and simple.
Other things don't create multiple functions that does the same thing as another function!
Just call the create function when needed instead from this function.
This belongs in the enum not it's own variable!
You should also return the index the object was created on after this line.
- The return value for the creation function should be the INDEX in which the item was created.
- All slots full? return -1
Furthermore......
Код:
if(Item[i][ItemPosX] == 0 && Item[i][ItemPosY] == 0 && Item[i][ItemPosZ] == 0)
What you should do is this.
Define your item types
Код:
#define ITEM_TYPE_NONE 0 #define ITEM_TYPE_DEAGLE 1 #define ITEM_TYPE_SPAS 2
Код:
if(Item[i][ItemType] == ITEM_TYPE_NONE)
Код:
stock DropItem(model, amount, type, Float:X, Float:Y, Float:Z, world, interior)
This belongs in the enum not it's own variable!
Код:
DropObject[i] = CreateObject(model, X, Y, Z, RX, RY, RZ, world);
Код:
return i;