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

Two questions…


Ertzel
 Share

Recommended Posts

1 - Seeing other players equipped items in a picturebox -
I am trying to make it so that when you Right click on another player a picturebox(PicPlayerBp) becomes visible. Then in the picturebox I have 8 other pictureboxes for each of the players Equipped item slots. Now what I need is help with getting the players equipped items to show up. I want this because it will let people see what gear others are wearing and Im not using Paperdolling in my game so this is kindda needed but I can't figure it out.

2 - Making Moderators have yellow names in all chats -

I don't know if this is even posable, but what I need is to change the way messages are sent in the chats if you are above Access 0\.

Right now the code is something like this
```
Call MapMsg(GetPlayerMap(index), GetPlayerName(index) & ": " & Message, SayColor)
```
This makes the whole message using the SayColor, but what I need is for the message to be the SayColor, but the name to be yellow instead of the same as the SayColor, if you are above Access 0.

So it would look like this ingame if I were a Mod(Using White as the SayColor)
(GM)Ertzel: My Message Here!
And this if I was not
(GM)Ertzel: My Message Here!
Link to comment
Share on other sites

Well you script is for when I talk in the Map chat(because thats what my example used)

But what I want is for it to have the GMs name yellow no matter what chat they are using.. So like

Map Chat
GM Ertzel: MapMsg Here
Guild Chat
GM Ertzel: AdminMsg Here
Admin Chat
GM Ertzel: AdminMsg Here
Link to comment
Share on other sites

Put it in, no errors in Client from what I can tell but…

after I put all the server stuff in, and went to compile I got an error in modGameLogic
```
Call MapMsg(GetPlayerMap(Index), "A door has been unlocked!", WHITE)
```It seems like this code is screwing up anything else that has a MapMsg in it.

Oh, I took out the other MapMsg things to test this and when I try to type anything in the MapMsg it just puts my name (in black) and no message :P
Link to comment
Share on other sites

You didn't use the new syntax that I provided at the end of the post with the code on it. This is it:

```
Call MapMsg(GetPlayerMap(Index), GetPlayerName(Index), ": " & Message, YELLOW, GREY)
```
This is how the parameters should be filled in: Map #, Player Username, Message, Player Username Color, Player Message Color

For your code, you should fill it in like so:

```
Call MapMsg(GetPlayerMap(Index), "A door ", "has been unlocked!", WHITE, WHITE)
```
You need to fill in 2 parameters for the message, since I intended you to separate the player's username and the message, but this code doesn't use a player's username, so you'll just have to fit the syntax another way. The way I did was simply split the message into 2 parts. I've also made both colors WHITE because the whole message should be the same color; it'd look strange otherwise.

EDIT: If the message doesn't involve the player's username and is intended for a single player, you can keep it as it is. Example:

```
Call PlayerMsg(Index, "You cannot do that!", WHITE)
```
That's fine as it is, so you don't have to change it to a **MapMsg**.
Link to comment
Share on other sites

Okay, sorry about that. I've managed to take a look at the code myself, and I've tested it. It works great! Please revert your source to how it was before you added in my previous installment; I'm sorry. This method works in a much safer manner than the previous one. Now, follow these instructions:

Let's start with the **Client** again.

Open up **modHandleData** and find this:

```
' ::::::::::::::::::::
    ' :: Social packets ::
    ' ::::::::::::::::::::
```
Change all of the "casestrings" under it to look like this:

```
' ::::::::::::::::::::
    ' :: Social packets ::
    ' ::::::::::::::::::::
    If (casestring = "saymsg") Or (casestring = "broadcastmsg") Or (casestring = "globalmsg") Or (casestring = "playermsg") Or (casestring = "mapmsg") Or (casestring = "adminmsg") Then
        Call AddText(parse(1), Val(parse(2)))
        Exit Sub
    End If

    If (casestring = "mapnamemsg") Then
        Call AddText2(parse(1), parse(2), Val(parse(3)), Val(parse(4)))
        Exit Sub
    End If
```
Next, open up **modText**, and add this under **Public Sub AddText(ByVal Msg As String, ByVal color As Integer)**:

```
Public Sub AddText2(ByVal Msg As String, ByVal Msg2 As String, ByVal color As Integer, ByVal color2 As Integer)
    frmMirage.txtChat.SelStart = Len(frmMirage.txtChat.Text)
    frmMirage.txtChat.SelColor = QBColor(color)
    frmMirage.txtChat.SelText = vbNewLine & Msg
    frmMirage.txtChat.SelColor = QBColor(color2)
    frmMirage.txtChat.SelText = Msg2
    frmMirage.txtChat.SelStart = Len(frmMirage.txtChat.Text) - 1

    If frmMirage.chkAutoScroll.Value = Unchecked Then
        frmMirage.txtChat.SelStart = frmMirage.txtChat.SelStart
    End If
End Sub
```
Now, let's move onto the **Server**. Open up **modServerTCP**, and find this:

```
Sub MapMsg(ByVal MapNum As Long, ByVal Msg As String, ByVal Color As Byte)
    Call SendDataToMap(MapNum, "MAPMSG" & SEP_CHAR & Msg & SEP_CHAR & Color & END_CHAR)
End Sub
```
Add this under it:

```
Sub NameMapMsg(ByVal MapNum As Long, ByVal Msg As String, ByVal Msg2 As String, ByVal Color As Byte, ByVal Color2 As Byte)
    Call SendDataToMap(MapNum, "MAPNAMEMSG" & SEP_CHAR & Msg & SEP_CHAR & Msg2 & SEP_CHAR & Color & SEP_CHAR & Color2 & END_CHAR)
End Sub
```
Now, open up **modHandleData**, and find this Sub:

```
Public Sub Packet_SayMessage(ByVal Index As Long, ByVal Message As String)
```
Change all of the **MapMsg** (Not **MapMsg2**) statements ONLY IN THIS SUB to look like this:

```
Call NameMapMsg(GetPlayerMap(Index), GetPlayerName(Index) & ": ", Message, YELLOW, GREY)
```
As explained earlier, the syntax is as follows:

```
Call NameMapMsg(PlayerMap, PlayerUsername & ":", Player's Message, PlayerUsername Color, Player's Message Color)
```
Change the colors to your liking. Also, you will NOT have to change all of the **MapMsg** statements in your source. In order to separate the player's username and player's message, use the **NameMapMsg** command.

Good luck, and please don't hesitate to ask any questions!
Link to comment
Share on other sites

@Ertzel:

> Hmm, guess this is why I should of made a backup before putting it in lol…
>
> Ill figure out how to change it back to the original layout then put this code in later and see if it works.

I'm sorry; I should've told you to make a backup first.

@Ertzel:

> Ok this works for Saychat now… But sorry I still don't understand how I would use this for Guild Chat, Private Chat, and Global Chat.
>
> (sorry for double posting, forgot to edit my other post instead)

This is very simple to do. I'll help you out with it later today. I cannot right now, unfortunately, sorry.
Link to comment
Share on other sites

Okay, here we go!

You only need to edit one thing in the **Client**, and it's in **modHandleData**. Find this:

```
If (casestring = "mapnamemsg") Then
        Call AddText2(parse(1), parse(2), Val(parse(3)), Val(parse(4)))
        Exit Sub
    End If
```
Change it to this:

```
If (casestring = "mapnamemsg") Or (casestring = "globalnamemsg") Or (casestring = "playernamemsg") Then
        Call AddText2(parse(1), parse(2), Val(parse(3)), Val(parse(4)))
        Exit Sub
    End If
```
Now, head on over to the **Server**, and go to **modServerTCP**.

Find this:

```
Sub GlobalMsg(ByVal Msg As String, ByVal Color As Byte)
    Call SendDataToAll("GLOBALMSG" & SEP_CHAR & Msg & SEP_CHAR & Color & END_CHAR)
End Sub
```
Under it, add this:

```
Sub NameGlobalMsg(ByVal Msg As String, ByVal Msg2 As String, ByVal Color As Byte, ByVal Color2 As Byte)
    Call SendDataToAll("GLOBALNAMEMSG" & SEP_CHAR & Msg & SEP_CHAR & Msg2 & SEP_CHAR & Color & SEP_CHAR & Color2 & END_CHAR)
End Sub
```
Now, find this:

```
Sub PlayerMsg(ByVal Index As Long, ByVal Msg As String, ByVal Color As Byte)
    Call SendDataTo(Index, "PLAYERMSG" & SEP_CHAR & Msg & SEP_CHAR & Color & END_CHAR)
End Sub
```
Under it, add this:

```
Sub NamePlayerMsg(ByVal Index As Long, ByVal Msg As String, ByVal Msg2 As String, ByVal Color As Byte, ByVal Color2 As Byte)
    Call SendDataTo(Index, "PLAYERNAMEMSG" & SEP_CHAR & Msg & SEP_CHAR & Msg2 & SEP_CHAR & Color & SEP_CHAR & Color2 & END_CHAR)
End Sub
```
Next, head over to **modHandleData**.

Find this:

```
Public Sub Packet_PlayerMessage(ByVal Index As Long, ByVal Name As String, ByVal Message As String)
```
In it, find something that resembles these two statements at the end of the statement:

```
Call PlayerMsg(Index, "To " & GetPlayerName(MsgTo) & ": " & Message, BRIGHTCYAN)
    Call PlayerMsg(MsgTo, "From " & GetPlayerName(Index) & ": " & Message, BRIGHTCYAN)
```
Change them to look like this:

```
Call NamePlayerMsg(Index, "To " & GetPlayerName(MsgTo) & ": ", Message, YELLOW, BRIGHTCYAN)
    Call NamePlayerMsg(MsgTo, "From " & GetPlayerName(Index) & ": ", Message, YELLOW, BRIGHTCYAN)
```
Next, find this:

```
Public Sub Packet_BroadcastMessage(ByVal Index As Long, ByVal Message As String)
```
In it, find a statement that resembles this:

```
Call GlobalMsg(GetPlayerName(Index) & ": " & Message, GREY)
```
Change it to this:

```
Call NameGlobalMsg(GetPlayerName(Index) & ": ", Message, YELLOW, GREY)
```
In my version of Eclipse, guild messages don't exist, so I downloaded Eclipse Stable and found this in the **Server** **ModHandleData**:

```
Public Sub Packet_GuildMsg(ByVal Index As Long, ByVal Msg As String)
```
Find this in it:

```
If GetPlayerGuild(Index) = "" Then
        Call PlayerMsg(Index, "your not in a crew...", BRIGHTRED)
        Exit Sub
    End If

    For I = 1 To MAX_PLAYERS
        If IsPlaying(I) Then
        If GetPlayerGuild(Index) = GetPlayerGuild(I) And GetPlayerGuild(I) <> "" Then
            Call PlayerMsg(I, "[Crew : " & GetPlayerName(Index) & "]: " & Msg, GREEN)
        End If
        End If
    Next I
```
Change it to look like this:

```
If GetPlayerGuild(Index) = vbNullString Then
        Call PlayerMsg(Index, "You're currently not in a guild!", BRIGHTRED)
        Exit Sub
    End If

    For I = 1 To MAX_PLAYERS
        If IsPlaying(I) Then
        If GetPlayerGuild(Index) = GetPlayerGuild(I) And GetPlayerGuild(I) <> vbNullString Then
            Call NamePlayerMsg(I, "[Guild : " & GetPlayerName(Index) & "]: ", Msg, YELLOW, GREEN)
        End If
        End If
    Next I
```
Of course, you'd have to add in some IF statements before the **NamePlayerMsg** to change the colors depending on the player's access level. Anyway, that should be all. I'll tell you the syntaxes for each of the new statements:

**NamePlayerMsg**
```
Call NamePlayerMsg(Index, PlayerUsername & ": ", Player's Message, PlayerUsername Color, Player's Message Color)
```
You may have to change this when editing the Private Messaging and Guild Messaging codes to fit your needs. Private Messaging and Guild Messaging use this command, just in different ways.

**NameGlobalMsg**
```
Call NameGlobalMsg(PlayerUsername & ": ", Player's Message, PlayerUsername Color, Player's Message Color)
```
That should be all! Please tell me if it works or not, but I'm sure it'll work.

Good luck!
Link to comment
Share on other sites

Before putting in the new one I found a bug with the old one. Dunno if the new one fixes it or not..

But even if im not over Access 1 its doing the new layout thing.

So my normal players names r in yellow then their message, but its only suppose to be for Mods/Admins.
Link to comment
Share on other sites

You would need to do something like this to specify which access gets what colors:

```
If GetPlayerAccess(Index) > 0 Then
Call NameGlobalMsg(GetPlayerName(Index) & ": ", Message, YELLOW, GREY)
Else
Call NameGlobalMsg(GetPlayerName(Index) & ": ", Message, GREY, GREY)
End If
```
If you'd like, I can simply insert the conditions into the code on the other post, but you should be capable of doing it yourself.
Link to comment
Share on other sites

You're welcome. Please let me know how it works. Anyway, you can use both the new one and the old one to do this to avoid confusion issues. I'll show you with my previous example:

```
If GetPlayerAccess(Index) > 0 Then
Call NameGlobalMsg(GetPlayerName(Index) & ": ", Message, YELLOW, GREY)
Else
Call GlobalMsg(GetPlayerName(Index) & ": " Message, GREY)
End If
```
That's an example of what you can do. You should use the new commands only when you want the player's username to have a different color than the player's message.
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...