Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #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);
  
enablefeaturesallfeatures -);
  }
function 
onKeyPressed(codekeyscancode) {
  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";
    
509;
    
203;

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

      new 
GuiTextListCtrl("Inventory_TextList1") {
        
profile GuiBlueTextListProfile;
        
height 32;
        
horizsizing "width";
        
width 289;
        
clearrows();
        for (
temp.weps 0temp.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;
      
190;
    }
    new 
GuiButtonCtrl("Inventory_Button2") {
      
profile GuiBlueButtonProfile;
      
text "Equip";
      
width 320;
      
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
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 03:07 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.