Graal Pastebin

New Paste
Pasted on August 16, 2011.
View the raw file

/* Uses two lists to show two categories of weapons. 
List one shows all weapons. Hidden (-Weapon/Name) and non-hidden (Weapon/Name)
List two shows only the non-hidden weapons (Weapon/Name)
To add or remove the weapons;
Type the name of the weapon into the add or remove box and hit the button.
Tap the button twice to update the list.
Opening the GUI is easy. Just say "/wepcontrol"
*/
function onActionServerSide() {
  if (params[0] == "addweaponwep") addweapon(params[1]); //Add the weapon.
  if (params[0] == "takeweaponwep") removeweapon(params[1]); //Take the weapon.
}
 
//#CLIENTSIDE
function onPlayerChats() {
  if (player.chat == "/wepcontrol") {
    player.chat = "";
    WEP_Window1.visible = true; //Open the GUI
  }
}
 
function onCreated() {
  new GuiWindowCtrl("WEP_Window1") {
    profile = GuiWindowProfile;
    clientrelative = true;
    clientextent = "260,385";
    canmaximize = false;
    canmove = true;
    canresize = true;
    closequery = false;
    destroyonhide = false;
    text = "WEP - Control";
    x = 413;
    y = 73;
    new GuiScrollCtrl("WEP_TextList5_Scroll") {
      profile = GuiScrollProfile;
      height = 307;
      hscrollbar = "alwaysOff";
      vscrollbar = "dynamic";
      width = 128;
      new GuiTextListCtrl("WEP_TextList5") {
        profile = GuiTextListProfile;
        height = 32;
        horizsizing = "width";
        width = 124;
      }
    }
    new GuiScrollCtrl("WEP_TextList6_Scroll") {
      profile = GuiScrollProfile;
      height = 307;
      hscrollbar = "alwaysOff";
      vscrollbar = "dynamic";
      width = 129;
      x = 131;
      new GuiTextListCtrl("WEP_TextList6") {
        profile = GuiTextListProfile;
        height = 32;
        horizsizing = "width";
        width = 125;
      }
    }
    new GuiButtonCtrl("WEP_Button1") {
      profile = GuiButtonProfile;
      text = "Remove";
      width = 80;
      x = 5;
      y = 349;
    }
    new GuiButtonCtrl("WEP_Button2") {
      profile = GuiButtonProfile;
      text = "Add";
      width = 80;
      x = 5;
      y = 314;
    }
    new GuiTextEditCtrl("WEP_TextEdit1") {
      profile = GuiTextEditProfile;
      height = 20;
      width = 163;
      x = 91;
      y = 319;
    }
    new GuiTextEditCtrl("WEP_TextEdit2") {
      profile = GuiTextEditProfile;
      height = 20;
      width = 163;
      x = 91;
      y = 354;
    }
  }
}
 
function WEP_Button1.onAction() { //Hit once to taje weapon, hit twice to update list.
  // Button "Remove" has been pressed
  UpdateList1(); //Updates List
  UpdateList2();
  removechat(); //Sets Chat
  triggerserver("gui", this.name, "takeweaponwep", WEP_TextEdit2.text);
}
 
function WEP_Button2.onAction() { //Hit once to add weapon, hit twice to update list.
  // Button "Add" has been pressed
  UpdateList1(); //Updates List
  UpdateList2();
  addchat(); //Sets Chat
  triggerserver("gui", this.name, "addweaponwep", WEP_TextEdit1.text);
}
 
function UpdateList1() {
  WEP_TextList5.clearrows();
  for (temp.weps = 0; temp.weps < player.weapons.size(); temp.weps++) {
    WEP_TextList5.addrow(temp.weps, player.weapons[temp.weps].name);
  }
}
 
function UpdateList2() {
  WEP_TextList6.clearrows();
  for (temp.weps = 0; temp.weps < player.weapons.size(); temp.weps++) {
    if (!(player.weapons[(@temp.weps)].name.starts("-"))) {
      WEP_TextList6.addrow(temp.weps, player.weapons[temp.weps].name);
    }
  }
}
 
function RemoveChat() {
  if (!(WEP_TextEdit2.text == NULL)) player.chat = "Removed: " @ WEP_TextEdit2.text; //Sets chat
}
 
function AddChat() {
  if (!(WEP_TextEdit1.text == NULL)) player.chat = "Added: " @ WEP_TextEdit1.text; //Sets Chat
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131