Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Adding Guild - modInput Error


Yuko
 Share

Recommended Posts

Hello, I'm getting an error that is highlighting End If. I'll color the end if it highlights, someone please review my code and tell me what's wrong with it.

```

Option Explicit

' keyboard input

Public Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer

Public Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer

Public Sub CheckKeys()

' If debug mode, handle error then exit out

If Options.Debug = 1 Then On Error GoTo errorhandler

If GetAsyncKeyState(VK_UP) >= 0 Then DirUp = False

If GetAsyncKeyState(VK_DOWN) >= 0 Then DirDown = False

If GetAsyncKeyState(VK_LEFT) >= 0 Then DirLeft = False

If GetAsyncKeyState(VK_RIGHT) >= 0 Then DirRight = False

If GetAsyncKeyState(VK_CONTROL) >= 0 Then ControlDown = False

If GetAsyncKeyState(VK_SHIFT) >= 0 Then ShiftDown = False

' Error handler

Exit Sub

errorhandler:

HandleError "CheckKeys", "modInput", Err.Number, Err.Description, Err.Source, Err.HelpContext

Err.Clear

Exit Sub

End Sub

Public Sub CheckInputKeys()

' If debug mode, handle error then exit out

If Options.Debug = 1 Then On Error GoTo errorhandler

If GetKeyState(vbKeyShift) < 0 Then

ShiftDown = True

Else

ShiftDown = False

End If

If GetKeyState(vbKeyReturn) < 0 Then

CheckMapGetItem

End If

If GetKeyState(vbKeyControl) < 0 Then

ControlDown = True

Else

ControlDown = False

End If

'Move Up

If GetKeyState(vbKeyUp) < 0 Then

DirUp = True

DirDown = False

DirLeft = False

DirRight = False

Exit Sub

Else

DirUp = False

End If

'Move Right

If GetKeyState(vbKeyRight) < 0 Then

DirUp = False

DirDown = False

DirLeft = False

DirRight = True

Exit Sub

Else

DirRight = False

End If

'Move down

If GetKeyState(vbKeyDown) < 0 Then

DirUp = False

DirDown = True

DirLeft = False

DirRight = False

Exit Sub

Else

DirDown = False

End If

'Move left

If GetKeyState(vbKeyLeft) < 0 Then

DirUp = False

DirDown = False

DirLeft = True

DirRight = False

Exit Sub

Else

DirLeft = False

End If

' Error handler

Exit Sub

errorhandler:

HandleError "CheckInputKeys", "modInput", Err.Number, Err.Description, Err.Source, Err.HelpContext

Err.Clear

Exit Sub

End Sub

Public Sub HandleKeyPresses(ByVal KeyAscii As Integer)

Dim ChatText As String

Dim Name As String

Dim i As Long

Dim n As Long

Dim Command() As String

Dim Buffer As clsBuffer

' If debug mode, handle error then exit out

If Options.Debug = 1 Then On Error GoTo errorhandler

ChatText = Trim$(MyText)

If LenB(ChatText) = 0 Then Exit Sub

MyText = LCase$(ChatText)

' Handle when the player presses the return key

If KeyAscii = vbKeyReturn Then

'Guild Message

If Left$(ChatText, 1) = ";" Then

ChatText = Mid$(ChatText, 2, Len(ChatText) - 1)

If Len(ChatText) > 0 Then

Call GuildMsg(ChatText)

End If

MyText = vbNullString

frmMain.txtMyChat.text = vbNullString

Exit Sub

End If

' Broadcast message

If Left$(ChatText, 1) = "'" Then

ChatText = Mid$(ChatText, 2, Len(ChatText) - 1)

If Len(ChatText) > 0 Then

Call BroadcastMsg(ChatText)

End If

MyText = vbNullString

frmMain.txtMyChat.text = vbNullString

Exit Sub

End If

' Emote message

If Left$(ChatText, 1) = "-" Then

ChatText = Mid$(ChatText, 2, Len(ChatText) - 1)

If Len(ChatText) > 0 Then

Call EmoteMsg(ChatText)

End If

MyText = vbNullString

frmMain.txtMyChat.text = vbNullString

Exit Sub

End If

' Player message

If Left$(ChatText, 3) = "/p " Then

ChatText = Mid$(ChatText, 4, Len(ChatText) - 3)

Name = vbNullString

' Get the desired player from the user text

For i = 1 To Len(ChatText)

If Mid$(ChatText, i, 1) <> Space(1) Then

Name = Name & Mid$(ChatText, i, 1)

Else

Exit For

End If

Next

' Make sure they are actually sending something

If Len(ChatText) - i > 0 Then

ChatText = Mid$(ChatText, i + 1, Len(ChatText) - i)

' Send the message to the player

Call PlayerMsg(ChatText, Name)

Else

Call AddText("Usage: /p playername (message)", AlertColor)

End If

MyText = vbNullString

frmMain.txtMyChat.text = vbNullString

Exit Sub

End If

If Left$(MyText, 1) = "/" Then

Command = Split(MyText, Space(1))

Select Case Command(0)

Case "/help"

Call AddText("Social Commands:", HelpColor)

Call AddText("'msghere = Broadcast Message", HelpColor)

Call AddText("-msghere = Emote Message", HelpColor)

Call AddText("!namehere msghere = Player Message", HelpColor)

Call AddText("Available Commands: /info, /who, /fps, /fpslock", HelpColor)

Case "/info"

Case "/guild"

If UBound(Command) < 1 Then

Call AddText("Guild Commands:", HelpColor)

Call AddText("Make Guild: /guild make (GuildName)", HelpColor)

Call AddText("To transfer founder status use /guild founder (name)", HelpColor)

Call AddText("Invite to Guild: /guild invite (name)", HelpColor)

Call AddText("Leave Guild: /guild leave", HelpColor)

Call AddText("Open guild Admin: /guild admin", HelpColor)

Call AddText("Guild kick: /guild kick (name)", HelpColor)

Call AddText("Guild disband: /guild disband yes", HelpColor)

Call AddText("View Guild: /guild view (online/all/offline)", HelpColor)

Call AddText("^Default is online, example: /guild view would display all online users.", HelpColor)

Call AddText("You can talk in guild chat with: ;Message ", HelpColor)

GoTo Continue

End If

Select Case Command(1)

Case "make"

If UBound(Command) = 2 Then

Call GuildCommand(1, Command(2))

Else

Call AddText("Must have a name, use format /guild make (name)", BrightRed)

End If

Case "invite"

If UBound(Command) = 2 Then

Call GuildCommand(2, Command(2))

Else

Call AddText("Must select user, use format /guild invite (name)", BrightRed)

End If

Case "leave"

Call GuildCommand(3, "")

Case "admin"

Call GuildCommand(4, "")

' Checks to make sure we have more than one string in the array

If UBound(Command) < 1 Then

AddText "Usage: /info (name)", AlertColor

GoTo Continue

End If

If IsNumeric(Command(1)) Then

AddText "Usage: /info (name)", AlertColor

GoTo Continue

End If

Set Buffer = New clsBuffer

Buffer.WriteLong CPlayerInfoRequest

Buffer.WriteString Command(1)

SendData Buffer.ToArray()

Set Buffer = Nothing

' Whos Online

Case "/who"

SendWhosOnline

' Checking fps

Case "/fps"

BFPS = Not BFPS

' toggle fps lock

Case "/fpslock"

FPS_Lock = Not FPS_Lock

' Request stats

Case "/stats"

Set Buffer = New clsBuffer

Buffer.WriteLong CGetStats

SendData Buffer.ToArray()

Set Buffer = Nothing

' // Monitor Admin Commands //

' Admin Help

Case "/admin"

If GetPlayerAccess(MyIndex) < ADMIN_MONITOR Then GoTo Continue

frmMain.picAdmin.Visible = Not frmMain.picAdmin.Visible

' Kicking a player

Case "/kick"

If GetPlayerAccess(MyIndex) < ADMIN_MONITOR Then GoTo Continue

If UBound(Command) < 1 Then

AddText "Usage: /kick (name)", AlertColor

GoTo Continue

End If

If IsNumeric(Command(1)) Then

AddText "Usage: /kick (name)", AlertColor

GoTo Continue

End If

SendKick Command(1)

' // Mapper Admin Commands //

' Location

Case "/loc"

If GetPlayerAccess(MyIndex) < ADMIN_MAPPER Then GoTo Continue

BLoc = Not BLoc

' Map Editor

Case "/editmap"

If GetPlayerAccess(MyIndex) < ADMIN_MAPPER Then GoTo Continue

SendRequestEditMap

' Warping to a player

Case "/warpmeto"

If GetPlayerAccess(MyIndex) < ADMIN_MAPPER Then GoTo Continue

If UBound(Command) < 1 Then

AddText "Usage: /warpmeto (name)", AlertColor

GoTo Continue

End If

If IsNumeric(Command(1)) Then

AddText "Usage: /warpmeto (name)", AlertColor

GoTo Continue

End If

WarpMeTo Command(1)

' Warping a player to you

Case "/warptome"

If GetPlayerAccess(MyIndex) < ADMIN_MAPPER Then GoTo Continue

If UBound(Command) < 1 Then

AddText "Usage: /warptome (name)", AlertColor

GoTo Continue

End If

If IsNumeric(Command(1)) Then

AddText "Usage: /warptome (name)", AlertColor

GoTo Continue

End If

WarpToMe Command(1)

' Warping to a map

Case "/warpto"

If GetPlayerAccess(MyIndex) < ADMIN_MAPPER Then GoTo Continue

If UBound(Command) < 1 Then

AddText "Usage: /warpto (map #)", AlertColor

GoTo Continue

End If

If Not IsNumeric(Command(1)) Then

AddText "Usage: /warpto (map #)", AlertColor

GoTo Continue

End If

n = CLng(Command(1))

' Check to make sure its a valid map #

If n > 0 And n <= MAX_MAPS Then

Call WarpTo(n)

Else

Call AddText("Invalid map number.", Red)

End If

' Setting sprite

Case "/setsprite"

If GetPlayerAccess(MyIndex) < ADMIN_MAPPER Then GoTo Continue

If UBound(Command) < 1 Then

AddText "Usage: /setsprite (sprite #)", AlertColor

GoTo Continue

End If

If Not IsNumeric(Command(1)) Then

AddText "Usage: /setsprite (sprite #)", AlertColor

GoTo Continue

End If

SendSetSprite CLng(Command(1))

' Map report

Case "/mapreport"

If GetPlayerAccess(MyIndex) < ADMIN_MAPPER Then GoTo Continue

SendMapReport

' Respawn request

Case "/respawn"

If GetPlayerAccess(MyIndex) < ADMIN_MAPPER Then GoTo Continue

SendMapRespawn

' MOTD change

Case "/motd"

If GetPlayerAccess(MyIndex) < ADMIN_MAPPER Then GoTo Continue

If UBound(Command) < 1 Then

AddText "Usage: /motd (new motd)", AlertColor

GoTo Continue

End If

SendMOTDChange Right$(ChatText, Len(ChatText) - 5)

' Check the ban list

Case "/banlist"

If GetPlayerAccess(MyIndex) < ADMIN_MAPPER Then GoTo Continue

SendBanList

' Banning a player

Case "/ban"

If GetPlayerAccess(MyIndex) < ADMIN_MAPPER Then GoTo Continue

If UBound(Command) < 1 Then

AddText "Usage: /ban (name)", AlertColor

GoTo Continue

End If

SendBan Command(1)

' // Developer Admin Commands //

' Editing item request

Case "/edititem"

If GetPlayerAccess(MyIndex) < ADMIN_DEVELOPER Then GoTo Continue

SendRequestEditItem

' Editing animation request

Case "/editanimation"

If GetPlayerAccess(MyIndex) < ADMIN_DEVELOPER Then GoTo Continue

SendRequestEditAnimation

' Editing npc request

Case "/editnpc"

If GetPlayerAccess(MyIndex) < ADMIN_DEVELOPER Then GoTo Continue

SendRequestEditNpc

Case "/editresource"

If GetPlayerAccess(MyIndex) < ADMIN_DEVELOPER Then GoTo Continue

SendRequestEditResource

' Editing shop request

Case "/editshop"

If GetPlayerAccess(MyIndex) < ADMIN_DEVELOPER Then GoTo Continue

SendRequestEditShop

' Editing spell request

Case "/editspell"

If GetPlayerAccess(MyIndex) < ADMIN_DEVELOPER Then GoTo Continue

SendRequestEditSpell

' // Creator Admin Commands //

' Giving another player access

Case "/setaccess"

If GetPlayerAccess(MyIndex) < ADMIN_CREATOR Then GoTo Continue

If UBound(Command) < 2 Then

AddText "Usage: /setaccess (name) (access)", AlertColor

GoTo Continue

End If

If IsNumeric(Command(1)) Or Not IsNumeric(Command(2)) Then

AddText "Usage: /setaccess (name) (access)", AlertColor

GoTo Continue

End If

SendSetAccess Command(1), CLng(Command(2))

' Ban destroy

Case "/destroybanlist"

If GetPlayerAccess(MyIndex) < ADMIN_CREATOR Then GoTo Continue

SendBanDestroy

' Packet debug mode

Case "/debug"

If GetPlayerAccess(MyIndex) < ADMIN_CREATOR Then GoTo Continue

DEBUG_MODE = (Not DEBUG_MODE)

Case Else

AddText "Not a valid command!", HelpColor

End Select

'continue label where we go instead of exiting the sub

Continue:

MyText = vbNullString

frmMain.txtMyChat.text = vbNullString

Exit Sub

[color]End If (THIS IS THE ERROR END IF)[/color]

' Say message

If Len(ChatText) > 0 Then

Call SayMsg(ChatText)

End If

MyText = vbNullString

frmMain.txtMyChat.text = vbNullString

Exit Sub

End If

' Handle when the user presses the backspace key

If (KeyAscii = vbKeyBack) Then

If LenB(MyText) > 0 Then MyText = Mid$(MyText, 1, Len(MyText) - 1)

End If

' And if neither, then add the character to the user's text buffer

If (KeyAscii <> vbKeyReturn) Then

If (KeyAscii <> vbKeyBack) Then

MyText = MyText & ChrW$(KeyAscii)

End If

End If

' Error handler

Exit Sub

errorhandler:

HandleError "HandleKeyPresses", "modInput", Err.Number, Err.Description, Err.Source, Err.HelpContext

Err.Clear

Exit Sub

End Sub

```

Thank you,

Cici
Link to comment
Share on other sites

How's this? It's just the HandleKeyPresses method.

```

Public Sub HandleKeyPresses(ByVal KeyAscii As Integer)

Dim ChatText As String

Dim Name As String

Dim i As Long

Dim n As Long

Dim Command() As String

Dim Buffer As clsBuffer

' If debug mode, handle error then exit out

If Options.Debug = 1 Then On Error GoTo errorhandler

ChatText = Trim$(MyText)

If LenB(ChatText) = 0 Then Exit Sub

MyText = LCase$(ChatText)

' Handle when the player presses the return key

If KeyAscii = vbKeyReturn Then

'Guild Message

If Left$(ChatText, 1) = ";" Then

ChatText = Mid$(ChatText, 2, Len(ChatText) - 1)

If Len(ChatText) > 0 Then

Call GuildMsg(ChatText)

End If

MyText = vbNullString

frmMain.txtMyChat.Text = vbNullString

Exit Sub

End If

' Broadcast message

If Left$(ChatText, 1) = "'" Then

ChatText = Mid$(ChatText, 2, Len(ChatText) - 1)

If Len(ChatText) > 0 Then

Call BroadcastMsg(ChatText)

End If

MyText = vbNullString

frmMain.txtMyChat.Text = vbNullString

Exit Sub

End If

' Emote message

If Left$(ChatText, 1) = "-" Then

ChatText = Mid$(ChatText, 2, Len(ChatText) - 1)

If Len(ChatText) > 0 Then

Call EmoteMsg(ChatText)

End If

MyText = vbNullString

frmMain.txtMyChat.Text = vbNullString

Exit Sub

End If

' Player message

If Left$(ChatText, 3) = "/p " Then

ChatText = Mid$(ChatText, 4, Len(ChatText) - 3)

Name = vbNullString

' Get the desired player from the user text

For i = 1 To Len(ChatText)

If Mid$(ChatText, i, 1) <> Space(1) Then

Name = Name & Mid$(ChatText, i, 1)

Else

Exit For

End If

Next

' Make sure they are actually sending something

If Len(ChatText) - i > 0 Then

ChatText = Mid$(ChatText, i + 1, Len(ChatText) - i)

' Send the message to the player

Call PlayerMsg(ChatText, Name)

Else

Call AddText("Usage: /p playername (message)", AlertColor)

End If

MyText = vbNullString

frmMain.txtMyChat.Text = vbNullString

Exit Sub

End If

If Left$(MyText, 1) = "/" Then

Command = Split(MyText, Space(1))

Select Case Command(0)

Case "/help"

Call AddText("Social Commands:", HelpColor)

Call AddText("'msghere = Broadcast Message", HelpColor)

Call AddText("-msghere = Emote Message", HelpColor)

Call AddText("!namehere msghere = Player Message", HelpColor)

Call AddText("Available Commands: /info, /who, /fps, /fpslock", HelpColor)

Case "/info"

Case "/guild"

If UBound(Command) < 1 Then

Call AddText("Guild Commands:", HelpColor)

Call AddText("Make Guild: /guild make (GuildName)", HelpColor)

Call AddText("To transfer founder status use /guild founder (name)", HelpColor)

Call AddText("Invite to Guild: /guild invite (name)", HelpColor)

Call AddText("Leave Guild: /guild leave", HelpColor)

Call AddText("Open guild Admin: /guild admin", HelpColor)

Call AddText("Guild kick: /guild kick (name)", HelpColor)

Call AddText("Guild disband: /guild disband yes", HelpColor)

Call AddText("View Guild: /guild view (online/all/offline)", HelpColor)

Call AddText("^Default is online, example: /guild view would display all online users.", HelpColor)

Call AddText("You can talk in guild chat with: ;Message ", HelpColor)

GoTo Continue

End If

End Select

Select Case Command(1)

Case "make"

If UBound(Command) = 2 Then

Call GuildCommand(1, Command(2))

Else

Call AddText("Must have a name, use format /guild make (name)", BrightRed)

End If

Case "invite"

If UBound(Command) = 2 Then

Call GuildCommand(2, Command(2))

Else

Call AddText("Must select user, use format /guild invite (name)", BrightRed)

End If

Case "leave"

Call GuildCommand(3, "")

Case "admin"

Call GuildCommand(4, "")

' Checks to make sure we have more than one string in the array

If UBound(Command) < 1 Then

AddText "Usage: /info (name)", AlertColor

GoTo Continue

End If

If IsNumeric(Command(1)) Then

AddText "Usage: /info (name)", AlertColor

GoTo Continue

End If

Set Buffer = New clsBuffer

Buffer.WriteLong CPlayerInfoRequest

Buffer.WriteString Command(1)

SendData Buffer.ToArray()

Set Buffer = Nothing

' Whos Online

Case "/who"

SendWhosOnline

' Checking fps

Case "/fps"

BFPS = Not BFPS

' toggle fps lock

Case "/fpslock"

FPS_Lock = Not FPS_Lock

' Request stats

Case "/stats"

Set Buffer = New clsBuffer

Buffer.WriteLong CGetStats

SendData Buffer.ToArray()

Set Buffer = Nothing

' // Monitor Admin Commands //

' Admin Help

Case "/admin"

If GetPlayerAccess(MyIndex) < ADMIN_MONITOR Then GoTo Continue

frmMain.picAdmin.Visible = Not frmMain.picAdmin.Visible

' Kicking a player

Case "/kick"

If GetPlayerAccess(MyIndex) < ADMIN_MONITOR Then GoTo Continue

If UBound(Command) < 1 Then

AddText "Usage: /kick (name)", AlertColor

GoTo Continue

End If

If IsNumeric(Command(1)) Then

AddText "Usage: /kick (name)", AlertColor

GoTo Continue

End If

SendKick Command(1)

' // Mapper Admin Commands //

' Location

Case "/loc"

If GetPlayerAccess(MyIndex) < ADMIN_MAPPER Then GoTo Continue

BLoc = Not BLoc

' Map Editor

Case "/editmap"

If GetPlayerAccess(MyIndex) < ADMIN_MAPPER Then GoTo Continue

SendRequestEditMap

' Warping to a player

Case "/warpmeto"

If GetPlayerAccess(MyIndex) < ADMIN_MAPPER Then GoTo Continue

If UBound(Command) < 1 Then

AddText "Usage: /warpmeto (name)", AlertColor

GoTo Continue

End If

If IsNumeric(Command(1)) Then

AddText "Usage: /warpmeto (name)", AlertColor

GoTo Continue

End If

WarpMeTo Command(1)

' Warping a player to you

Case "/warptome"

If GetPlayerAccess(MyIndex) < ADMIN_MAPPER Then GoTo Continue

If UBound(Command) < 1 Then

AddText "Usage: /warptome (name)", AlertColor

GoTo Continue

End If

If IsNumeric(Command(1)) Then

AddText "Usage: /warptome (name)", AlertColor

GoTo Continue

End If

WarpToMe Command(1)

' Warping to a map

Case "/warpto"

If GetPlayerAccess(MyIndex) < ADMIN_MAPPER Then GoTo Continue

If UBound(Command) < 1 Then

AddText "Usage: /warpto (map #)", AlertColor

GoTo Continue

End If

If Not IsNumeric(Command(1)) Then

AddText "Usage: /warpto (map #)", AlertColor

GoTo Continue

End If

n = CLng(Command(1))

' Check to make sure its a valid map #

If n > 0 And n <= MAX_MAPS Then

Call WarpTo(n)

Else

Call AddText("Invalid map number.", Red)

End If

' Setting sprite

Case "/setsprite"

If GetPlayerAccess(MyIndex) < ADMIN_MAPPER Then GoTo Continue

If UBound(Command) < 1 Then

AddText "Usage: /setsprite (sprite #)", AlertColor

GoTo Continue

End If

If Not IsNumeric(Command(1)) Then

AddText "Usage: /setsprite (sprite #)", AlertColor

GoTo Continue

End If

SendSetSprite CLng(Command(1))

' Map report

Case "/mapreport"

If GetPlayerAccess(MyIndex) < ADMIN_MAPPER Then GoTo Continue

SendMapReport

' Respawn request

Case "/respawn"

If GetPlayerAccess(MyIndex) < ADMIN_MAPPER Then GoTo Continue

SendMapRespawn

' MOTD change

Case "/motd"

If GetPlayerAccess(MyIndex) < ADMIN_MAPPER Then GoTo Continue

If UBound(Command) < 1 Then

AddText "Usage: /motd (new motd)", AlertColor

GoTo Continue

End If

SendMOTDChange Right$(ChatText, Len(ChatText) - 5)

' Check the ban list

Case "/banlist"

If GetPlayerAccess(MyIndex) < ADMIN_MAPPER Then GoTo Continue

SendBanList

' Banning a player

Case "/ban"

If GetPlayerAccess(MyIndex) < ADMIN_MAPPER Then GoTo Continue

If UBound(Command) < 1 Then

AddText "Usage: /ban (name)", AlertColor

GoTo Continue

End If

SendBan Command(1)

' // Developer Admin Commands //

' Editing item request

Case "/edititem"

If GetPlayerAccess(MyIndex) < ADMIN_DEVELOPER Then GoTo Continue

SendRequestEditItem

' Editing animation request

Case "/editanimation"

If GetPlayerAccess(MyIndex) < ADMIN_DEVELOPER Then GoTo Continue

SendRequestEditAnimation

' Editing npc request

Case "/editnpc"

If GetPlayerAccess(MyIndex) < ADMIN_DEVELOPER Then GoTo Continue

SendRequestEditNpc

Case "/editresource"

If GetPlayerAccess(MyIndex) < ADMIN_DEVELOPER Then GoTo Continue

SendRequestEditResource

' Editing shop request

Case "/editshop"

If GetPlayerAccess(MyIndex) < ADMIN_DEVELOPER Then GoTo Continue

SendRequestEditShop

' Editing spell request

Case "/editspell"

If GetPlayerAccess(MyIndex) < ADMIN_DEVELOPER Then GoTo Continue

SendRequestEditSpell

' // Creator Admin Commands //

' Giving another player access

Case "/setaccess"

If GetPlayerAccess(MyIndex) < ADMIN_CREATOR Then GoTo Continue

If UBound(Command) < 2 Then

AddText "Usage: /setaccess (name) (access)", AlertColor

GoTo Continue

End If

If IsNumeric(Command(1)) Or Not IsNumeric(Command(2)) Then

AddText "Usage: /setaccess (name) (access)", AlertColor

GoTo Continue

End If

SendSetAccess Command(1), CLng(Command(2))

' Ban destroy

Case "/destroybanlist"

If GetPlayerAccess(MyIndex) < ADMIN_CREATOR Then GoTo Continue

SendBanDestroy

' Packet debug mode

Case "/debug"

If GetPlayerAccess(MyIndex) < ADMIN_CREATOR Then GoTo Continue

DEBUG_MODE = (Not DEBUG_MODE)

Case Else

AddText "Not a valid command!", HelpColor

End Select

'continue label where we go instead of exiting the sub

Continue:

MyText = vbNullString

frmMain.txtMyChat.Text = vbNullString

Exit Sub

End If

' Say message

If Len(ChatText) > 0 Then

Call SayMsg(ChatText)

End If

MyText = vbNullString

frmMain.txtMyChat.Text = vbNullString

Exit Sub

End If

' Handle when the user presses the backspace key

If (KeyAscii = vbKeyBack) Then

If LenB(MyText) > 0 Then MyText = Mid$(MyText, 1, Len(MyText) - 1)

End If

' And if neither, then add the character to the user's text buffer

If (KeyAscii <> vbKeyReturn) Then

If (KeyAscii <> vbKeyBack) Then

MyText = MyText & ChrW$(KeyAscii)

End If

End If

' Error handler

Exit Sub

errorhandler:

HandleError "HandleKeyPresses", "modInput", Err.Number, Err.Description, Err.Source, Err.HelpContext

Err.Clear

Exit Sub

End Sub

```
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...