Advertisement
Guest User

Untitled

a guest
Mar 18th, 2012
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. join("guiprofiles");
  2.  
  3.  
  4. function onActionBuyHat() {
  5.   temp.hat_name = params[1];
  6.   temp.hat_price = params[2];
  7.   echo("Buying" SPC temp.hat_name);
  8.   if (temp.hat_name in clientr.questhats.tokenize(",")) {
  9.     return;
  10.   } else {
  11.     if (!(player.rupees = > temp.hat_price)) {
  12.       echo(player.account SPC "doesn't have enough!");
  13.     } else {
  14.       player.rupees -= temp.hat_price;
  15.       player.clientr.questhats.add(temp.hat_name);
  16.     }
  17.   }
  18. }
  19.  
  20. //#CLIENTSIDE
  21.  
  22. function onCreated() {
  23.   DrawGUI();
  24. }
  25.  
  26. function DrawGUI() {
  27.  
  28.   new GuiControl("HatShop_StatusBar") {
  29.     useownprofile = true;
  30.     width = 155;
  31.     height = 20;
  32.     x = screenwidth / 2 - width / 2;
  33.     y = screenheight / 2 - height / 2 - height * 3.75;
  34.     visible = false;
  35.     profile.opaque = true;
  36.     profile.border = 1;
  37.     profile.fillcolor = {
  38.       0, 0, 0, 200
  39.     };
  40.  
  41.     new GuiTextCtrl("HatShop_Text") {
  42.       useownprofile = true;
  43.       width = 155;
  44.       height = 20;
  45.       x = 5;
  46.       y = 0;
  47.       profile.fontstyle = "b";
  48.     }
  49.   }
  50.  
  51.   new GuiControl("HatShop_StatusBar2") {
  52.     useownprofile = true;
  53.     width = 155;
  54.     height = 20;
  55.     x = screenwidth / 2 - width / 2;
  56.     y = screenheight / 2 - height / 2 - height * 4.9;
  57.     visible = false;
  58.     profile.opaque = true;
  59.     profile.border = 1;
  60.     profile.fillcolor = {
  61.       0, 0, 0, 200
  62.     };
  63.  
  64.     new GuiTextCtrl("HatShop_Text2") {
  65.       useownprofile = true;
  66.       width = 155;
  67.       height = 20;
  68.       x = 5;
  69.       y = 0;
  70.       profile.fontstyle = "b";
  71.     }
  72.   }
  73.  
  74.   new GuiControl("HatShop_Window") {
  75.     npcname = this;
  76.     profile = "DefaultBacking";
  77.     width = 155;
  78.     height = 125;
  79.     x = screenwidth / 2 - width / 2;
  80.     y = screenheight / 2 - height / 2;
  81.     visible = false;
  82.  
  83.     new GuiShowImgCtrl("HatShop_HatImage") {
  84.       width = 50;
  85.       height = 50;
  86.       x = 50;
  87.       y = 15;
  88.     }
  89.  
  90.     new GuiShowImgCtrl("HatShop_Buy") {
  91.       image = "delt_iphone_hatbuttonbuy.png";
  92.       width = 66;
  93.       height = 40;
  94.       x = 10;
  95.       y = 75;
  96.     }
  97.  
  98.     new GuiShowImgCtrl("HatShop_Close") {
  99.       image = "delt_iphone_hatbuttonclose.png";
  100.       width = 66;
  101.       height = 40;
  102.       x = 80;
  103.       y = 75;
  104.     }
  105.   }
  106. }
  107.  
  108. function onMouseDown() {
  109.   if (mousex in | this.x, this.x + 2 | && mousey in | this.y, this.y + 2 | ) {
  110.     SetHat(this.hat_name, this.hat_price, this.hat_icon, this.hat_title);
  111.   }
  112. }
  113.  
  114. function SetHat(hat_name, hat_price, hat_icon, hat_title) {
  115.   HatShop_Window.visible = true;
  116.   HatShop_StatusBar2.visible = true;
  117.   HatShop_StatusBar.visible = true;
  118.   HatShop_Text.text = "Price:" SPC hat_price;
  119.   HatShop_HatImage.image = hat_icon;
  120.   HatShop_Text2.text = hat_title;
  121. }
  122.  
  123. function HatShop_Buy.onMouseDown() {
  124.   if (HatShop_Window.npcname == this) {
  125.     triggeraction(this.x, this.y, "BuyHat", "", this.hat_name, this.hat_price);
  126.   }
  127. }
  128.  
  129. function HatShop_Close.onMouseDown() {
  130.   HatShop_Window.visible = false;
  131.   HatShop_StatusBar.visible = false;
  132.   HatShop_StatusBar2.visible = false;
  133. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement