Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[EO] Send Message in color from server


Domino_
 Share

Recommended Posts

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. :P

Hmm… 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 Then
OptRed = False
OptBlue = False
OptGreen = False
End If
End Sub
>! Private Sub optRed_Click()
If OptRed = True Then
OptWhite = False
OptBlue = False
OptGreen = False
End If
End Sub
>! Private Sub optBlue_Click()
If OptBlue = True Then
OptWhite = False
OptRed = False
OptGreen = False
End If
End Sub
>! Private Sub optGreen_Click()
If OptGreen = True Then
OptWhite = False
OptRed = False
OptBlue = False
End If
End 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 If
End Sub
>! ```
**Credits: Me ( _Domino_ )**
Link to comment
Share on other sites

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

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 = Index
End 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

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 If
End Sub
```
Link to comment
Share on other sites

@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

  • 10 months later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...