This is my login packet... please let me know if there is something screwed here.
Code:
' ::::::::::::::::::
' :: Login packet ::
' ::::::::::::::::::
If LCase(Parse(0)) = "login" Then
If Not IsPlaying(index) And Not IsLoggedIn(index) Then
' Get the data
Name = Parse(1)
Password = Parse(2)
' Check versions
If Val(Parse(3)) < CLIENT_MAJOR Or Val(Parse(4)) < CLIENT_MINOR Or Val(Parse(5)) < CLIENT_REVISION Then
Call AlertMsg(index, "Version outdated, please visit http://mirage.katami.com")
Exit Sub
End If
If Len(Trim(Name)) < 3 Or Len(Trim(Password)) < 3 Then
Call AlertMsg(index, "Your name and password must be at least three characters in length")
Exit Sub
End If
If Not AccountExist(Name) Then
Call AlertMsg(index, "That account name does not exist.")
Exit Sub
End If
If Not PasswordOK(Name, Password) Then
Call AlertMsg(index, "Incorrect password.")
Exit Sub
End If
If IsMultiAccounts(Name) Then
Call AlertMsg(index, "Multiple account logins is not authorized.")
Exit Sub
End If
' Prevent Dupeing
For i = 1 To Len(Name)
n = Asc(Mid(Name, i, 1))
If (n >= 65 And n <= 90) Or (n >= 97 And n <= 122) Or (n = 95) Or (n = 32) Or (n >= 48 And n <= 57) Then
Else
Call AlertMsg(index, "haha you made a booboo!!!")
Exit Sub
End If
Next i
' Everything went ok
' Load the player
Call LoadPlayer(index, Name)
Call SendChars(index)
' Show the player up on the socket status
Call AddLog(GetPlayerLogin(index) & " has logged in from " & GetPlayerIP(index) & ".", PLAYER_LOG)
Call TextAdd(frmServer.txtText, GetPlayerLogin(index) & " has logged in from " & GetPlayerIP(index) & ".", True)
End If
Exit Sub
End If
Code:
' ::::::::::::::::::::::::::::
' :: Using character packet ::
' ::::::::::::::::::::::::::::
If LCase(Parse(0)) = "usechar" Then
If Not IsPlaying(index) Then
CharNum = Val(Parse(1))
' Prevent hacking
If CharNum < 1 Or CharNum > MAX_CHARS Then
Call HackingAttempt(index, "Invalid CharNum")
Exit Sub
End If
' Check to make sure the character exists and if so, set it as its current char
If CharExist(index, CharNum) Then
Player(index).CharNum = CharNum
Call JoinGame(index)
CharNum = Player(index).CharNum
Call AddLog(GetPlayerLogin(index) & "/" & GetPlayerName(index) & " has began playing " & GAME_NAME & ".", PLAYER_LOG)
Call TextAdd(frmServer.txtText, GetPlayerLogin(index) & "/" & GetPlayerName(index) & " has began playing " & GAME_NAME & ".", True)
Call UpdateCaption
' Now we want to check if they are already on the master list (this makes it add the user if they already haven't been added to the master list for older accounts)
If Not FindChar(GetPlayerName(index)) Then
f = FreeFile
Open App.Path & "\data\accounts\charlist.txt" For Append As #f
Print #f, GetPlayerName(index)
Close #f
End If
Else
Call AlertMsg(index, "Character does not exist!")
End If
End If
Exit Sub
End If
Thank You Korrey D.