12-30-2011, 08:59
this...
no matter what the name is, it always prints the name as usp45 and the item id is always 2... this is giving me a headache.
I tried theifs in a for(i=0; i<inventoryitems.size; i++), but it creates an infinite loop and lags the server for a few seconds. if i put it up as a level.inventoryitems instead and have the items listed in init, the name is always medkit and the itemid is always 0. what the hell is going on? this is just annoying the living crap out of me. it is perfectly fine, even with a for()
if i change the if to else if, the name is correct but the item is always 0.
Code:
inventoryitems = [];
inventoryitems[0].name = "sa80";
inventoryitems[0].icon = "weapon_sa80";
inventoryitems[0].iconsize = 3;
inventoryitems[1].name = "usp45";
inventoryitems[1].icon = "weapon_usp_45";
inventoryitems[1].iconsize = 2;
inventoryitems[2].name = "medkit";
inventoryitems[2].icon = "hint_health";
inventoryitems[2].iconsize = 1;
item = "";
if(inventoryitems[0].name == name) item = 0;
if(inventoryitems[1].name == name) item = 1;
if(inventoryitems[2].name == name) item = 2;
iPrintln("Adding item: " + name + " to inventory.");
iPrintln("Item ID: " + item);
no matter what the name is, it always prints the name as usp45 and the item id is always 2... this is giving me a headache.
I tried theifs in a for(i=0; i<inventoryitems.size; i++), but it creates an infinite loop and lags the server for a few seconds. if i put it up as a level.inventoryitems instead and have the items listed in init, the name is always medkit and the itemid is always 0. what the hell is going on? this is just annoying the living crap out of me. it is perfectly fine, even with a for()
if i change the if to else if, the name is correct but the item is always 0.