Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
frmWarp
#7
Here's an easy fix.

In the client, go to the code.

Search for where it says...

Code:
Sub WarpTo(ByVal MapNum As Long)
Dim Packet As String
    
    Packet = "WARPTO" & SEP_CHAR & MapNum & SEP_CHAR & END_CHAR
    Call SendData(Packet)
End Sub

Add this one

Code:
Sub WarpTo2(ByVal MapNum As Long, x As Long, y As Long)
Dim Packet As String
    
    Packet = "WARPTO2" & SEP_CHAR & MapNum & SEP_CHAR & x & SEP_CHAR & y & SEP_CHAR & END_CHAR
    Call SendData(Packet)
End Sub

Now, you're done with the client.

Go to the server. Search for this code in the server.

Code:
' ::::::::::::::::::::::::
    ' :: Warp to map packet ::
    ' ::::::::::::::::::::::::
    If LCase(Parse(0)) = "warpto" Then
        ' Prevent hacking
        If GetPlayerAccess(Index) < ADMIN_MAPPER Then
            Call HackingAttempt(Index, "Admin Cloning")
            Exit Sub
        End If
        
        ' The map
        n = Val(Parse(1))
        
        ' Prevent hacking
        If n < 0 Or n > MAX_MAPS Then
            Call HackingAttempt(Index, "Invalid map")
            Exit Sub
        End If
        
        Call PlayerWarp(Index, n, GetPlayerX(Index), GetPlayerY(Index))
        Call PlayerMsg(Index, "You have been warped to map #" & n, BrightBlue)
        Call AddLog(GetPlayerName(Index) & " warped to map #" & n & ".", ADMIN_LOG)
        Exit Sub
    End If

And add this one
Code:
' :::::::::::::::::::::::::::::::::
    ' :: Warp(map,x,y) to map packet ::
    ' :::::::::::::::::::::::::::::::::
    If LCase(Parse(0)) = "warpto2" Then
        ' Prevent hacking[commented]
        'just in case you want this to be a admin only
        'feature if you want it to be an admin only feature
        'uncomment the commented code below
        '/////////////////////////////////////////////////
        'If GetPlayerAccess(Index) < ADMIN_MAPPER Then
        '    Call HackingAttempt(Index, "Admin Cloning")
        '    Exit Sub
        'End If
        '/////////////end admin only code/////////////////
        
        ' The map
        n = Val(Parse(1))
        
        'x and y
        x = Val(Parse(2))
        y = Val(Parse(3))
        
        ' Prevent hacking
        If n < 0 Or n > MAX_MAPS Then
            Call HackingAttempt(Index, "Invalid map")
            Exit Sub
        End If
        
        'prevent out of range[hacking]
        If x > MAX_MAPX Or y > MAX_MAPY Or x < 0 Or y < 0 Then
            Call HackingAttempt(Index, "Warping out of range")
            Exit Sub
        End If
        
        Call PlayerWarp(Index, n, x, y)
        Call PlayerMsg(Index, "You have been warped to map #" & n & "(" & x & "," & y & ")", BrightBlue)
        Call AddLog(GetPlayerName(Index) & " warped to map #" & n & "(" & x & "," & y & ")", ADMIN_LOG)
        Exit Sub
    End If

And there you have it. It should work. Now all you have to do Client side is call WarpTo2(mapnum,x,y).

Basically, this...

Code:
Private Sub cancelcmd_Click()
Unload Me
End Sub

Private Sub warpcmd_Click()
If selectwarp.Text = "Castle" Then
        Call WarpTo2(2, 2, 2)
    Else
        Call AddText("Cannot warp at the moment", BrightRed)
    End If
End Sub

@Stomach: I know that, but I told him if he wants to be somewhat proper with it, and allow for more complex if statements, nesting and using End If is essential.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)