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

How to send a Player Message via server?


bunny123
 Share

Recommended Posts

Can someone tell me how to add a Send Player Message feature to frmServer.frm? I originally tried:
```
Private Sub cmdSendPlayerMessage_Click()
    Call PlayerMsg(txtSendTo.Text, txtToSend.Text, sldColor.Value)
End Sub
```But that gave me a Type Mismatch.
**The first one to reply a working code will get credit!**

>! sldColor is a slider I use to determine what color byte to use in a message.
Link to comment
Share on other sites

I'm assuming that in txtSendTo, and txtToSend, you have the players' names?

You need their indexes. I believe you can use the function FindPlayer to compare the names, and return their indexes.

Modify it to:

   ```
Call PlayerMsg(FindPlayer(txtSendTo.Text), FindPlayer(txtToSend.Text), sldColor.Value)
```
Link to comment
Share on other sites

@Lenn:

> I'm assuming that in txtSendTo, and txtToSend, you have the players' names?
>
> You need their indexes. I believe you can use the function FindPlayer to compare the names, and return their indexes.
>
> Modify it to:
>
>    ```
> Call PlayerMsg(FindPlayer(txtSendTo.Text), FindPlayer(txtToSend.Text), sldColor.Value)
> ```

Actually, txtSendTo is who to send it to like you said, and txtToSend is the message. Plus that's what I **thought** would work in those two posts above.
Link to comment
Share on other sites

@bunny123:

> Actually, txtSendTo is who to send it to like you said, and txtToSend is the message. Plus that's what I **thought** would work in those two posts above.

Wait a second, I tried```
GetPlayerName(txtSendTo.Text)
```. Let me try what you said now.
Link to comment
Share on other sites

@Lenn:

> I'm assuming that in txtSendTo, and txtToSend, you have the players' names?
>
> You need their indexes. I believe you can use the function FindPlayer to compare the names, and return their indexes.
>
> Modify it to:
>
>    ```
> Call PlayerMsg(FindPlayer(txtSendTo.Text), FindPlayer(txtToSend.Text), sldColor.Value)
> ```

**It worked!**
Link to comment
Share on other sites

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