Domino_ Posted October 23, 2011 Author Share Posted October 23, 2011 Afther completing tutorial you will be avabile to send message from server to client in 4 different colors( you can add more if you want ) and you will be avabile to set from who this will be.If you will use this code, please give credits.**Everything Server Side.**Make new tab like: [Console] [Players] [Control] [Message] or add this all somewhere else.Make 1 command button called _**cmdSendMessage**_Next make frame called _**frmColorSelect**_ and add in 4 options, **OptWhite** , **OptRed** , **OptBlue** and **OptGreen** .Now make 2 text boxes, smaller _****txtSendBy****_ where you will display your name and bigger _**txtToSend**_ were you will write text to send.txtSendBy text change to Server and txtToSend text delete.Also soon I will update this code that there wount be so mutch code. :PHmm… here is a picture how it looks for me. :)![](http://www.bildites.lv/images/8qoa6i0o3xcncx3gc7y.png)Nex open _frmServer_ and add this code at the bottom.>! ```'/ SEND MESSAGE FROM SERVER BY DOMINO>! Private Sub optWhite_Click()If OptWhite = True ThenOptRed = FalseOptBlue = FalseOptGreen = FalseEnd IfEnd Sub>! Private Sub optRed_Click()If OptRed = True ThenOptWhite = FalseOptBlue = FalseOptGreen = FalseEnd IfEnd Sub>! Private Sub optBlue_Click()If OptBlue = True ThenOptWhite = FalseOptRed = FalseOptGreen = FalseEnd IfEnd Sub>! Private Sub optGreen_Click()If OptGreen = True ThenOptWhite = FalseOptRed = FalseOptBlue = FalseEnd IfEnd Sub>! Private Sub cmdSendMessage_Click()If OptWhite = True Then>! Call GlobalMsg(txtSendBy.Text & ": " & txtToSend.Text, White)ElseIf OptRed = True Then>! Call GlobalMsg(txtSendBy.Text & ": " & txtToSend.Text, BrightRed)ElseIf OptBlue = True Then>! Call GlobalMsg(txtSendBy.Text & ": " & txtToSend.Text, BrightBlue)ElseIf OptGreen = True Then>! Call GlobalMsg(txtSendBy.Text & ": " & txtToSend.Text, Green) Else Call GlobalMsg(txtSendBy.Text & ": " & txtToSend.Text, White)End IfEnd Sub>! ```**Credits: Me ( _Domino_ )** Link to comment Share on other sites More sharing options...
Domino_ Posted October 23, 2011 Author Share Posted October 23, 2011 Screen>! ![](http://www.bildites.lv/images/ux7h82nosfddjovizw99.png)And if you find any bug, please report. ^^ Link to comment Share on other sites More sharing options...
Carim123 Posted October 23, 2011 Share Posted October 23, 2011 This is -way- more complicated than it needs to be.http://www.touchofdeathforums.com/smf/index.php/topic,74436.0.htmlHave a look at that, see how that handles colours, and add in your own edits. Link to comment Share on other sites More sharing options...
Domino_ Posted October 23, 2011 Author Share Posted October 23, 2011 @Domino_:> Also soon I will update this code that there wount be so mutch code. :P Link to comment Share on other sites More sharing options...
Robin Posted October 23, 2011 Share Posted October 23, 2011 Both this tutorial and that one are both stupidly complicated. Stop doing it based on bloody string comparisons and do it based on the colour's byte value.Build the combo list based on that order and it'll instantly handle it all automatically. Link to comment Share on other sites More sharing options...
Richy420Rich Posted October 23, 2011 Share Posted October 23, 2011 It's alright but could cut that coding down alot since it's a very little feature to need all the code, just put a global type in the server modGlobals```Public ServerColor As Integer```Create an array for the Option Boxes by copy/paste option boxes in form, change their index 0-15 (or as many colors as you're using)And on click, do this.```Private Sub optServerColor_Click(Byval index as integer)ServerColor = IndexEnd Sub```And for the message send, you can do this.```Private Sub cmdSendMessage_Click()Call GlobalMsg(txtSendBy.Text & ": " & txtToSend.Text, Val(ServerColor))End Sub``` Link to comment Share on other sites More sharing options...
Robin Posted October 23, 2011 Share Posted October 23, 2011 Stop using option boxes for something like this. Combo boxes were designed exactly for this kind of situation.Also, start the index at 0\. Black is 0. Link to comment Share on other sites More sharing options...
Richy420Rich Posted October 23, 2011 Share Posted October 23, 2011 Ah duck, I forgot Bytes start at 0.. :( Link to comment Share on other sites More sharing options...
Harris6310 Posted October 23, 2011 Share Posted October 23, 2011 @Robin:> Stop using option boxes for something like this. Combo boxes were designed exactly for this kind of situation.> > Also, start the index at 0\. Black is 0.You've done the same thing on the imgButton array in EO. Link to comment Share on other sites More sharing options...
Richy420Rich Posted October 23, 2011 Share Posted October 23, 2011 Combo boxes are morely recommended though, so you could just create a list, and send the list index number for the color on command click. Then wouldn't be no need for the global variable. Link to comment Share on other sites More sharing options...
Carim123 Posted October 23, 2011 Share Posted October 23, 2011 Already done that, Robin.For anybody else who wants to see…```Private Sub txtChat_KeyPress(KeyAscii As Integer) If KeyAscii = vbKeyReturn Then If LenB(Trim$(txtChat.Text)) > 0 Then Call GlobalMsg(txtChat.Text, cbColours.ListIndex) ' <--- Call AddChat(txtChat.Text) txtChat.Text = vbNullString End If KeyAscii = 0 End IfEnd Sub``` Link to comment Share on other sites More sharing options...
Robin Posted October 24, 2011 Share Posted October 24, 2011 @Harris:> You've done the same thing on the imgButton array in EO.Don't compare an aesthetic user interface with something the admins see.What the players see needs to look good. What the admins see needs to be easy to use.Comboboxes are ugly as sin (hell, look at EE's chat channel selection) but it's useful in the admin interfaces. Link to comment Share on other sites More sharing options...
bunny123 Posted September 10, 2012 Share Posted September 10, 2012 I made a better version.[Snapshot](http://i.imm.io/DOXx.bmp) Link to comment Share on other sites More sharing options...
JohnPony Posted September 10, 2012 Share Posted September 10, 2012 > I made a better version.> > [Snapshot](http://i.imm.io/DOXx.bmp)Kill it with fire, did you read nothing of what Robin posted earlier in this tutorial? Link to comment Share on other sites More sharing options...
Stein Posted September 10, 2012 Share Posted September 10, 2012 To be fair, why bother having this on the server to begin with? Normally this would be hosted on a computer/server you don't normally have visual access to all day. Just make an announcement feature from the admin panel. Link to comment Share on other sites More sharing options...
Domino_ Posted September 10, 2012 Author Share Posted September 10, 2012 > I made a better version.> > [Snapshot](http://i.imm.io/DOXx.bmp)lol, looks good, but use combobox… O.O Link to comment Share on other sites More sharing options...
bunny123 Posted September 16, 2012 Share Posted September 16, 2012 I only used the option button things (lolwat?) because I feel it's easier that way, I used to use a scroll bar for setting the color, but I lost that because I accidentally deleted EO. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now