View Single Post
  #1  
Old 05-17-2011, 01:17 AM
Astram Astram is offline
Era iPhone PR
Astram's Avatar
Join Date: Aug 2010
Posts: 324
Astram can only hope to improve
Send a message via AIM to Astram
Talking Inventory Script

PHP Code:
//#CLIENTSIDE
function onCreated()
  {
  
setTimer(.005);
  
enablefeatures( allfeatures -4 );
  }
function 
onKeyPressed(code, key, scancode) {
  if (
key == "q" || key == "Q")
    {
    if (
this.on == false)
      {
      
this.on = true;
      
onOpenInv();
      }
    else
      {
      
this.on = false;
      
Inventory_Window1.hide();
      }
    }
  }
function 
onOpenInv()
  {
  new 
GuiWindowCtrl("Inventory_Window1") {
    
profile = GuiBlueWindowProfile;
    
clientrelative = true;
    
clientextent = "320,221";

    
canmaximize = false;
    
canminimize = false;
    
canclose = false;
    
canmove = true;
    
canresize = true;
    
closequery = false;
    
destroyonhide = false;
    
text = "Inventory";
    
x = 509;
    
y = 203;

    new 
GuiScrollCtrl("Inventory_TextList1_Scroll") {
      
profile = GuiBlueScrollProfile;
      
height = 115;
      
hscrollbar = "alwaysOff";
      
vscrollbar = "dynamic";
      
width = 293;
      
x = 12;
      
y = 8;

      new 
GuiTextListCtrl("Inventory_TextList1") {
        
profile = GuiBlueTextListProfile;
        
height = 32;
        
horizsizing = "width";
        
width = 289;
        
clearrows();
        for (
temp.weps = 0; temp.weps < player.weapons.size(); temp.weps ++)
          {
          if (!(
player.weapons[(@temp.weps)].name.starts("-")))
            {
          
addrow(temp.weps,player.weapons[temp.weps].name);
          }
        }
      }
    }
    new 
GuiButtonCtrl("Inventory_Button1") {
      
profile = GuiBlueButtonProfile;
      
text = "Close";
      
width = 320;
      
y = 190;
    }
    new 
GuiButtonCtrl("Inventory_Button2") {
      
profile = GuiBlueButtonProfile;
      
text = "Equip";
      
width = 320;
      
y = 160;
    }
    
Inventory_Window1.show();
  }
}

function 
Inventory_Button1.onAction() {
  
Inventory_Window1.hide();
}

function 
Inventory_Button2.onAction() {
  
Inventory_Window1.hide();
  
temp.wep = Inventory_TextList1.getSelectedText();
  
selectedweapon = player.weapons.index(findweapon(temp.wep));
} 
If you guys want to beef up your server a bit with a custom inventory feel free to take this! I havent tested it yet but it should run just find.

Even though I have already done these things, I would like to implent a new cleaner version into this item system.

-Admin Item Generator (via GUI with no scripting involved)
-Drop System
-Bag Support (the item bag (Astram/Tools; Toad/Blah))

Enjoy this while you can, while I will be working on another
__________________
-Toad
The worlds biggest Toad fan...
Era iPhone FTW!



Last edited by Astram; 05-17-2011 at 01:17 AM.. Reason: Taking out findplayer
Reply With Quote