Sada Posted April 16, 2011 Author Share Posted April 16, 2011 Hey guys this is my first tutorial so I hope you all enjoy! :)I only starting using eclipse a few days ago so if there's anything in their that you believe is pointless or done wrong please show me the light!What this peice of code actually does is simple, add access tags above players heads [Admin] , [Mod] / [GM] etc.It also changes the colour of the players name according to their level.Color code is as follows>! <= 10 levels lower = green< 5 levels lower = yellow> 5 levels lower and < 5 levels higher = white> 5 levels higher = blue>= 10 levels higher = purple If pk is on their colour is overrided and turns red.Open ModText.bas on the client source.Replace the sub DrawPlayerName with the following.```Public Sub DrawPlayerName(ByVal Index As Long)Dim TextX As LongDim TextY As LongDim TextX2 As LongDim TextY2 As LongDim Title As StringDim color As LongDim Name As String ' If debug mode, handle error then exit out If Options.Debug = 1 Then On Error GoTo errorhandler Select Case GetPlayerAccess(Index) Case 0 Title = "[Ac.0]" Case 1 Title = "[Ac.1]" Case 2 Title = "[Ac.2]" Case 3 Title = "[Ac.3]" Case 4 Title = "[Ac.4]" Case 5 Title = "[Ac.5]" End Select If Player(Index).PK = False Then If Player(Index).Level <> Player(MyIndex).Level Then Dim LevelDiff As Long LevelDiff = CLng(Player(Index).Level) - CLng(Player(MyIndex).Level) If LevelDiff < 5 And LevelDiff > -5 Then 'White color = RGB(255, 255, 255) ElseIf LevelDiff < 10 And LevelDiff >= 5 Then 'Blue color = RGB(0, 160, 230) ElseIf LevelDiff >= 10 Then 'Purple color = RGB(120, 50, 120) ElseIf LevelDiff > -10 Then 'Yellow color = RGB(250, 240, 0) ElseIf LevelDiff <= -10 Then 'Green color = RGB(60, 190, 50) End If Else color = RGB(255, 255, 255) End If Else color = RGB(255, 96, 0) End If If Title <> "" Then ' calc pos TextX2 = ConvertMapX(GetPlayerX(Index) * PIC_X) + Player(Index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$(Title))) If GetPlayerSprite(Index) < 1 Or GetPlayerSprite(Index) > NumCharacters Then TextY2 = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - 16 Else ' Determine location for text TextY2 = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - (DDSD_Character(GetPlayerSprite(Index)).lHeight / 4) End If ' Draw Access Call DrawText(TexthDC, TextX2, TextY2, Title, color) End If Name = Trim$(Player(Index).Name) ' calc pos TextX = ConvertMapX(GetPlayerX(Index) * PIC_X) + Player(Index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$(Name))) If GetPlayerSprite(Index) < 1 Or GetPlayerSprite(Index) > NumCharacters Then TextY = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - 16 Else ' Determine location for text TextY = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - (DDSD_Character(GetPlayerSprite(Index)).lHeight / 4) + 16 End If ' Draw name Call DrawText(TexthDC, TextX, TextY, Name, color) ' Error handler Exit Suberrorhandler: HandleError "DrawPlayerName", "modText", Err.Number, Err.Description, Err.Source, Err.HelpContext Err.Clear Exit SubEnd Sub```To change the name of the tags above the users head change the string under each of the cases, or to remove the tag from above their head completely remove that specific case.Lastly Screenshot!>! ![](http://img59.imageshack.us/img59/6505/eclipseorigins.png) Link to comment Share on other sites More sharing options...
Yxxe Posted April 16, 2011 Share Posted April 16, 2011 Looks ok, I reckon you should only display titles of users above the normal access value. Link to comment Share on other sites More sharing options...
Sada Posted April 16, 2011 Author Share Posted April 16, 2011 You can easily change that, if you read in my post, it says to remove titles you just remove that case from the select case. Link to comment Share on other sites More sharing options...
Yxxe Posted April 16, 2011 Share Posted April 16, 2011 @Sada:> You can easily change that, if you read in my post, it says to remove titles you just remove that case from the select case.I know what to do lol, I was just giving you a suggestion. But if you are leaving it for others to change, fair enough. :] Link to comment Share on other sites More sharing options...
Sada Posted April 16, 2011 Author Share Posted April 16, 2011 Is there anything you would have changed coding wise? I'm still getting the hang of vb6's syntax. Link to comment Share on other sites More sharing options...
Yxxe Posted April 16, 2011 Share Posted April 16, 2011 Looks fine having a quick scan over it. ;] Link to comment Share on other sites More sharing options...
Grimnnak Posted April 29, 2011 Share Posted April 29, 2011 How would i go about adding this in with:'Draw level Call DrawText(TexthDC, TextA, TextB, "Level " & GetPlayerLevel(Index), color) Link to comment Share on other sites More sharing options...
Grimnnak Posted April 29, 2011 Share Posted April 29, 2011 NVM i got it thanks :D Link to comment Share on other sites More sharing options...
Sada Posted May 4, 2011 Author Share Posted May 4, 2011 I'm glad my code could be of some use to someone -_- :). Link to comment Share on other sites More sharing options...
creatorfromhell Posted May 9, 2011 Share Posted May 9, 2011 Thanks for this I was looking for something like this. Only thing I changed was the title to the following:* Case 0 = [Player]* Case 2 = [Mapper]* Case 3 = [Moderator]* Case 4 = [Admin]* Case 5 = [Owner]The only one I couldn't remember is the Case 1. Link to comment Share on other sites More sharing options...
PandorasRequiem Posted May 14, 2011 Share Posted May 14, 2011 I love this code but how would i go about removing the change color of name by level feature? I'm sure this is a dumb question but i just can't figure this one out. Really love the tag above the name idea though :) Link to comment Share on other sites More sharing options...
Ruins of Hell Posted May 14, 2011 Share Posted May 14, 2011 xLightx: remove:``` If Player(Index).Level <> Player(MyIndex).Level Then Dim LevelDiff As Long LevelDiff = CLng(Player(Index).Level) - CLng(Player(MyIndex).Level) If LevelDiff < 5 And LevelDiff > -5 Then 'White color = RGB(255, 255, 255) ElseIf LevelDiff < 10 And LevelDiff >= 5 Then 'Blue color = RGB(0, 160, 230) ElseIf LevelDiff >= 10 Then 'Purple color = RGB(120, 50, 120) ElseIf LevelDiff > -10 Then 'Yellow color = RGB(250, 240, 0) ElseIf LevelDiff <= -10 Then 'Green color = RGB(60, 190, 50) End If Else color = RGB(255, 255, 255) End If```That from Sub DrawPlayerName. Link to comment Share on other sites More sharing options...
PandorasRequiem Posted May 15, 2011 Share Posted May 15, 2011 Thanks ^_^ Link to comment Share on other sites More sharing options...
djs428X Posted May 15, 2011 Share Posted May 15, 2011 Didn't work :( :sad: 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