tslusny Posted May 27, 2012 Author Share Posted May 27, 2012 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 SIDEDownload attachments and copy from Guild Menu.frm picGuild with everything in it to your frmMain.Now add Guild.jpg to \data files\graphics\gui\mainAt bottom of frmMain add```'Deathbeams Guild MenuPrivate Sub lblGuildInv_Click()If myTargetType = TARGET_TYPE_PLAYER And myTarget <> MyIndex ThenCall GuildCommand(2, Player(myTarget).Name)ElseAddText "Cant invite to Guild.", BrightRedEnd IfEnd SubPrivate Sub lblGuildLeave_Click()Call GuildCommand(3, "")End SubPrivate Sub lblGuildKick_Click()If lstGuildMembers.ListIndex > 0 ThenCall GuildCommand(9, Trim$(GuildData.Guild_Members((lstGuildMembers.ListIndex) + 1).User_Name))ElseIf myTargetType = TARGET_TYPE_PLAYER And myTarget <> MyIndex ThenCall GuildCommand(9, Player(myTarget).Name)End IfEnd IfEnd SubPrivate Sub lblGuildDisband_Click()lblGuildDisband.Caption = "Really ?"lblGuildYes.visible = TruelblGuildNo.visible = TruelblGuildYes.Caption = "Yes"lblGuildNo.Caption = "No"End SubPrivate Sub lblGuildYes_Click()lblGuildYes.visible = FalselblGuildNo.visible = FalsepicGuild.visible = FalselblGuildDisband.Caption = "Guild Disband"Call GuildCommand(10, "")End SubPrivate Sub lblGuildNo_Click()lblGuildYes.visible = FalselblGuildNo.visible = FalselblGuildDisband.Caption = "Guild Disband"End SubPrivate Sub lblGuildCAccept_Click()Call GuildCommand(1, txtGuildC.text)frmGuildC.visible = FalsepicGuild.visible = FalseEnd SubPrivate Sub lblGuildCCancel_Click()lblGuildC.visible = TruefrmGuildC.visible = FalseEnd SubPrivate Sub lblGuildC_Click()lblGuildC.visible = FalsefrmGuildC.visible = TrueEnd SubPrivate Sub lblGuildFounder_Click()If lstGuildMembers.ListIndex > 0 ThenCall GuildCommand(8, Trim$(GuildData.Guild_Members((lstGuildMembers.ListIndex) + 1).User_Name))ElseIf myTargetType = TARGET_TYPE_PLAYER And myTarget <> MyIndex ThenCall GuildCommand(8, Player(myTarget).Name)End IfEnd IfEnd SubPrivate 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 withname: lblGuildOpencaption: Guildanywhere 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``` UpdateGuildDataIf Not picGuild.visible Then' show the windowpicCharacter.visible = FalsepicInventory.visible = FalsepicSpells.visible = FalsepicOptions.visible = FalsepicGuild.visible = TruepicParty.visible = False' play soundPlaySound Sound_ButtonclickElsepicGuild.visible = FalseEnd If```Now add this sub at bottom of modGeneral```Public Sub UpdateGuildData()Dim I As Long, GuildRank As String, RankNum As LongWith frmMainIf Not Player(MyIndex).GuildName = vbNullString ThenCall 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 = TrueIf GuildData.Guild_Members(Player(MyIndex).GuildMemberId).Rank > 5 Then.lblGuildDisband.visible = True.lblGuildFounder.visible = TrueElse.lblGuildDisband.visible = False.lblGuildFounder.visible = FalseEnd If.lstGuildMembers.ClearElse.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 = FalseEnd IfFor I = 1 To MAX_GUILD_MEMBERSIf 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 IfEnd SelectIf Not Trim$(GuildData.Guild_Members(I).User_Name) = vbNullString ThenRankNum = GuildData.Guild_Members(I).RankGuildRank = GuildData.Guild_Ranks(RankNum).Name.lstGuildMembers.AddItem ("[" & GuildRank & "] " & GuildData.Guild_Members(I).User_Name).lstGuildMembers.ListIndex = 0End IfNext IEnd WithEnd Sub```in ModHandleData find```If Buffer.ReadByte = 1 ThenPlayer(i).GuildName = Buffer.ReadStringElsePlayer(i).GuildName = vbNullStringEnd If```And replace it with```If Buffer.ReadByte = 1 ThenPlayer(i).GuildName = Buffer.ReadStringPlayer(i).GuildMemberId = Buffer.ReadLongElsePlayer(i).GuildName = vbNullStringPlayer(i).GuildMemberId = 0End If```SERVER SIDEfind this in ModServerTCP```If Player(index).GuildFileId > 0 ThenIf TempPlayer(index).TmpGuildSlot > 0 ThenBuffer.WriteByte 1Buffer.WriteString GuildData(TempPlayer(index).TmpGuildSlot).Guild_NameEnd IfElseBuffer.WriteByte 0End If```And replace it with```If Player(index).GuildFileId > 0 ThenIf TempPlayer(index).TmpGuildSlot > 0 ThenBuffer.WriteByte 1Buffer.WriteString GuildData(TempPlayer(index).TmpGuildSlot).Guild_NameBuffer.WriteLong Player(index).GuildMemberIdEnd IfElseBuffer.WriteByte 0End If```UPDATEIf 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 ThenCall GuildCommand(8, Trim$(GuildData.Guild_Members((lstGuildMembers.ListIndex) + 1).User_Name))ElseIf myTargetType = TARGET_TYPE_PLAYER And myTarget <> MyIndex ThenCall GuildCommand(8, Player(myTarget).Name)End IfEnd IfEnd SubPrivate 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 LongWith frmMainIf Not Player(MyIndex).GuildName = vbNullString ThenCall 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 = TrueIf GuildData.Guild_Members(Player(MyIndex).GuildMemberId).Rank > 5 Then.lblGuildDisband.visible = True.lblGuildFounder.visible = TrueElse.lblGuildDisband.visible = False.lblGuildFounder.visible = FalseEnd If.lstGuildMembers.ClearElse.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 = FalseEnd IfFor I = 1 To MAX_GUILD_MEMBERSIf 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 IfEnd SelectIf Not Trim$(GuildData.Guild_Members(I).User_Name) = vbNullString ThenRankNum = GuildData.Guild_Members(I).RankGuildRank = GuildData.Guild_Ranks(RankNum).Name.lstGuildMembers.AddItem ("[" & GuildRank & "] " & GuildData.Guild_Members(I).User_Name).lstGuildMembers.ListIndex = 0End IfNext IEnd WithEnd 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 More sharing options...
tslusny Posted May 27, 2012 Author Share Posted May 27, 2012 And if u want u can delete Guild Commands too, but i dont deleted them becouse im too lazy :cheesy: Link to comment Share on other sites More sharing options...
Stein Posted May 27, 2012 Share Posted May 27, 2012 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 More sharing options...
tslusny Posted May 27, 2012 Author Share Posted May 27, 2012 :D Np Link to comment Share on other sites More sharing options...
Scott Posted May 27, 2012 Share Posted May 27, 2012 Looks great thanks for the contribution I'll link to this from my thread. Link to comment Share on other sites More sharing options...
quintensky Posted May 27, 2012 Share Posted May 27, 2012 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 foundit highlights:.lblGuildCDescit'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 More sharing options...
tslusny Posted May 27, 2012 Author Share Posted May 27, 2012 THX :embarrassed: Link to comment Share on other sites More sharing options...
FinalRiku Posted May 27, 2012 Share Posted May 27, 2012 Work :D thx! Link to comment Share on other sites More sharing options...
tslusny Posted May 27, 2012 Author Share Posted May 27, 2012 Im glad that you like it :cheesy: And Gratz, this is your first post :P Link to comment Share on other sites More sharing options...
kira423 Posted May 27, 2012 Share Posted May 27, 2012 Great tutorial thank you so much!! I was in the midst of making this myself last night and BAM I log in this morning and there is one up, saves me A LOT of time really appreciated!! Link to comment Share on other sites More sharing options...
quintensky Posted May 27, 2012 Share Posted May 27, 2012 w8… i think i missed something... when compiling it says:Method or Data member not foundit highlights:.lblGuildCDesci 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 More sharing options...
Stein Posted May 27, 2012 Share Posted May 27, 2012 It's the label that should be hidden behind the listbox me thinks, Guild Create Description. (I removed all that as I had my own system for it.. But I believe that was it) Link to comment Share on other sites More sharing options...
quintensky Posted May 27, 2012 Share Posted May 27, 2012 but if it's hidden, it can't be picked up? cuz it tells me it's just not there.. Link to comment Share on other sites More sharing options...
kira423 Posted May 27, 2012 Share Posted May 27, 2012 it isn't there just comment out that line, it works just fine believe me :) Link to comment Share on other sites More sharing options...
FinalRiku Posted May 27, 2012 Share Posted May 27, 2012 @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 More sharing options...
kira423 Posted May 27, 2012 Share Posted May 27, 2012 @ ^ I already assessed this in my last post -.-I have found a problem thoughThis 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 More sharing options...
Scott Posted May 28, 2012 Share Posted May 28, 2012 ```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 More sharing options...
kira423 Posted May 28, 2012 Share Posted May 28, 2012 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 thisEDITis 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 More sharing options...
tslusny Posted May 29, 2012 Author Share Posted May 29, 2012 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 linei 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 More sharing options...
tslusny Posted May 29, 2012 Author Share Posted May 29, 2012 @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 More sharing options...
Scott Posted May 29, 2012 Share Posted May 29, 2012 @Deathbeam:> You must modify this i think but it must send Player(Index).GuildMemberId i thinkBingo Link to comment Share on other sites More sharing options...
tslusny Posted May 29, 2012 Author Share Posted May 29, 2012 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 More sharing options...
kira423 Posted May 29, 2012 Share Posted May 29, 2012 @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 More sharing options...
kira423 Posted May 29, 2012 Share Posted May 29, 2012 I fixed the issue I was having, thanks Scott and Deathbeam for clarifying what I did wrongto get it working properlyServer 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 compilethen 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 ThenfrmMain.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 More sharing options...
Scott Posted May 29, 2012 Share Posted May 29, 2012 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 ifend if``` 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