Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 09-04-2011, 09:42 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
Chat Room

I have constructed a simple chat room GUI, with the help of players on the forums, so many thanks to them. It enables you to chat with a neat GUI interface to the servers players, that is, if the players have the weapon! There isn't really any cool features I have added to it, but feel free to add them or suggest some ideas. Here is the code.
PHP Code:
function onActionServerSide() {
  if (
params[0] == "sendtext") {
    for (
temp.plallplayers) {
      if (
temp.pl.level != NULL) {
        
temp.pl.triggerclient(this.name"gettext"params[1], player.nick);
      }
    }
  }
}

//#CLIENTSIDE
function onCreated() {
  new 
GuiWindowCtrl("Msg_Window1") {
    
profile GuiBlueWindowProfile;
    
clientrelative true;
    
clientextent "320,240";
    
canmaximize false;
    
canmove true;
    
canresize false;
    
closequery false;
    
destroyonhide true;
    
text "Staff Chat Channel";
    
517;
    
203;
    new 
GuiScrollCtrl("Msg_Chatbox_Scroll") {
      
profile GuiBlueScrollProfile;
      
height 215;
      
hscrollbar "dynamic";
      
vscrollbar "dynamic";
      
width 316;
      
2;
      
2;
      new 
GuiMLTextCtrl("Msg_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 true;
      }
    }
    new 
GuiTextEditCtrl("Msg_ChatBar") {
      
profile GuiBlueTextEditProfile;
      
height 20;
      
width 316;
      
2;
      
219;
    }
  }
}

function 
Msg_ChatBar.onAction() {
  
temp.msg "";
  if (
Msg_ChatBar.text == "/clear") {
    
Msg_Chatbox.text "Cleared!";
  } else {
    if (
Msg_ChatBar.text != NULL) {
      
temp.msg Msg_ChatBar.text;
      
triggerserver("weapon"this.name"sendtext"temp.msg);
      
Msg_ChatBar.text "";
    }
  }
  if (
temp.msg.starts("/font ")) {
    
say2("Works");
  }
}

function 
onActionClientSide() {
  if (
params[0] == "gettext") {
    
Msg_Chatbox.addtext("<br><b><font color = cyan>" params[2] @ "</b>: " params[1], false);
    
Msg_ChatBox.scrolltobottom();
  }

__________________
Reply With Quote
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 12:34 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.