Krumelz Posted January 10, 2011 Author Share Posted January 10, 2011 This is a tutorial for EO 1.1.0\. It may works for EO XMAS too, didnt test it though.with this features you can add little status 'signs' next to the players name and mute somespammer. Example Screenie:![](http://www.freemmorpgmaker.com/files/imagehost/pics/1736b352c9b4973d9e89df8dc76c2d00.JPG)Perhaps this is not the best way of doing it, but it works fine. Well, lets go.Client Sidesearch for PlayerRec and after```Dir as byte```add```Status as string * 12```in mod enumerations before:```' Make sure CMSG_COUNT is below everything else CMSG_COUNT```add:```CCommands```Do the same for the servers PlayerRec and Mod enumerations!!in mod ClientTCP, at the bottom add:```Public Sub SendCommand(ByVal command As String, ByVal target As String) Dim Buffer As New clsBuffer Set Buffer = New clsBuffer Buffer.WriteLong CCommands Buffer.WriteString command If target = "0" Then Buffer.WriteLong 0 Else Buffer.WriteLong 1 Buffer.WriteString target End If SendData Buffer.ToArray() Set Buffer = NothingEnd Sub```next find:```' // Mapper Admin Commands // ' Location Case "/loc"```before that add:``` Case "/status" If Not UBound(command) < 1 Then Call SendCommand("status", Trim$(command(1))) Else Call SendCommand("status", "0") End If Case "/away" If Not UBound(command) < 1 Then Exit Sub Else Call SendCommand("away", "0") End If Case "/mute" If Not UBound(command) < 1 Then Call SendCommand("mute", command(1)) Else AddText "Usage: /mute playnername", BrightRed End If```find Sub DrawPlayerNameand replace the whole sub with:```Public Sub DrawPlayerName(ByVal index As Long) Dim TextX As Long Dim TextY As Long Dim color As Long Dim status As String status = Trim$(Player(index).status) ' Check access level If GetPlayerPK(index) = NO Then Select Case GetPlayerAccess(index) Case 0 color = RGB(255, 96, 0) Case 1 color = QBColor(DarkGrey) Case 2 color = QBColor(Magenta) Case 3 color = QBColor(BrightCyan) Case 4 color = QBColor(Blue) Case 5 color = QBColor(Yellow) Case Else color = QBColor(Yellow) End Select Else color = QBColor(BrightRed) End IfIf status <> "" Then If GetPlayerSprite(index) < 1 Or GetPlayerSprite(index) > NumCharacters Then TextX = ConvertMapX(GetPlayerX(index) * PIC_X) + Player(index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$(GetPlayerName(index) & " [" & status & "]"))) TextY = ConvertMapY(GetPlayerY(index) * PIC_Y) + Player(index).YOffset - 16 Else ' Determine location for text TextX = ConvertMapX(GetPlayerX(index) * PIC_X) + Player(index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$(GetPlayerName(index) & " [" & status & "]"))) TextY = ConvertMapY(GetPlayerY(index) * PIC_Y) + Player(index).YOffset - (DDSD_Character(GetPlayerSprite(index)).lHeight) + 16 End IfElse If GetPlayerSprite(index) < 1 Or GetPlayerSprite(index) > NumCharacters Then TextX = ConvertMapX(GetPlayerX(index) * PIC_X) + Player(index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$(GetPlayerName(index)))) TextY = ConvertMapY(GetPlayerY(index) * PIC_Y) + Player(index).YOffset - 16 Else ' Determine location for text TextX = ConvertMapX(GetPlayerX(index) * PIC_X) + Player(index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$(GetPlayerName(index)))) TextY = ConvertMapY(GetPlayerY(index) * PIC_Y) + Player(index).YOffset - (DDSD_Character(GetPlayerSprite(index)).lHeight) + 16 End IfEnd If ' Draw nameIf status <> "" Then Call DrawText(TexthDC, TextX, TextY, GetPlayerName(index) & " [" & status & "]", color)Else Call DrawText(TexthDC, TextX, TextY, GetPlayerName(index), color)End IfEnd Sub```Now find Sub HandlePlayerInfo and after:``` For x = 1 To Stats.Stat_Count - 1 SetPlayerStat I, x, Buffer.ReadLong Next```add:```Player(I).status = Buffer.ReadString```Done client sided ^^Server SideIf you havent added the code to mod enumerations and the PlayerRec do it now!Mod handleData:after:```HandleDataSub(CUntradeItem) = GetAddress(AddressOf HandleUntradeItem)```add:```HandleDataSub(CCommands) = GetAddress(AddressOf HandleCommands)```at the bottom of mod handledata add:```Sub HandleCommands(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)Dim command As StringDim target As StringDim n As LongDim command2 As StringDim Buffer As New clsBufferSet Buffer = New clsBufferBuffer.WriteBytes Data() command = Buffer.ReadString n = Buffer.ReadLong If n = 1 Then command2 = Buffer.ReadString target = FindPlayer(command2) Else End If Select Case command Case "mute" If GetPlayerAccess(index) <= 1 Then PlayerMsg index, "Not a valid command!", BrightRed Exit Sub End If If Player(target).Status <> "MUTED" Then Player(target).Status = "MUTED" Else Player(target).Status = "" End If Call SendPlayerData(target) Case "away" If Player(index).Status <> "Away" Then Player(index).Status = "Away" Call GlobalMsg(GetPlayerName(index) & " is now away.", Yellow) Else Player(index).Status = "" Call GlobalMsg(GetPlayerName(index) & " has returned from being away.", Yellow) End If Call SendPlayerData(index) Case "status"If Not Player(index).Status = "MUTED" Then If n = 1 Then Player(index).Status = command2 Else Player(index).Status = "" End IfElse PlayerMsg index, "You are muted!", RedEnd If Call SendPlayerData(index) Case Else Call PlayerMsg(index, "Not a valid command!", BrightRed) End SelectSet Buffer = NothingEnd Sub```in Function Playerdata, after:``` For I = 1 To Stats.Stat_Count - 1 Buffer.WriteLong GetPlayerStat(index, I) Next```add:```Buffer.WriteString Player(index).Status```almost done, now to make the mute actually work..in Sub HandleSayMsg, before:```Call AddLog("Map #" & GetPlayerMap(index) & ": " & GetPlayerName(index) & " says, '" & msg & "'", PLAYER_LOG)```add:``` If Player(index).Status = "MUTED" Then Call PlayerMsg(index, "You are muted!", BrightRed) Exit Sub End If```add the same in mod HandleEmoteMsg before:```Call AddLog("Map #" & GetPlayerMap(index) & ": " & GetPlayerName(index) & " " & msg, PLAYER_LOG)```in Sub HandleBroadcastMsg before:``` s = "[Global]" & GetPlayerName(index) & ": " & msg```and in Sub HandlePlayerMsg before:```' Check if they are trying to talk to themselves```Hope I didnt miss anything and it works, if it doesnt just reply. No credits needed.Hope you like it ~ Krumelz Link to comment Share on other sites More sharing options...
erkro1 Posted January 10, 2011 Share Posted January 10, 2011 Looks nice, gonna test it now in EO XMAS ;) Link to comment Share on other sites More sharing options...
Krumelz Posted January 10, 2011 Author Share Posted January 10, 2011 @erkro1:> Looks nice, gonna test it now in EO XMAS ;)thanks, could you tell me if it works when you're done adding the code? Link to comment Share on other sites More sharing options...
kibbelz Posted January 10, 2011 Share Posted January 10, 2011 very simple commands system. You can always edit it so you can add more commands with effects to it. Good work ^^ Link to comment Share on other sites More sharing options...
erkro1 Posted January 11, 2011 Share Posted January 11, 2011 @Krumelz:> thanks, could you tell me if it works when you're done adding the code?Ok, i will do that ;) Link to comment Share on other sites More sharing options...
Ruins of Hell Posted January 16, 2011 Share Posted January 16, 2011 Stop posting when the user has been warned. If you feel offended, report it and move on.(To everyone whose post I deleted.) Link to comment Share on other sites More sharing options...
TheRexion Posted January 20, 2011 Share Posted January 20, 2011 I think this is a very nice code you've got here. Only problem I've got is it shows boxes instead of the status'. Link to comment Share on other sites More sharing options...
Krumelz Posted January 20, 2011 Author Share Posted January 20, 2011 @Ecclestio:> I think this is a very nice code you've got here. Only problem I've got is it shows boxes instead of the status'.may you could post a screenie? Guess it'd be easier for me to understand your problem then. ^^ Link to comment Share on other sites More sharing options...
TheRexion Posted January 22, 2011 Share Posted January 22, 2011 Nevermind, I got a blank client and installed it to that and it works great. The simple thing is I can't get it to use uppercase and lowercase instead of just lowercase. If you know how I could fix that.. it'd be great. Link to comment Share on other sites More sharing options...
Krumelz Posted January 26, 2011 Author Share Posted January 26, 2011 @Ecclestio:> Nevermind, I got a blank client and installed it to that and it works great. The simple thing is I can't get it to use uppercase and lowercase instead of just lowercase. If you know how I could fix that.. it'd be great.yea, got the same problem, working on that atm. Hope i can fix it soon. ^^ Link to comment Share on other sites More sharing options...
saruish Posted February 11, 2011 Share Posted February 11, 2011 im having a little trouble with my. it makes my name vanish and there no status command Link to comment Share on other sites More sharing options...
Krumelz Posted February 11, 2011 Author Share Posted February 11, 2011 which version of eclipse are you using? Link to comment Share on other sites More sharing options...
saruish Posted February 11, 2011 Share Posted February 11, 2011 the current verison. 1.5I think it showing up but it not showing up like it should. im seeing something at the very very top at first I didnt notice it but I started noticing like two something there. everytime my character moves it moves with him. but it like at the very top of the screen.it could be due to the level code I added that shows players level. Link to comment Share on other sites More sharing options...
TheRexion Posted February 20, 2011 Share Posted February 20, 2011 There is also another problem you should look into. Seeing as not everyone will know not to try to put spaces in their status(i.e. "/status run away"). You should make it so they are unable to do so, or find some way to allow spaces in it. Otherwise it gives a run time error and the server crashes.Also it'd be nice if it would accept capital letters as well, $UCase() or something. Link to comment Share on other sites More sharing options...
Helladen Posted February 20, 2011 Share Posted February 20, 2011 This should probably be a stored tempplayer value. Since it's never consistent. (Well never mind cause other players need to see it). Link to comment Share on other sites More sharing options...
Krumelz Posted February 24, 2011 Author Share Posted February 24, 2011 @saruish:> the current verison. 1.5> > I think it showing up but it not showing up like it should. im seeing something at the very very top at first I didnt notice it but I started noticing like two something there. everytime my character moves it moves with him. but it like at the very top of the screen.> > it could be due to the level code I added that shows players level.Thats odd. May you could send me the source of the subs you edited, so I can try to help you.@Ecclestio:> There is also another problem you should look into. Seeing as not everyone will know not to try to put spaces in their status(I.e. "/status run away"). You should make it so they are unable to do so, or find some way to allow spaces in it. Otherwise it gives a run time error and the server crashes.> > Also it'd be nice if it would accept capital letters as well, $UCase() or something.Fixed both of it, just change``` Case "/status" If Not UBound(command) < 1 Then Call SendCommand("status", Trim$(command(1))) Else Call SendCommand("status", "0") End If```to``` Dim status As String status = Right$(ChatText, Len(ChatText) - 7) If Not UBound(command) < 1 Then Call SendCommand("status", status) Else Call SendCommand("status", "0") End If```Capitals and Spaces should work now.Any other problem? Just reply, i hope i can help ^^~Krumelz Link to comment Share on other sites More sharing options...
Growlith1223 Posted January 23, 2012 Share Posted January 23, 2012 I got a problem with this D:It kinda works perfectly but now it just shows these little weird things in the status…Any help? D: Link to comment Share on other sites More sharing options...
Growlith1223 Posted January 23, 2012 Share Posted January 23, 2012 Could someone help me on this?I can't seem to get it to work.Everytime i try to type in /status message here, It doesn't add anything.It just stays at [|||||||||||||]Any command that relates to the commands, don't do anything.Any help would be appreciated. :O 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