View Single Post
  #3  
Old 07-20-2013, 02:45 AM
baseman101 baseman101 is offline
Scripter
baseman101's Avatar
Join Date: Nov 2012
Location: Purcellville, VA
Posts: 76
baseman101 will become famous soon enough
Hey,

Thanks for your quick reply! Unfortunately, this does not change the alpha of the image like I stated. I'll give you my full code if that helps.

PHP Code:
//Scripted by Graal801624

function onActionServerSide(cmdtemp.staffCode) {
  
//What happens if the player activates one of the tools.
  
if(cmd == "staffbar") {
    switch(
temp.staffCode) {
      case 
0:
        
//Boots
        
echo("The player activated Tool One");
      break;
      
      case 
1:
        
//Drag
        
echo("The player activated Tool Two");
      break;
      
      case 
2:
        
//Staff tag
        
echo("The player activated Tool Three");
      break;
      
      case 
3:
        
//Testing
        
echo("The player activated Tool Four");
      break;
    }
  }
}

//#CLIENTSIDE
function getTools() {
  
//In the return, type the tools with an image.
  
return {{"Tool 1","red.png"},{"Tool 2","orange.png"},{"Tool 3","yellow.png"},{"Tool 4","green.png"},{"Tool 5","blue.png"},{"Tool 6","purple.png"}};
}

function 
getDefAlpha() {
  
//Type here what you want the default non-selected alpha to be.
  
return 0.3;
}

function 
onCreated() {
  new 
GuiBitmapCtrl("DoctorStaffBar_Window") {
    
profile GuiDefaultProfile;
    
bitmap "black";
    
height 70;
    
width 400;
    
15;
    
= (GraalControl.height 115);
    
temp.int 0;
    
this.tools getTools();
    
temp.xaddgui 10;
    for (
temp.tools this.tools) {
      new 
GuiShowImgCtrl("DoctorStaffBar_Control" temp.int) {
        
temp.xaddgui;
        
30;
        
width 500;
        
height 30;
        
image getTools()[temp.int][1];
        
alpha getDefAlpha();
      }
      
temp.int++;
      
temp.xaddgui += 40;
    }
    new 
GuiShowImgCtrl("DoctorStaffBar_Control_Text") {
        
5;
        
0;
        
width 500;
        
height 30;
        
text getTools()[0][0];
      }
  }
  
this.staffCode 0;
  
DoctorStaffBar_Control0.alpha 1;
}

function 
onKeyPressed(keynamekeycode) {
  if(
keyname == 49) {
    
//Number 1
    
this.staffCode 0;
    
selectToolName(this.staffCode);
  }
  
  if(
keyname == 50) {
    
//Number 2
    
this.staffCode 1;
    
selectToolName(this.staffCode);
  }
  
  if(
keyname == 51) {
    
//Number 3
    
this.staffCode 2;
    
selectToolName(this.staffCode);
  }
  
  if(
keyname == 52) {
    
//Number 4
    
this.staffCode 3;
    
selectToolName(this.staffCode);
  }
  
  if(
keyname == 53) {
    
//Number 5
    
this.staffCode 4;
    
selectToolName(this.staffCode);
  }
  
  if(
keyname == 54) {
    
//Number 6
    
this.staffCode 5;
    
selectToolName(this.staffCode);
  }
  
  if(
keyname == 55) {
    
//Number 7
    
this.staffCode 6;
    
selectToolName(this.staffCode);
  }
  
  if(
keyname == 56) {
    
//Number 8
    
this.staffCode 7;
    
selectToolName(this.staffCode);
  }
  
  if(
keyname == 87) {
    
//Activate selected staff tool with w
    
triggerServer("gui"this.name"staffbar"this.staffCode);
  }
}

function 
selectToolName(temp.staffCode) { 
  
temp.code 0;
  
temp.tools getTools();
  
DoctorStaffBar_Control_Text.text temp.tools[temp.staffCode][0];
  for (
temp.code 0temp.code temp.tools.size(); temp.code++) {
    
temp.thing = ("DoctorStaffBar_Control" temp.code); 
    if (
temp.code == temp.staffCode) { 
      
temp.thing.alpha 1
    } else {
      
temp.thing.alpha getDefAlpha();
    }
  } 

Thanks,
The Doctor
Reply With Quote