Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Portal Warp
#1
Author: map210690
Modifications: PresiseFA
Difficulty: 1/5

What this does: You type /setportal, and it records your location. Afterwards, you can warp to that location by typing /portal.

:: CLIENT SIDE ::
Find:
Code:
Sub HandleKeyPresses
Somewhere in there, add:
Code:
' Portal code
        If LCase(Mid(MyText, 1, 10)) = "/setportal" Then
              Call SendData("setportal" & SEP_CHAR & END_CHAR)
              MyText = ""
              Exit Sub
        End If
        
        If LCase(Mid(MyText, 1, 7)) = "/portal" Then
              Call SendData("portal" & SEP_CHAR & END_CHAR)
              MyText = ""
              Exit Sub
        End If

:: SERVER SIDE ::
Find:
Code:
Sub HandleData
At the top of the sub, add:
Code:
Dim CNum As Long
Then, somewhere in the sub, add:
Code:
' Portals Code
    For CNum = 1 To MAX_CHARS
    
    If LCase(Parse(0)) = "setportal" Then
              If GetPlayerAccess(Index) > "0" Then
                  Call PutVar(App.Path & "\accounts\" & GetPlayerLogin(Index) & ".ini", "char" & CNum, "portal", 1)
                  Call PlayerMsg(Index, "You have created a portal opening at this spot! You may now return to this spot at any time by typing /portal", 6)
                  Call PutVar(App.Path & "\accounts\" & GetPlayerLogin(Index) & ".ini", "char" & CNum, "pmap", GetPlayerMap(Index))
                  Call PutVar(App.Path & "\accounts\" & GetPlayerLogin(Index) & ".ini", "char" & CNum, "px", GetPlayerX(Index))
                  Call PutVar(App.Path & "\accounts\" & GetPlayerLogin(Index) & ".ini", "char" & CNum, "py", GetPlayerY(Index))
              Else
                  Call PlayerMsg(Index, "You do not have that ability.", 4)
              End If
        Exit Sub
    End If
        
    If LCase(Parse(0)) = "portal" Then
              If GetVar(App.Path & "\accounts\" & GetPlayerLogin(Index) & ".ini", "char" & CNum, "portal") = 1 Then
           Call SetPlayerMap(Index, GetVar(App.Path & "\accounts\" & GetPlayerLogin(Index) & ".ini", "char" & CNum, "pmap"))
                  Call SetPlayerY(Index, GetVar(App.Path & "\accounts\" & GetPlayerLogin(Index) & ".ini", "char" & CNum, "py"))
           Call SetPlayerX(Index, GetVar(App.Path & "\accounts\" & GetPlayerLogin(Index) & ".ini", "char" & CNum, "px"))
                  Call SendPlayerData(Index)
              ElseIf GetVar(App.Path & "\accounts\" & GetPlayerLogin(Index) & ".ini", "char" & CNum, "portal") = 0 Then
                  Call PlayerMsg(Index, "You do not have a portal set.", 4)
              End If
        Exit Sub
    End If
    Next CNum
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)