Kaymak Posted November 19, 2014 Author Share Posted November 19, 2014 Hello i want to ask if someone could help me out there.If a player types in the chat /afk i want that his color turns grey and next to his name schould be [AFK]I hope you guys can help me thank you alot :)! Link to comment Share on other sites More sharing options...
Matt Posted November 19, 2014 Share Posted November 19, 2014 Server and Client >! Look for "PlayerRec". At the bottom, put there this>! ```>! afk as byte```Look for "Public Enum ServerPackets" and at the bottom of the enum, put there>! ```>! SPlayerToggledAfk>! ```Look for "Public Enum ClientPackets" and at the bottom of the enum, put there>! ```>! CToggleAfk>! ``` Server >! Look for "Public Sub InitMessages()" and anywhere in that sub, put there>! ```>! HandleDataSub(CToggleAfk) = GetAddress(AddressOf HandleToggleAfk)>! ```Now, go to the bottom of modHandleData and put there>! ```>! Sub HandleToggleAfk(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long) If Player(index).afk = 1 Then Player(index) = 0 Else Player(index).afk = 1 End If SendPlayerToggledAfk (index)End Sub>! ```Go to the bottom of modServerTCP and put this there>! ```>! Public Sub SendPlayerToggledAfk(ByVal index As Long)Dim Buffer As clsBuffer>! Set Buffer = New clsBuffer Buffer.WriteLong SPlayerToggledAfk Buffer.WriteLong index Buffer.WriteLong Player(index).afk SendDataToMap Player(index).Map, Buffer.ToArray() Set Buffer = NothingEnd Sub>! ```Lastly, look for "Function PlayerData(ByVal index As Long) As Byte()" and put this>! ```>! Buffer.WriteLong Player(index).afk>! ```above>! ```>! PlayerData = Buffer.ToArray()>! ``` Client >! Look for "Public Sub InitMessages()" and put there this>! ```>! HandleDataSub(SPlayerToggledAfk) = GetAddress(AddressOf HandlePlayerToggledAfk)>! ```Go to the bottom of modHandleData, and put there this>! ```>! Sub HandlePlayerToggledAfk(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)Dim Buffer As clsBufferDim playerIndex As Long>! Set Buffer = New clsBuffer Buffer.WriteBytes Data() playerIndex = Buffer.ReadLong Player(Index).afk = Buffer.ReadLong Set Buffer = NothingEnd Sub>! ```Look for "Public Sub DrawPlayerName(ByVal Index As Long)" and look for the chunk that looks like this>! ```>! Select Case GetPlayerAccess(Index) Case 0 color = RGB(255, 96, 0) Case 1 color = QBColor(DarkGrey) Case 2 color = QBColor(Cyan) Case 3 color = QBColor(BrightGreen) Case 4 color = QBColor(Yellow) End Select>! ```Replace it with this>! ```>! If Player(Index).afk = 0 Then Select Case GetPlayerAccess(Index) Case 0 color = RGB(255, 96, 0) Case 1 color = QBColor(DarkGrey) Case 2 color = QBColor(Cyan) Case 3 color = QBColor(BrightGreen) Case 4 color = QBColor(Yellow) End Select Else color = RGB(65, 65, 65) End If>! ```Look for "Select Case Command(0)" and put this under it>! ```>! Case "/afk" SendToggleAfk>! ```Now go to modClientTcp, and put this at the bottom>! ```>! Public Sub SendToggleAfk()Dim Buffer As clsBuffer>! Set Buffer = New clsBuffer Buffer.WriteLong CToggleAfk SendData Buffer.ToArray() Set Buffer = NothingEnd Sub>! ``` I think that should be everything. Save, compile, and enjoy. **Remember that you need to delete all old accounts, or make a data converter.** I haven't tested it, but I'll go through it now. Link to comment Share on other sites More sharing options...
Kaymak Posted November 19, 2014 Author Share Posted November 19, 2014 Thank you! I will be patient ! Link to comment Share on other sites More sharing options...
Slasheree Posted November 19, 2014 Share Posted November 19, 2014 > Look for "Public Sub InitMessages()" and anywhere in that sub, put there> > ```> > HandleDataSub(CToggleAfk) = GetAddress(AddressOf HandleToggleAfk)> > ```you put CToggleAfk here, which is right, but you use SToggleAfk in the rest of the code… :x```Sub HandleToggleAfk(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long) If Player(index).afk = 1 Then Player(index) = 0 <-- didn't you mean Player(index).afk = 0 ? Else Player(index).afk = 1 End If SendPlayerToggledAfk (index)End Sub```:) Link to comment Share on other sites More sharing options...
Matt Posted November 19, 2014 Share Posted November 19, 2014 Awh. Good eye Slasher. In my defense, I wrote this up fifteen minutes before I had class. I'll fix and finish it now. Cheers!EDIT: Finished. Link to comment Share on other sites More sharing options...
Kaymak Posted November 19, 2014 Author Share Posted November 19, 2014 Thank you alot, sadly I'm currently in bed tho. I will test it tomorrow! But if I may ask you for another help. Is it possible to show the actual damage, crit chance in a text label in the character window? Link to comment Share on other sites More sharing options...
Kaymak Posted November 20, 2014 Author Share Posted November 20, 2014 Well again thanks for the code, but sadly![](http://s14.directupload.net/images/141120/j7u778pz.png)my character has no name anymore :P ( yes deleted account)/EDIT -> I fixxed it```If Player(Index).afk = 0 Then Select Case GetPlayerAccess(Index) Case 0 color = RGB(255, 96, 0) Case 1 color = QBColor(DarkGrey) Case 2 color = QBColor(Cyan) Case 3 color = QBColor(BrightGreen) Case 4 color = QBColor(Yellow) End Select Else color = RGB(65, 65, 65) End If ```i changed it with this cause QBColor etc ( using Directx8 :P```If Player(Index).afk = 0 Then Select Case GetPlayerAccess(Index) Case 0 color = Orange Case 1 color = DarkGrey Case 2 color = Cyan Case 3 color = BrightGreen Case 4 color = Yellow End Select Else color = DarkGrey End If ```also you got a little mistake in the code nothing important```Sub HandleToggleAfk(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long) If Player(index).afk = 1 Then Player(index) = 0 Else Player(index).afk = 1 End If SendPlayerToggledAfk (index)End Sub ``````If Player(index).afk = 1 Then Player(index) = 0 Else ```instead of ```Player(index).afk = 0```you wrote```Player(index) = 0``` Link to comment Share on other sites More sharing options...
Matt Posted November 20, 2014 Share Posted November 20, 2014 Ah, shoot. Glad you figured it out though! I assure you, it wasn't intentional. It was only rushed. ^_^ Link to comment Share on other sites More sharing options...
Kaymak Posted November 20, 2014 Author Share Posted November 20, 2014 Ah no problem, thank you atleast for helping me out there you can close this thread i gonna change it to Solved :)! 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