Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A very, very annoying thing, what is wrong? I don't see it.
#1
Question 
this...

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.Confused
Reply

#2
(12-30-2011, 08:59)xplosiff Wrote:
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);

Code:
    inventoryitems = [];
inventoryitems[0] = SpawnStruct();
    inventoryitems[0].name = "sa80";
    inventoryitems[0].icon = "weapon_sa80";
    inventoryitems[0].iconsize = 3;
inventoryitems[1] = SpawnStruct();
    inventoryitems[1].name = "usp45";
    inventoryitems[1].icon = "weapon_usp_45";
    inventoryitems[1].iconsize = 2;
inventoryitems[2] = SpawnStruct();
    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);
helped ya? rep me +
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  The next big thing Pozzuh 7 4,014 07-21-2013, 13:56
Last Post: kokole
Question Help Weird Thing Dr3am95 10 6,896 05-11-2013, 21:14
Last Post: hillbilly
  Help What's Wrong 2 Dominator56 5 3,803 02-19-2013, 21:46
Last Post: Dominator56
  Help What's wrong ? Dominator56 4 3,075 02-17-2013, 12:12
Last Post: Dominator56
  I know I've posted this in a wrong place Ra3shed 2 2,356 02-16-2013, 21:15
Last Post: Arteq
Exclamation No site change after 12 rounds... Bug or wrong settings? ChrisPiHD 1 2,481 09-21-2012, 18:16
Last Post: estebespt
  Final killcam slowmo thing RaZ 4 9,036 08-22-2012, 21:37
Last Post: RaZ
  The Annoying Riot Model master131 24 12,750 05-26-2012, 21:56
Last Post: RaZ
  If has weapon change thing Gamemaster20 5 3,781 04-12-2012, 01:32
Last Post: Gamemaster20
  Something wrong with background Arteq 2 2,435 02-27-2012, 17:01
Last Post: Arteq

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.