Thread: Chat System
View Single Post
  #1  
Old 11-26-2011, 09:12 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
Chat System

This is just a really basic (bare bones) of a chat system.
I decided to post it here seeming as I have no use for it.
I originally scripted it just for fun.

PHP Code:
function onActionServerSide() {
  if (
params[0] == "add") {
    for (
temp.pl: allplayers) {
      
pl.triggerclient("weapon", this.name, "add", player.nick, params[1]);
    }
  }
}
//#CLIENTSIDE
function onCreated() {
  new 
GuiWindowCtrl("Chat_Window") {
    
profile = GuiBlueWindowProfile;
    
clientrelative = true;
    
clientextent = "320,240";
    
canclose = false;
    
canmaximize = false;
    
canminimize = false;
    
canmove = false;
    
canresize = false;
    
closequery = false;
    
destroyonhide = false;
    
text = "Chat";
    
x = screenwidth / 2 - width / 2;
    
y = screenheight / 2 - height / 2;
    new 
GuiScrollCtrl("Chat_MultiLine_Scroll") {
      
profile = GuiBlueScrollProfile;
      
height = 221;
      
hscrollbar = "dynamic";
      
vscrollbar = "dynamic";
      
width = 320;
      new 
GuiMLTextCtrl("Chat_MultiLine") {
        
profile = GuiBlueMLTextProfile;
        
height = 17;
        
horizsizing = "width";
        
text = "Welcome to the Chat system, Please be nice!";
        
width = 295;
      }
    }
    new 
GuiTextEditCtrl("Chat_Bar") {
      
profile = GuiBlueTextEditProfile;
      
height = 20;
      
width = 320;
      
y = 220;
    }
  }
  
Chat_Window.destroy();
}

function 
Chat_Bar.onAction() {
  
triggerserver("weapon", this.name, "add", Chat_Bar.text);
  
Chat_Bar.text = "";
}

function 
onActionClientSide() {
  if (
params[0] == "add") {
    
Chat_MultiLine.addtext("<br>"@params[1]@": "@params[2], false);
    
Chat_MultiLine.scrolltobottom();
  }
} 
Also if you have any suggestions to improve it feel free to let the idea's flow freely.
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion

Last edited by Gunderak; 11-26-2011 at 01:16 PM..
Reply With Quote