Thread: Chat Room
View Single Post
  #3  
Old 09-04-2011, 10:52 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Trashed the window and added a border instead. Looks much nicer.
PHP Code:
function onActionServerSide() {
  if (
params[0] == "sendtext2") {
    for (
temp.pl: allplayers) {
      if (
temp.pl.level != NULL) {
        
temp.pl.triggerclient(this.name, "gettext2", params[1], player.nick);
      }
    }
  }
}

//#CLIENTSIDE
function onCreated() {
  new 
GuiControl("Msg2_Window1") {
    
useownprofile = true;
    
profile.border = 1;
    
profile.opaque = true;
    
profile.fillColor = {0, 55, 150, 225};
    
width = 328.5;
    
destroyonhide = true;
    
height = 250;
    
canmove = true;
    
x = 517;
    
y = 203;
    new 
GuiScrollCtrl("Msg2_Chatbox_Scroll") {
      
profile = GuiBlueScrollProfile;
      
height = 215;
      
hscrollbar = "dynamic";
      
vscrollbar = "dynamic";
      
width = 316;
      
x = 6.5;
      
y = 6.5;
      new 
GuiMLTextCtrl("Msg2_Chatbox") {
        
profile = GuiBlueMLTextProfile;
        
height = 17;
        
horizsizing = "width";
        
text = "<b><font color = white>System</b>: Input /clear to clear the message box.";
        
width = 312;
        
profile.fontsize = 14.3;
        
profile.fonttype = "Arial";
        
profile.textshadow = false;
      }
    }
    new 
GuiTextEditCtrl("Msg2_ChatBar") {
      
profile = GuiBlueTextEditProfile;
      
height = 20;
      
width = 316;
      
x = 6;
      
y = 225;
    }
  }
}

function 
Msg2_ChatBar.onAction() {
  
temp.msg2 = "";
  if (
Msg2_ChatBar.text == "/clear") {
    
Msg2_Chatbox.text = "Cleared!";
  } else {
    if (
Msg2_ChatBar.text != NULL) {
      
temp.msg2 = Msg2_ChatBar.text;
      
triggerserver("weapon", this.name, "sendtext2", temp.msg2);
      
Msg2_ChatBar.text = "";
    }
  }
  if (
temp.msg2.starts("/font ")) {
    
say2("Works");
  }
}

function 
onActionClientSide() {
  if (
params[0] == "gettext2") {
    
Msg2_Chatbox.addtext("<br><b><font color = cyan>" @ params[2] @ "</b>: " @ params[1], false);
    
Msg2_ChatBox.scrolltobottom();
  }
} 
__________________
Reply With Quote