Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Hat System Help (https://forums.graalonline.com/forums/showthread.php?t=134262911)

Astram 04-20-2011 07:41 PM

Hat System Help
 
PHP Code:

//#CLIENTSIDE
function onKeyPressed(code, key, scancode) {
if (
key == clientr.hatkey)
  {
  new 
GuiWindowCtrl("Hats_Window1") {
    
profile = GuiBlueWindowProfile;
    
clientrelative = true;
    
clientextent = "188,174";

    
canmove = true;
    
canresize = false;
    
closequery = false;
    
destroyonhide = false;
    
text = "Hats";
    
x = 568;
    
y = 207;

    new 
GuiScrollCtrl("Hats_TextList1_Scroll") {
      
profile = GuiBlueScrollProfile;
      
height = 132;
      
hscrollbar = "alwaysOff";
      
vscrollbar = "dynamic";
      
width = 152;
      
x = 16;

      new 
GuiTextListCtrl("Hats_TextList1") {
        
profile = GuiBlueTextListProfile;
        
height = 32;
        
horizsizing = "width";
        
width = 148;
        
clearrows();
        for (
temp.i=1; temp.i <= clientr.hatsize; temp.i++)
          {
        
addrow(0,clientr.hat(@ temp.i));
        }
       }
       
Hats_Window1.show();
    }
    new 
GuiButtonCtrl("Hats_Button1") {
      
profile = GuiBlueButtonProfile;
      
text = "Equip Hat";
      
width = 80;
      
x = 53;
      
y = 138;
    }
    
Hats_Window1.show();
  }
  }
}
function 
Hats_Button1.onAction() {
temp.text = Hats_TextList1.getSelectedText();
if (
temp.text != player.attr[1])
{
  
player.attr[1] = temp.text;
  
client.message.add("Equiped "@temp.text);
  }
  else
  {
  
player.attr[1] = "no-hat.png";
  
client.message.add("Took Off My Hat");
  }
  } 

Lets say my clientr.hatsize = 5;
It displays the 5 hats you have. Yet it says 0, I belive there might be a problem right here ++ addrow(0,clientr.hat(@ temp.i));
Because there are flags clientr.hat1
clientr.hat2....
Yeah so I need help with fixing that

Crow 04-20-2011 07:44 PM

Should be
PHP Code:

addrow(i, clientr.("hat" @ i)); 

instead.

Deas_Voice 04-25-2011 03:25 PM

a tips, instead of recreating the gui each time you open the gui, hide/show the window, and create the gui onCreated.

PHP Code:

windowobj.visible = true/false 


fowlplay4 04-25-2011 03:50 PM

I believe I've posted this before but at least make an effort to style your code properly. You can even have this site do it for you: http://jsbeautifier.org/


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

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