| Mirage Source http://miragesource.net/forums/ |
|
| Mapreport Upgrade http://miragesource.net/forums/viewtopic.php?f=210&t=3703 |
Page 1 of 1 |
| Author: | Rian [ Fri May 09, 2008 8:02 pm ] |
| Post subject: | Mapreport Upgrade |
This tutorial adds a form for your /mapreport command. This form allows you to view a list of your maps, warp to them, and edit them. Client Side Start by adding a new form, called frmMapReport. To this form, add the following: 3 command buttons: cmdGoTo, cmdEdit, cmdCancel 1 list box: lstMaps 1 text box: txtMap 1 scroll bar: scrlMapNum Now add this code to frmMapReport: Code: Private Sub Form_Load() Dim Packet As String Packet = "REQUESTMAPLIST" & SEP_CHAR & END_CHAR Call SendData(Packet) End Sub Private Sub lstMaps_Click() txtMap.Text = lstMaps.ListIndex + 1 End Sub Private Sub scrlMapNum_Change() txtMap.Text = scrlMapNum.Value End Sub Private Sub cmdGoTo_Click() If txtMap.Text > 0 Then lstMaps.ListIndex = txtMap.Text - 1 scrlMapNum.Value = txtMap.Text Call WarpTo(scrlMapNum.Value) End If End Sub Private Sub cmdEdit_Click() Call SendRequestEditMap End Sub Private Sub cmdCancel_Click() Unload Me End Sub Now add this to Sub HandleData: Code: ' :::::::::::::::::: ' :: Get Map List :: ' :::::::::::::::::: If LCase(Parse(0)) = "maplist" Then frmMapReport.lstMaps.Clear n = 2 z = Val(Parse(1)) For X = n To (z + 1) If Trim(Parse(n)) <> vbNullString Then frmMapReport.lstMaps.AddItem "Map # " & (X - 1) & ": " & Trim(Parse(n)) Else frmMapReport.lstMaps.AddItem "Map # " & (X - 1) & ": Free Map" End If n = n + 2 Next X Exit Sub End If ' ::::::::::::::::::::: ' :: Edit map packet :: ' ::::::::::::::::::::: If (LCase(Parse(0)) = "mapreport") Then Call MapReportInit Exit Sub End If Add this anywhere (I put it in modGameLogic along with the other editor inits): Code: Public Sub MapReportInit() frmMapReport.Show End Sub Server Side In Sub HandleData, find the Map Report Packet, and paste this at the bottom, but before the exit sub: Code: Call SendDataTo(Index, "MAPREPORT" & SEP_CHAR & END_CHAR) And add this somewhere in modServerTCP: Code: Sub SendMapList(ByVal Index As Long) Dim Packet As String Dim I As Long Dim n As Long Packet = "" n = 0 For I = 1 To MAX_MAPS Packet = Packet & SEP_CHAR & MAP(I).Name & SEP_CHAR n = n + 1 Next I Packet = "MAPLIST" & SEP_CHAR & n & Packet & END_CHAR Call SendDataTo(Index, Packet) End Sub And lastley, right under this Map Report Packet, paste this packet: Code: ' ::::::::::::::::::::::::::::: ' :: Request Map List Packet :: ' ::::::::::::::::::::::::::::: If LCase(Parse(0)) = "requestmaplist" Then ' Prevent hacking If GetPlayerAccess(Index) < ADMIN_MAPPER Then Call HackingAttempt(Index, "Admin Cloning") Exit Sub End If Call SendMapList(Index) End If Been a while since I added this to my game, so I'm not sure if I including everything that needs to be there. Let me know if it doesn't work, and I'll update the tutorial. |
|
| Author: | Coke [ Sat May 10, 2008 11:37 pm ] |
| Post subject: | Re: Mapreport Upgrade |
I love you. Much. |
|
| Author: | Ramsey [ Sun May 11, 2008 7:58 pm ] |
| Post subject: | Re: Mapreport Upgrade |
You forgot to include the Sub SendMapList |
|
| Author: | Rian [ Tue May 13, 2008 1:25 am ] |
| Post subject: | Re: Mapreport Upgrade |
Updated the tutorial with the missing sub |
|
| Author: | Robin [ Tue May 13, 2008 9:14 am ] |
| Post subject: | Re: Mapreport Upgrade |
Wow.. that's very useful. I just started re-mapping Winds Whisper so this'll be very useful. Thanks Ruggles <33 |
|
| Author: | Ramsey [ Tue May 13, 2008 7:49 pm ] |
| Post subject: | Re: Mapreport Upgrade |
Works perfectly. Thanks. |
|
| Author: | Sh4d0ws [ Sun Jul 13, 2008 8:14 pm ] |
| Post subject: | Re: Mapreport Upgrade |
Little old I guess... but oh well. In one of your packet's it did not have "z" as a variable. It gave me an error on the line, "z = val(parse(1))". Not sure if this matters, but this is how I managed to easily fix it (assuming it works). I'm using the newest version of MS out right now. Code: ' ::::::::::::::::::
' :: Get Map List :: ' :::::::::::::::::: Dim z As Integer If LCase(Parse(0)) = "maplist" Then frmMapReport.lstMaps.Clear n = 2 z = Val(Parse(1)) For x = n To (z + 1) If Trim(Parse(n)) <> vbNullString Then frmMapReport.lstMaps.AddItem "Map # " & (x - 1) & ": " & Trim(Parse(n)) Else frmMapReport.lstMaps.AddItem "Map # " & (x - 1) & ": Free Map" End If n = n + 2 Next x Exit Sub |
|
| Page 1 of 1 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|