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

(EO) Guild menu *UPDATE*


tslusny
 Share

Recommended Posts

Hello. In this tutorial you will learn how to have visible Guild menu. No more ****** chat commands :cheesy:.

Thanx Scott for Guild System.

For this tutorial you must have Scotts Guild system.

Tutorial required: [http://www.touchofde…ic,78441.0.html](http://www.touchofdeathforums.com/smf2/index.php/topic,78441.0.html)

CLIENT SIDE

Download attachments and copy from Guild Menu.frm picGuild with everything in it to your frmMain.

Now add Guild.jpg to \data files\graphics\gui\main

At bottom of frmMain add

```
'Deathbeams Guild Menu

Private Sub lblGuildInv_Click()

If myTargetType = TARGET_TYPE_PLAYER And myTarget <> MyIndex Then

Call GuildCommand(2, Player(myTarget).Name)

Else

AddText "Cant invite to Guild.", BrightRed

End If

End Sub

Private Sub lblGuildLeave_Click()

Call GuildCommand(3, "")

End Sub

Private Sub lblGuildKick_Click()

If lstGuildMembers.ListIndex > 0 Then

Call GuildCommand(9, Trim$(GuildData.Guild_Members((lstGuildMembers.ListIndex) + 1).User_Name))

Else

If myTargetType = TARGET_TYPE_PLAYER And myTarget <> MyIndex Then

Call GuildCommand(9, Player(myTarget).Name)

End If

End If

End Sub

Private Sub lblGuildDisband_Click()

lblGuildDisband.Caption = "Really ?"

lblGuildYes.visible = True

lblGuildNo.visible = True

lblGuildYes.Caption = "Yes"

lblGuildNo.Caption = "No"

End Sub

Private Sub lblGuildYes_Click()

lblGuildYes.visible = False

lblGuildNo.visible = False

picGuild.visible = False

lblGuildDisband.Caption = "Guild Disband"

Call GuildCommand(10, "")

End Sub

Private Sub lblGuildNo_Click()

lblGuildYes.visible = False

lblGuildNo.visible = False

lblGuildDisband.Caption = "Guild Disband"

End Sub

Private Sub lblGuildCAccept_Click()

Call GuildCommand(1, txtGuildC.text)

frmGuildC.visible = False

picGuild.visible = False

End Sub

Private Sub lblGuildCCancel_Click()

lblGuildC.visible = True

frmGuildC.visible = False

End Sub

Private Sub lblGuildC_Click()

lblGuildC.visible = False

frmGuildC.visible = True

End Sub

Private Sub lblGuildFounder_Click()

If lstGuildMembers.ListIndex > 0 Then

Call GuildCommand(8, Trim$(GuildData.Guild_Members((lstGuildMembers.ListIndex) + 1).User_Name))

Else

If myTargetType = TARGET_TYPE_PLAYER And myTarget <> MyIndex Then

Call GuildCommand(8, Player(myTarget).Name)

End If

End If

End Sub

Private Sub lblGuildAdminPanel_Click()

Call GuildCommand(4, "")

End Sub

'Deathbeams Guild Menu
```

Now in Sub LoadGui search for

```
frmMain.picOptions.Picture = LoadPicture(App.Path & "\data files\graphics\gui\main\options.jpg")
```

Add below it

```
frmMain.picGuild.Picture = LoadPicture(App.Path & "\data files\graphics\gui\main\Guild.jpg")
```

Now add

```
picGuild.visible = False
```

To all Cases in

```
Private Sub imgButton_Click(Index As Integer)
```

Now add label with

name: lblGuildOpen

caption: Guild

anywhere to frmMain (u will use this label for Guild Menu opening, u can later add ImgButton for opening and add hover and click to it, but for now this ugly label must be enought for u :cheesy:)

Now doubleclick this label and add to it

```
UpdateGuildData

If Not picGuild.visible Then

' show the window

picCharacter.visible = False

picInventory.visible = False

picSpells.visible = False

picOptions.visible = False

picGuild.visible = True

picParty.visible = False

' play sound

PlaySound Sound_Buttonclick

Else

picGuild.visible = False

End If
```

Now add this sub at bottom of modGeneral

```
Public Sub UpdateGuildData()

Dim I As Long, GuildRank As String, RankNum As Long

With frmMain

If Not Player(MyIndex).GuildName = vbNullString Then

Call GuildSave(4, MyIndex)

.lstGuildMembers.visible = True

.lblGuildLeave.visible = True

.lblGuildC.visible = False

.lblGuildCDesc.visible = False

.frmGuildC.visible = False

.lblGuildInv.visible = True

.lblGuildKick.visible = True

.lblGuildAdminPanel.visible = True

If GuildData.Guild_Members(Player(MyIndex).GuildMemberId).Rank > 5 Then

.lblGuildDisband.visible = True

.lblGuildFounder.visible = True

Else

.lblGuildDisband.visible = False

.lblGuildFounder.visible = False

End If

.lstGuildMembers.Clear

Else

.lstGuildMembers.visible = False

.lblGuildInv.visible = False

.lblGuildKick.visible = False

.lblGuildLeave.visible = False

.lblGuildC.visible = True

.lblGuildCDesc.visible = True

.frmGuildC.visible = False

.lblGuildDisband.visible = False

.lblGuildFounder.visible = False

.lblGuildAdminPanel.visible = False

End If

For I = 1 To MAX_GUILD_MEMBERS

If Not Player(MyIndex).GuildName = vbNullString Then

.lblGuild.Caption = "Guild: " & Player(MyIndex).GuildName

.lblGuildInv.Caption = "Invite to Guild"

.lblGuildKick.Caption = "Kick from Guild"

.lblGuildLeave.Caption = "Leave Guild"

.lblGuildDisband.Caption = "Guild Disband"

.lblGuildFounder.Caption = "Make Founder"

.lblGuildAdminPanel.Caption = "Open Admin panel"

Else

.lblGuild.Caption = "You are not in Guild"

.lblGuildC.Caption = "Create Guild"

.lblGuildCDesc.Caption = "Guild create cost 5000 Amethyst"

.lblGuildCAccept.Caption = "Create"

.lblGuildCCancel.Caption = "Cancel"

.frmGuildC.Caption = "Guild creation"

.txtGuildC.text = "Enter Guild name..."

End If

End Select

If Not Trim$(GuildData.Guild_Members(I).User_Name) = vbNullString Then

RankNum = GuildData.Guild_Members(I).Rank

GuildRank = GuildData.Guild_Ranks(RankNum).Name

.lstGuildMembers.AddItem ("[" & GuildRank & "] " & GuildData.Guild_Members(I).User_Name)

.lstGuildMembers.ListIndex = 0

End If

Next I

End With

End Sub
```

in ModHandleData find

```
If Buffer.ReadByte = 1 Then

Player(i).GuildName = Buffer.ReadString

Else

Player(i).GuildName = vbNullString

End If
```

And replace it with

```
If Buffer.ReadByte = 1 Then

Player(i).GuildName = Buffer.ReadString

Player(i).GuildMemberId = Buffer.ReadLong

Else

Player(i).GuildName = vbNullString

Player(i).GuildMemberId = 0

End If
```

SERVER SIDE

find this in ModServerTCP

```

If Player(index).GuildFileId > 0 Then

If TempPlayer(index).TmpGuildSlot > 0 Then

Buffer.WriteByte 1

Buffer.WriteString GuildData(TempPlayer(index).TmpGuildSlot).Guild_Name

End If

Else

Buffer.WriteByte 0

End If
```

And replace it with

```

If Player(index).GuildFileId > 0 Then

If TempPlayer(index).TmpGuildSlot > 0 Then

Buffer.WriteByte 1

Buffer.WriteString GuildData(TempPlayer(index).TmpGuildSlot).Guild_Name

Buffer.WriteLong Player(index).GuildMemberId

End If

Else

Buffer.WriteByte 0

End If
```

UPDATE

If you already added this tutorial replace Guild Menu pic with attachment and add this at bottom of frmMain

```
Private Sub lblGuildFounder_Click()

If lstGuildMembers.ListIndex > 0 Then

Call GuildCommand(8, Trim$(GuildData.Guild_Members((lstGuildMembers.ListIndex) + 1).User_Name))

Else

If myTargetType = TARGET_TYPE_PLAYER And myTarget <> MyIndex Then

Call GuildCommand(8, Player(myTarget).Name)

End If

End If

End Sub

Private Sub lblGuildAdminPanel_Click()

Call GuildCommand(4, "")

End Sub
```

And replace Public Sub UpdateGuildData() with this

```
Public Sub UpdateGuildData()

Dim I As Long, GuildRank As String, RankNum As Long

With frmMain

If Not Player(MyIndex).GuildName = vbNullString Then

Call GuildSave(4, MyIndex)

.lstGuildMembers.visible = True

.lblGuildLeave.visible = True

.lblGuildC.visible = False

.lblGuildCDesc.visible = False

.frmGuildC.visible = False

.lblGuildInv.visible = True

.lblGuildKick.visible = True

.lblGuildAdminPanel.visible = True

If GuildData.Guild_Members(Player(MyIndex).GuildMemberId).Rank > 5 Then

.lblGuildDisband.visible = True

.lblGuildFounder.visible = True

Else

.lblGuildDisband.visible = False

.lblGuildFounder.visible = False

End If

.lstGuildMembers.Clear

Else

.lstGuildMembers.visible = False

.lblGuildInv.visible = False

.lblGuildKick.visible = False

.lblGuildLeave.visible = False

.lblGuildC.visible = True

.lblGuildCDesc.visible = True

.frmGuildC.visible = False

.lblGuildDisband.visible = False

.lblGuildFounder.visible = False

.lblGuildAdminPanel.visible = False

End If

For I = 1 To MAX_GUILD_MEMBERS

If Not Player(MyIndex).GuildName = vbNullString Then

.lblGuild.Caption = "Guild: " & Player(MyIndex).GuildName

.lblGuildInv.Caption = "Invite to Guild"

.lblGuildKick.Caption = "Kick from Guild"

.lblGuildLeave.Caption = "Leave Guild"

.lblGuildDisband.Caption = "Guild Disband"

.lblGuildFounder.Caption = "Make Founder"

.lblGuildAdminPanel.Caption = "Open Admin panel"

Else

.lblGuild.Caption = "You are not in Guild"

.lblGuildC.Caption = "Create Guild"

.lblGuildCDesc.Caption = "Guild create cost 5000 Amethyst"

.lblGuildCAccept.Caption = "Create"

.lblGuildCCancel.Caption = "Cancel"

.frmGuildC.Caption = "Guild creation"

.txtGuildC.text = "Enter Guild name..."

End If

End Select

If Not Trim$(GuildData.Guild_Members(I).User_Name) = vbNullString Then

RankNum = GuildData.Guild_Members(I).Rank

GuildRank = GuildData.Guild_Ranks(RankNum).Name

.lstGuildMembers.AddItem ("[" & GuildRank & "] " & GuildData.Guild_Members(I).User_Name)

.lstGuildMembers.ListIndex = 0

End If

Next I

End With

End Sub
```

And now you will have working Guild Menu in game.

Graphics what i used are only for example, i using this graphics in my game so pls dont use them in your games. Thx ![:P](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/tongue.png)

Report any bugs found.
Link to comment
Share on other sites

  • Replies 99
  • Created
  • Last Reply

Top Posters In This Topic

Haha, good thing I saw this post right before I was going to add this myself. Been dreading to add a UI portion to the guild member list for a while now. :]

Thank you for this, I'll modify it a bit though.. But a good addition non the less!
Link to comment
Share on other sites

OMG I LOVE YOU!!!!!! WHERE DO YOU LIVE? I NEED TO GIVE YOU A COOKIE!!!

Edit: w8… i think i missed something... when compiling it says:
Method or Data member not found

it highlights:

.lblGuildCDesc

it's lblGuildCDesc is not in frame you attached to the post, i will try to fix it myself...
Link to comment
Share on other sites

w8… i think i missed something... when compiling it says:
Method or Data member not found

it highlights:

.lblGuildCDesc

i have no idea what the lblGuildCDesc does, how big it should be, should it be a Label? do i need to add any code to it? i have NO idea... can any1 help me? i really think i missed something
Link to comment
Share on other sites

@quintensky:

> w8… i think i missed something... when compiling it says:
> Method or Data member not found
>
> it highlights:
>
> .lblGuildCDesc
>
> i have no idea what the lblGuildCDesc does, how big it should be, should it be a Label? do i need to add any code to it? i have NO idea... can any1 help me? i really think i missed something

```
.lblGuildCDesc
```
to

```
'.lblGuildCDesc
```
Link to comment
Share on other sites

@ ^ I already assessed this in my last post -.-

I have found a problem though

This line seems to not be doing its job!

```
If GuildData.Guild_Members(MyIndex).Rank > 5 Then
```
There is a guild member who is rank 1 and they can see the Disband Label.. although it does them no good to click it cause it obviously won't let them disband a guild they didn't create.

I am not sure if it is cause I edited the lbls a little bit or what I have is the same as yours except I added

.lblGuAdmin.Visible = True (which it shows up for the Rank 1 user as well *I DO have it set to false in frmMain as well as in the ELSE for this IF*)

which adding that really shouldn't have bothered anything it was simply adding that line, I have tried fixing it, but it doesn't matter what I do it doesn't fix it… I tried taking the label I added out but the Disband label still shows even with the original code.
Link to comment
Share on other sites

```
GuildData.Guild_Members(MyIndex).Rank
```You can't use MyIndex there, you need to sent their guild member slot I didn't need to sent it to the client because of the text commands, but with the way I set up the data structure you will need that client sided now.

Find(Client)
```
    'Guild TUT
    GuildName As String
```under add

```
GuildMemberId As long
```
than in (client)HandlePlayerData/(server)SendPlayerData just add it in like I added the guild name.
Link to comment
Share on other sites

There isn't anywhere I see in Server that sends the guildname… and where at in serve is SendPlayerData because all I see is```
Sub SendPlayerData(ByVal index As Long)
    Dim packet As String
    SendDataToMap GetPlayerMap(index), PlayerData(index)
End Sub
```
in ModServerTCP.. I am still a little new to this

EDIT

is this the code you are talking about editing server side

```
If Player(index).GuildFileId > 0 Then
        If TempPlayer(index).TmpGuildSlot > 0 Then
            Buffer.WriteByte 1
            Buffer.WriteString GuildData(TempPlayer(index).TmpGuildSlot).Guild_Name
        End If
    Else
        Buffer.WriteByte 0
    End If
```
Link to comment
Share on other sites

ok i fixed main post i dont fixed that problem with guild disband so i just removed check and guildcdesc was from my code but i removed it when i maked this tutorial and i forgot to remove that line

i cant fix that problem with guild disband visible becouse im not on my pc now. But i will try to fix it, when i have go on my pc :cheesy:
Link to comment
Share on other sites

@kira423:

> There isn't anywhere I see in Server that sends the guildname… and where at in serve is SendPlayerData because all I see is```
> Sub SendPlayerData(ByVal index As Long)
>     Dim packet As String
>     SendDataToMap GetPlayerMap(index), PlayerData(index)
> End Sub
> ```
> in ModServerTCP.. I am still a little new to this
>
> EDIT
>
> is this the code you are talking about editing server side
>
> ```
> If Player(index).GuildFileId > 0 Then
>         If TempPlayer(index).TmpGuildSlot > 0 Then
>             Buffer.WriteByte 1
>             Buffer.WriteString GuildData(TempPlayer(index).TmpGuildSlot).Guild_Name
>         End If
>     Else
>         Buffer.WriteByte 0
>     End If
> ```

You must modify this i think but it must send Player(Index).GuildMemberId i think
Link to comment
Share on other sites

So on server side is too data for if user is online, so i try to send it too and add checkbutton to guild menu, that have caption for example Online, and if that ch eck ischecked, the guild members list will show only Online Guild Users.
Link to comment
Share on other sites

@devilfrenzy:

> Can not find it. Help me !!
> Now in Sub LoadGui search for
>
> Code: [Select]
> frmMain.picOptions.Picture = LoadPicture(App.Path & "\data files\graphics\gui\main\options.jpg")

It's in ModGeneral, just use cntrl+f make sure you click Current Project and it searches all of the files in the project
Link to comment
Share on other sites

I fixed the issue I was having, thanks Scott and Deathbeam for clarifying what I did wrong

to get it working properly

Server side find this in ModServerTCP

```
If Player(index).GuildFileId > 0 Then
        If TempPlayer(index).TmpGuildSlot > 0 Then
            Buffer.WriteByte 1
            Buffer.WriteString GuildData(TempPlayer(index).TmpGuildSlot).Guild_Name
        End If
    Else
        Buffer.WriteByte 0
    End If
```
under add

```
If Player(index).GuildFileId > 0 Then
        If TempPlayer(index).TmpGuildSlot > 0 Then
            Buffer.WriteByte 1
            Buffer.WriteLong Player(index).GuildMemberId
        End If
    Else
        Buffer.WriteByte 0
    End If
```
Save and compile

then Client side find this in ModTypes

```
GuildName As String
```
under add

```
GuildMemberId As Long
```
in ModHandleData find

```
If Buffer.ReadByte = 1 Then
        Player(i).GuildName = Buffer.ReadString
    Else
        Player(i).GuildName = vbNullString
    End If
```
under add

```
If Buffer.ReadByte = 1 Then
        Player(i).GuildMemberId = Buffer.ReadLong
    Else
        Player(i).GuildMemberId = 0
    End If
```
Finally in ModGeneral find

```
If GuildData.Guild_Members(MyIndex).Rank > 5 Then
frmMain.lblGuildDisband.visible = True
        Else
            frmMain.lblGuildDisband.visible = False
        End If
```
and change to

```
        If Player(MyIndex).GuildMemberId > 0 Then
    If GuildData.Guild_Members(Player(MyIndex).GuildMemberId).Rank > 5 Then
            frmMain.lblGuildDisband.visible = True
        Else
            frmMain.lblGuildDisband.visible = False
        End If
        End If
```<– This implements what Scott said below
Link to comment
Share on other sites

Don't do this
```
If Player(MyIndex).GuildMemberId = 1 Then
```
Do this, the rest is fine.
```
if Player(MyIndex).GuildMemberId > 0 then
    If GuildData.Guild_Members(Player(MyIndex).GuildMemberId).Rank > 5 Then
          'stuffhere
    end if
end if

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