View Single Post
  #15  
Old 10-17-2009, 01:21 PM
scriptless scriptless is offline
Banned
Join Date: Dec 2008
Location: N-Pulse
Posts: 1,412
scriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to behold
Basically. I want to make a simple inventory.

array[i].name to be the item. Were i represents the index of the item in inventory. Each appending name after it to represent that detail about the item.

This, however, works. But is there any simpler way to do such a task? I mean I dont see why I must assign a value using add(). =/

PHP Code:
//#CLIENTSIDE
function onCreated()
{
  
temp.obj = new TStaticVar();
  for( 
i=0i<10i++) {
    
temp.obj.add("");
    
withtemp.obj[i] ) {
      
this.var = "test:" SPC i;
    }
  }


  
player.chat temp.obj[1].var;

Does:
NPC Code:
temp.obj = new TStaticVar();



Reset the array???

Also, this does not work. Any thoughts?

PHP Code:
//#CLIENTSIDE
function onCreated()
{
  
temp.obj = new TStaticVar();
  
temp.obj2 = new TStaticVar();
  for( 
i=0i<10i++) {
    
temp.obj.add("");
    
withtemp.obj[i] ) {
      
this.var = "test:" SPC i;
    }
  }
  
temp.obj2 temp.obj[0];

  
player.chat temp.obj2.var;

Just wondering about the above. Why would that not work?

Last edited by scriptless; 10-17-2009 at 01:32 PM..
Reply With Quote